- Code: Select all
QUIZbot for phpfreechat 1.3
by satanspet, and jaybird
---
Extract the package to the /src/
Add the proxy into the post_proxies parameter by adding the following line to your chatroom generating code:
Code:
$params["post_proxies"] = array("quiz");
Add the proxy params into the proxies_cfg array located in pfcglobalconfig.php around line 234 by adding the following line:
"quiz" => array("adminlock" => false,"roomlock" => "","roomavoid" => "","nickname" => "quizbot")
<original_code>
var $proxies_cfg = array("auth" => array(),
"noflood" => array("charlimit" => 450,
"msglimit" => 10,
"delay" => 5),
"censor" => array("words" => array(),
"replaceby" => "*",
"regex" => false),
"log" => array("path" => ""));
</original_code>
<new_code>
var $proxies_cfg = array("auth" => array(),
"noflood" => array("charlimit" => 450,
"msglimit" => 10,
"delay" => 5),
"censor" => array("words" => array(),
"replaceby" => "*",
"regex" => false),
"quiz" => array("adminlock" => false,
"roomlock" => "",
"roomavoid" => "",
"nickname" => "quizbot"),
"log" => array("path" => ""));
</new_code>
Proxy Param's
---------------
adminlock: Locks the script to admin access only for the following commands, @init @add @listsets @clearscores globally for all rooms.(default: false)
roomlock: Locks the script to the defined room, no access is permitted to the following commands, @init @add @listsets @clearscores unless they are issued in the defined room. No Exceptions
roomavoid: Script will avoid the following commands, @init @add @listsets @clearscores issued in the defined room, unless issued by an administrator.
nickname: The nick name that the bot will speak through. (default: quizbot)
----------------
Next, add the following lines to the bottom of your local language file located in /i18n/ (example: /i18n/en_US/main.php)
<lines>
//lines of the quiz bot proxy
$GLOBALS["i18n"]["{player} is correct!! Well done :D"] = "{player} is correct!! Well done! <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["{player} has got it this time."] = "{player} you're right! <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["{player} is a genius, he's got it!"] = "{player} you're a genius, you got it! <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["Nice one {player}, that's it!"] = "Nice one {player}, that's it! <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["That's the one {player}! Well done :D"] = "That's the one {player}! Well done! <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["Close enough {player}, I'll give you that one."] = "Close enough {player}, I'll give you that one. <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["Yeah, that'll do {player}."] = "Yeah, that'll do {player}. <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["Go on {player}, I'm feeling generous."] = "Okay, close enough {player}, I'm feeling generous. <span style='color: #080;'>+</span>";
$GLOBALS["i18n"]["Close, but not quite close enough {player} :P"] = "Close, but not quite close enough {player}. <span style='color: #800;'>-</span>";
$GLOBALS["i18n"]["Nearly there {player}"] = "Almost got it {player}. <span style='color: #800;'>-</span>";
$GLOBALS["i18n"]["No I'm not giving you that {player} :^)"] = "No I'm not giving you that {player}. <span style='color: #800;'>-</span>";
$GLOBALS["i18n"]["<b>Here are my commands:</b><br>"] = "<b>Here are my commands:</b><br>";
$GLOBALS["i18n"]["@init {set} - loads the specified question set<br>"] = "@init {set} - loads the specified question set<br>";
$GLOBALS["i18n"]["@add {set} - adds the specified question set<br>"] = "@add {set} - adds the specified question set<br>";
$GLOBALS["i18n"]["@listsets - lists all available question sets<br>"] = "@listsets - lists all available question sets<br>";
$GLOBALS["i18n"]["@ask - ask a question<br>"] = "@ask - ask a question<br>";
$GLOBALS["i18n"]["@hint - give a clue<br>"] = "@hint - give a clue<br>";
$GLOBALS["i18n"]["@scores - print the current scores<br>"] = "@scores - print the current scores<br>";
$GLOBALS["i18n"]["@clearscores - clears the scores<br>"] = "@clearscores - clears the scores<br>";
$GLOBALS["i18n"]["Could not find question set: %s"] = "Could not find question set: %s";
$GLOBALS["i18n"]["Question set loaded: %s"] = "Question set loaded: %s";
$GLOBALS["i18n"]["Question set added: %s"] = "Question set added: %s";
$GLOBALS["i18n"]["The question set appears to be empty :S Check %s.questions.php"] = "The question set appears to be empty! Check %s.questions.php";
$GLOBALS["i18n"]["No question set specified"] = "No question set specified";
$GLOBALS["i18n"]["<b>Installed question sets are:</b><br />"] = "<b>Installed question sets are:</b><br />";
$GLOBALS["i18n"]["I don't know any questions, use @init first"] = "I don't know any questions, use @init to load a question set.";
$GLOBALS["i18n"]["I've not asked a question ^o)"] = "I've not asked a question.";
$GLOBALS["i18n"]["<b>The Scores Are:</b><br><table align='center' border='1px'><tr><th>Player</th><th>Score</th></td>"] = "<b>The Scores Are:</b><br><table align='center' border='1px'><tr><th>Player</th><th>Score</th></td>";
$GLOBALS["i18n"]["No scores have been set"] = "No scores have been set";
$GLOBALS["i18n"]["Scores cleared"] = "Scores cleared";
$GLOBALS["i18n"]["Quizbot puzzled :S - %s"] = "Invalid @ command - %s";
$GLOBALS["i18n"]["Only administrators can initiate the Quizbot in this room."] = "Only administrators can initiate the Quizbot in this room.";
$GLOBALS["i18n"]["Only administrators can add question sets to the Quizbot."] = "Only administrators can add question sets to the Quizbot.";
$GLOBALS["i18n"]["Only administrators can list the Quizbot's question sets in this room."] = "Only administrators can list the Quizbot's question sets in this room.";
$GLOBALS["i18n"]["Only administrators can clear the Quizbot's scores in this room."] = "Only administrators can clear the Quizbot's scores in this room.";
$GLOBALS["i18n"]["Quiz completed, the current scores are:"] = "<b>Quiz completed</b>, the current scores are:<br />";
$GLOBALS["i18n"]["<br><table align='center' border='1px'><tr><th>Player</th><th>Score</th></td>"] = "<br><table align='center' border='1px'><tr><th>Player</th><th>Score</th></td>";
$GLOBALS["i18n"]["You can not initiate the Quizbot in this room. Please /join <b>%s</b> to play."] = "You can not initiate the Quizbot in this room. Please /join <b>%s</b> to play.";
$GLOBALS["i18n"]["You can not add sets the Quizbot in this room. Please /join <b>%s</b> to add them."] = "You can not add sets the Quizbot in this room. Please /join <b>%s</b> to add them.";
$GLOBALS["i18n"]["You can not list the Quizbot's question sets in this room. Please /join <b>%s</b> to play."] = "You can not list the Quizbot's question sets in this room. Please /join <b>%s</b> to play.";
$GLOBALS["i18n"]["You can not show the Quizbot's scores in this room. Please /join <b>%s</b> to play."] = "You can not show the Quizbot's scores in this room. Please /join <b>%s</b> to play.";
$GLOBALS["i18n"]["You can not clear the Quizbot's scores in this room. Please /join <b>%s</b> to play."] = "You can not clear the Quizbot's scores in this room. Please /join <b>%s</b> to play.";
</lines>
Once you have made these edits, you must rehash the chat room, in order to refresh the proxy param's.
To actually use the bot, all of the commands are on @command rather than /command because the commands are handled differently to the standard room commands (and because @command is standard for most bots). Type @help to get a full list of commands available, and I'll list them here too:
@help
@init {set} {#} - loads only the specified question set, and starts a game of # questions (default: 10).
@add {set} - adds in the specified question set.
@listsets - lists all available question sets.
@ask - asks a random question.
@hint - gives a clue.
@scores - lists the scores.
@clearscores
---
www.phpfreechat.net
Download it here: http://www.foolchild.com/quizbot1.3.zip