• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Quizbot for phpfreechat 1.3

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
11 posts • Page 1 of 1

Postby Jaybird » Mon Sep 06, 2010 10:13 pm

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
Last edited by Jaybird on Mon Sep 06, 2010 11:54 pm, edited 1 time in total.
Jaybird
Member
 
Posts: 65
Joined: Mon Jun 28, 2010 7:59 am
Top

Postby bugsmafia » Wed Sep 08, 2010 2:17 pm

In what file to add this line?
Add the proxy into the post_proxies parameter by adding the following line to your chatroom generating code:
Code:
$params["post_proxies"] = array("quiz");
bugsmafia
Member
 
Posts: 12
Joined: Mon Jul 05, 2010 12:56 pm
Top

Postby Jaybird » Wed Sep 08, 2010 6:01 pm

ur index.php or chat.php, where ever you set ur params.. you can also just add it to the linie var $post_proxies in your phpgloalconfig.php
Jaybird
Member
 
Posts: 65
Joined: Mon Jun 28, 2010 7:59 am
Top

Postby bugsmafia » Wed Sep 08, 2010 7:21 pm

Not start the bot ((
In general, as I have installed:
From (quizbot1.3) pulled out all of (src)
a file (jpfchat.php) added a line ($ params ["post_proxies"] = array ("quiz");)
Making the change of code (pfcglobalconfig.class.php) as stated above.
Posted language phrases.
Made / rehash
And while nothing
bugsmafia
Member
 
Posts: 12
Joined: Mon Jul 05, 2010 12:56 pm
Top

Postby bugsmafia » Wed Sep 08, 2010 7:28 pm

Earn bot.
I had a FTP www / components / com_jpfchat / pfc / data / private session
remove all that would be cleared. now excellent.
Works. thanks
bugsmafia
Member
 
Posts: 12
Joined: Mon Jul 05, 2010 12:56 pm
Top

Postby re*s.t.a.r.s.*2 » Fri Sep 10, 2010 2:26 am

I think I've found a bug, if a tell the bot to @init general 100 it will ask you 20 or 30 questions and then will show the score table...

I don't know if is only with me or I am doing something Wrong...
free singles chat rooms, no registration
online singles chats no downloads
free singles chat rooms
Text and Chat Singles no need to register or app required
BatePapo Papinho Gratuito e sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby Jaybird » Sat Sep 18, 2010 11:13 am

how many questions where in the question set?
Jaybird
Member
 
Posts: 65
Joined: Mon Jun 28, 2010 7:59 am
Top

Postby radionow » Mon Dec 13, 2010 4:20 am

i've noticed this bot puts questions in order, is there a way to make it random?
My Site: http://chickentalk.org/
radionow
Member
 
Posts: 57
Joined: Sun Jan 10, 2010 6:26 pm
Top

Postby phreadom » Sat Dec 18, 2010 6:30 am

The bot seems to be working well for me so far.

But I've been having a lot of trouble trying to add support for multi-dimensional arrays to the question/answer part. I need to be able to have questions that have multiple answers... :(

Is there any chance of getting some help implementing such a feature?

There are a few other features I'm looking to add as well... for instance adding a @skip option to skip the current question and making it so that @ask won't ask the next question until the current one is answered. This way we can avoid multiple people hitting @ask at the same time and skipping questions accidentally.
phreadom
Support Team
 
Posts: 13
Joined: Fri Apr 04, 2008 8:03 pm
Top

Postby andreic » Wed Apr 20, 2011 1:19 pm

How can I make the bot to display questions without typing ask every time?
andreic
New member
 
Posts: 1
Joined: Wed Apr 20, 2011 1:17 pm
Top

Postby chattunnel » Thu May 24, 2012 8:08 pm

I extracted and edited code as states but still not working,
http://www.chattunnel.com/chat/ctchat.php
chattunnel
Member
 
Posts: 10
Joined: Fri May 11, 2012 3:16 pm
Location: http://www.chattunnel.com
  • Website
Top


Post a reply
11 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 1 guest

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub