BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.4 support => Topic started by: Mrs on September 14, 2007, 12:57:21 am
-
I am new to bebot but for some reason everytime someone logs into the bot it restarts itself how can I make it stop?
-
Edit the Startbot.php file so that the code
while (true)
{
$last_line = system($php_bin . $php_args . " " . $main_php . " " . $argv[1]);
if (preg_match("/^The bot has been shutdown/i", $last_line))
die();
else
sleep(1);
}
looks like this:
while (true)
{
$last_line = system($php_bin . $php_args . " " . $main_php . " " . $argv[1]);
// if (preg_match("/^The bot has been shutdown/i", $last_line))
die();
// else
// sleep(1);
}
That should enable you to see the error that forced the bot to restart. Post that error here.
-
[13-Sep-2007 18:41:54] PHP Fatal error: Cannot use string offset as an array in C:\Documents and Settings\Kim\Desktop\Stpeter2\modules\Logon_GUILD.php on line 149
thats out of the logfile
-
what version 0.4.1?
-
$bot_version = "0.3.5"; its what my friend sent me I suppose that could be my issue...
-
I am thinking defunct database or old schema for the whois-cache.
In any case I would really recomend running the latest official release.
-
I may just upgrade it..
-
if i can figure everything out again I kinda had help before heh
-
Please post the 5 lines above and below 149 of your modules/Logon_guild.php-file so we can debug it.
You see it does appear that you're using a modified version of Logon_GUIILD.php because line 149 of the file tagged for 0.3.5 reads '}' and that line would not cause that error.
-
or rename the file to .phps and attach it :D
-
attatched
-
Fixed should be
also changed it so it only says city is unsafe for 40mins which should be long enough for ground part
if your want to change how long city is unsafe edit line 151
if ($result[0][1] == "off" && $result[0][0]+(60*40) > time())
and change the 40 to howmany mins you want
-
well its not crashing thanks so much :)
-
I'll have a go at a fix then. From the file you posted
Find line 149 in the code. It should be in the block reading
// Send city cloak status
$result = $this -> bot -> db -> select("SELECT time, action FROM #___org_city WHERE action = 'on' OR action = 'off' ORDER BY time DESC LIMIT 0, 1");
if ($result[0][1] == "on")
{
$state = "The city cloak is currently <font color=#00FF00>Enabled</font>. It is safe to enter the city";
}
else if ($result[0][1] == "off")
{
$state = "<font color=#FF0000>WARNING!!</font> <font color=#FFFFFF>The city cloak is currently <font color=#FF0000>Disabled</font>. It is NOT safe to enter the city</font>";
}
else
{
$state = "Unable to determine cloak status, Please be cautious when entering the city";
}
$this -> bot -> send_tell($name, $state);
This piece of code is erroneous as it doesn't take into account that the query will return empty if there are no matches for the query. The fix is quite easy:
// Send city cloak status
$result = $this -> bot -> db -> select("SELECT time, action FROM #___org_city WHERE action = 'on' OR action = 'off' ORDER BY time DESC LIMIT 0, 1");
if(!empty($result))
{
if ($result[0][1] == "on")
{
$state = "The city cloak is currently <font color=#00FF00>Enabled</font>. It is safe to enter the city";
}
else if ($result[0][1] == "off")
{
$state = "<font color=#FF0000>WARNING!!</font> <font color=#FFFFFF>The city cloak is currently <font color=#FF0000>Disabled</font>. It is NOT safe to enter the city</font>";
}
}
else
{
$state = "Unable to determine cloak status, Please be cautious when entering the city";
}
$this -> bot -> send_tell($name, $state);
Do note that this doesn't take into account that ground raids doens't last the full hour it takes for the cloak to be re-enabled as Temars fix did. However it's easier to make a small fix and then add such a fix later.
Edit: Missed a crucial line...
-
its working now thanks guys <3