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

Title: Bot reboots
Post 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?
Title: Re: Bot reboots
Post by: Blueeagle on September 14, 2007, 01:30:09 am
Edit the Startbot.php file so that the code
Code: [Select]
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:
Code: [Select]
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.
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 01:42:37 am
[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
Title: Re: Bot reboots
Post by: Temar on September 14, 2007, 01:58:39 am
what version 0.4.1?
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 02:01:21 am
$bot_version = "0.3.5"; its what my friend sent me I suppose that could be my issue...
Title: Re: Bot reboots
Post by: Blueeagle on September 14, 2007, 02:02:21 am
I am thinking defunct database or old schema for the whois-cache.

In any case I would really recomend running the latest official release.
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 02:02:48 am
I may just upgrade it..
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 02:06:37 am
if i can figure everything out again I kinda had help before heh
Title: Re: Bot reboots
Post by: Blueeagle on September 14, 2007, 02:07:16 am
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.
Title: Re: Bot reboots
Post by: Temar on September 14, 2007, 02:11:33 am
or rename the file to .phps and attach it :D
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 02:15:23 am
attatched
Title: Re: Bot reboots
Post by: Temar on September 14, 2007, 02:35:04 am
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
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 02:39:41 am
well its not crashing thanks so much :)
Title: Re: Bot reboots
Post by: Blueeagle on September 14, 2007, 02:44:47 am
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

Code: [Select]
// 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:

Code: [Select]
// 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...
Title: Re: Bot reboots
Post by: Mrs on September 14, 2007, 02:45:53 am
its working now thanks guys <3
SimplePortal 2.3.7 © 2008-2025, SimplePortal