BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Age of Conan Archive => BeBot Hyborian support => Topic started by: Wizhk on February 25, 2009, 06:37:23 am
-
Can still not get the trivia module from this link to work.
http://bebot.link/0-5-x-customunofficial-modules/custom-revised-modules-by-eldar/ (http://bebot.link/0-5-x-customunofficial-modules/custom-revised-modules-by-eldar/)
I have the same issues as listed in that link.
trivia.txt placed in all sorts of extras folders. And still when I do !trivia ask in guild chat It says that I have no trivia questions..
Any Help.. Plz
Wizhk
-
$handle = fopen("extras/trivia.txt", "r");
so basicly that file has goto be in a folder called extras which has goto be in the root folder of the bot
if linux make sure all lower case as that how it is in module and linux is case sensitive
-
Windows Vista 32 is my Operating system.
I have a folder in my bebot root directory named extras that has the trivia.txt in it.
Do you have this module working in AOC? And if so, can you link your copy of both files.
Thank You,
Wizhk
-
Does anyone have the Trivia module working?
Wizhk
-
I got it working,
You have to change the settings, !set trivia and put the entry on -1
-
OK so In Settings I now have.
null
-1
null
It still wont find the Trivia questions.
-
me too, you sure you have the .txt file in the right folder?
-
I have an extras folder in c:/ , c:/bebot , c:/bebot/custom , c:/custom/modules , and maybe a few other places.. lol.
They are all text files and I have added.txt to the name on them all and removed .txt from the name on them all.
Still nothing.
Can you copy and paste your trivia module php file. maybe I have a wrong one.
Wizhk
-
<?php
/*
* Trivia.php - Module template.
*
* Developed by Meathooks and Elesar of the Eldar Guild (http://eldarguild.org)
* a Age of Conan Guild on the Dagoth server
*
*/
$trivia = new Trivia($bot);
class trivia Extends BaseActiveModule
{
function __construct (&$bot)
{
parent::__construct(&$bot, get_class($this));
$this -> register_command('gc', 'trivia', 'MEMBER');
$this -> help['description'] = 'Trivia Questions and you have to guess the answers.';
$this -> help['command']['trivia ask']="Displays a random trivia question for you to answer.";
$this -> help['command']['trivia answer [yourguess]']="Sends your answer to the current trivia question.";
$this -> help['command']['trivia giveup]']="Sends the answer to the current trivia question.";
$this -> bot -> core("settings") -> create("Trivia", "Entry", "-1", "");
$this -> bot -> core("settings") -> create("Trivia", "Question", "*NONE*", "");
$this -> bot -> core("settings") -> create("Trivia", "Answer", "*NONE*", "");
}
function command_handler($name, $msg, $origin)
{
if ($msg == "trivia ask")
{
$msg = $this->get_trivia();
}
elseif ($msg == "trivia giveup")
{
$msg = $this->giveup_trivia();
}
else if (preg_match("/^trivia answer (.+)$/i", $msg, $info))
{
$msg = $this->answer_trivia($info[1], $name);
}
else
{
$msg = "##highlight##TRIVIA::##end## UNKNOWN COMMAND part of Trivia Module";
}
return ($msg);
}
function get_trivia()
{
$trivia_active = $this->bot->core("settings")->get("Trivia","Entry");
if($trivia_active == -1)
{
$handle = fopen("txt/trivia.txt", "r");
if ($handle)
{
while (!feof($handle))
{
$buffer = fgets($handle, 8192);
$pos = strpos($buffer, "*");
if ($pos !== false)
{
$question = substr($buffer, 0, $pos);
$array_questions[] = $question;
$answer = substr($buffer, $pos + 1, strlen($buffer) - $pos);
$array_answers[] = $answer;
}
}
}
$trivia_array_max = count($array_questions);
$trivia_active = rand(0, $trivia_array_max);
$this->bot->core("settings")->save("Trivia", "Entry", $trivia_active);
$this->bot->core("settings")->save("Trivia", "Question", $array_questions[$trivia_active]);
$this->bot->core("settings")->save("Trivia", "Answer", $array_answers[$trivia_active]);
}
$question = $this->bot->core("settings")->get("Trivia","Question");
if ($question != "" and $question != "**NONE**")
{
$strmsg = "##highlight##TRIVIA::##end## ##highlight##[Question]##end## " . $question;
$strmsg .= "\nTo submit your guess for the trivia, type in: ##highlight##!trivia answer YOURANSWER##end##";
}
else
{
$strmsg = "##highlight##TRIVIA::##end## No trivia questions were found, please have some added :)";
}
return $strmsg;
}
function answer_trivia($stranswer, $name)
{
$answer = trim($this->bot->core("settings")->get("Trivia","Answer"));
if ($answer != "" and $answer != "**NONE**")
{
if (strcmp(strtolower($answer), strtolower($stranswer)) != 0)
{
$strmsg = "##highlight##TRIVIA::##end## " . $name . "'s guess for the trivia question was incorrect ($stranswer), please try again.";
}
else
{
$strmsg = "##highlight##TRIVIA::##end## " . $name . " answered the trivia question ##highlight##CORRECTLY##end##. The answer was ##highlight##$answer##end##. Good Job! (type '!trivia ask' to ask another question)";
$this->bot->core("settings")->save("Trivia", "Entry", -1);
$this->bot->core("settings")->save("Trivia", "Question", "**NONE**");
$this->bot->core("settings")->save("Trivia", "Answer", "**NONE**");
}
}
else
{
$strmsg = "##highlight##TRIVIA::##end## No trivia questions active or found to answer, try !trivia ask";
}
return $strmsg;
}
function giveup_trivia($stranswer, $name)
{
$answer = trim($this->bot->core("settings")->get("Trivia","Answer"));
if ($answer != "" and $answer != "**NONE**")
{
$strmsg = "##highlight##TRIVIA::##end## You all gave up :( .. lol ... the answer to the trivia question is ##highlight##$answer##end##.";
$this->bot->core("settings")->save("Trivia", "Entry", -1);
$this->bot->core("settings")->save("Trivia", "Question", "**NONE**");
$this->bot->core("settings")->save("Trivia", "Answer", "**NONE**");
}
else
{
$strmsg = "##highlight##TRIVIA::##end## No trivia questions active or found to answer, try !trivia ask";
}
return $strmsg;
}
}
?>
-
Interesting.. your file doesn't point to the extras folder.
Copied and pasted, placed a new trivia.txt in the module folder, did the -1, and all is fine now.
Thanks alot.
Wizhk
-
I putted mine in the txt folder.
Glad it works now.
-
anyone still have this module somewhere? Old links don't host it anymore for trivia for the bots
-
I've got the module, but I could never make the damn thing work. I even tried the one posted in this thread. I put the TXT file Everywhere lol. Still no luck
Where are you changing settings to Null -1 ?
-
Anyone have the trivia.txt file for this, or at the leas the format of the file?
-
I heard that people were asking about this mod .... so here you go :)
-
couldn't get to work either, but constantly refuses any commands on trivia except for !set trivia and !help trivia
it's not giving me any error message concerning the location of the trivia.txt, so think that is working ok
-
does the mod reply with anything for "!trivia ask"??
-
no just "tell <bot> help"
almost like the command wasn't registered
-
Thanks meathooks that is sooo awesome that you provided those files....tyvm tyvm