collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Bot crashes with !city or !cloak  (Read 3946 times)

0 Members and 2 Guests are viewing this topic.

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Bot crashes with !city or !cloak
« on: May 20, 2006, 10:51:26 pm »
I have recently installed BeBot v0.2.4 and got it all working and everything.  One problem I'm having that I can't seem to resolve is if I use the !city or !cloak commands the bot crashes.  I've looked through all the files and tried finding something about it on here but dont' see anything.

Anyone shed a little light on it for me?

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #1 on: May 21, 2006, 02:26:09 am »
well drop cloak once and then it should work,
thats what i happend also i think, not sure.

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #2 on: May 21, 2006, 10:32:05 am »
Ok, have now ran a raid so cloak has been off and then back on and stil crashes bot.  Noticed that it didn't create the org_city table in mysql for some reason so manually added that and same thing.

Any other ideas?

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #3 on: May 21, 2006, 11:07:39 am »
the cmd window that the bot runs on should show you an error. What does it say?
Rather than us trying to guess what the problem is, an exact error would be much more helpful.

BTW, you can turn on error logging in PHP.
Place this in the php.ini file that is local to the bot(I.E. the ini in the folder you installed Bebot too)
Code: [Select]
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 4096
error_log = ./log/php_errors.txt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
« Last Edit: May 21, 2006, 11:24:28 am by Xenixa »
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Bot crashes with !city or !cloak
« Reply #4 on: May 21, 2006, 12:57:34 pm »
I havent had the time to look into this yet, but an exact error would make my job easier when the time comes.
BeBot Founder and Fixer Kingpin

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #5 on: May 21, 2006, 10:17:30 pm »
It pops 2 errors and then bot restarts.

Warning: Invalid argument supplied for foreach() in C:\BeBot\BeBot_v0.2.4\BeBot_v0.2.4\BeBot-php_v5.1.4\modules\AlienAttack_GUILD.php on line 98

Fatal error: Cannot use string offset as an array in C:\BeBot\BeBot_v0.2.4\BeBot_v0.2.4\BeBot-php_v5.1.4\modules\AlienAttack_GUILD.php on line 118.

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #6 on: May 21, 2006, 11:19:15 pm »
Decided to test and see if it just didn't like php5.x so rolled back to PHP4.  Same error right off but haven't triggered another raid yet to see if that will make a difference.  I'm also noticing one other strange thing happening that prompted me to try this.  The !battle command works great, but the !victory command dosen't.  Well, it does sort of.  The window comes up but never any data in it.

Will let you know if it makes any difference

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Bot crashes with !city or !cloak
« Reply #7 on: May 22, 2006, 03:54:58 am »
The bug is pretty clear. If there have been no city events, there will be an empty result from the database. The module does not take this possibility into account and assumes there will always be something in the database.

Try the following fix. Open modules/AlienAttack_GUILD.php
Find the following code:

	
function 
city_blob()
	
{
	
	
$city "<font color=CCInfoHeadline>::::: Recent City Attacks :::::</font><font color=CCInfoText>\n\n";

	
	
$result $this -> bot -> db -> select("SELECT time, action, player FROM org_city ORDER BY time DESC LIMIT 0, 12");
	
	
foreach (
$result as $res)
	
	
{
	
	
	
$city .= "<font color=CCInfoHeader>Time:</font> <font color=CCCCHeaderColor>" gmdate("M j, Y, G:i"$res[0]) . " GMT</font>\n";

	
	
	
if (
$res[1] == "attack")
	
	
	
$city .= "City was attacked.\n";
	
	
	
else if (
$res[1] == "on")
	
	
	
$city .= $res[2] . " turned cloaking <font color=CCCCTextColor>on</font>.\n";
	
	
	
else if (
$res[1] == "off")
	
	
	
$city .= $res[2] . " turned cloaking <font color=CCCCTextColor>off</font>.\n";
	
	
	
else if (
$res[1] == "hq")
	
	
	
$city .= $res[2] . " destroyed the <font color=CCCCTextColor>HQ</font>.\n";
	
	
	
else if (
$res[1] == "house")
	
	
	
$city .= $res[2] . " destroyed a <font color=CCCCTextColor>building</font>.\n";

	
	
	
$city .= "\n";
	
	
}

	
	
$result $this -> bot -> db -> select("SELECT time, action FROM org_city WHERE action = 'on' OR action = 'off' ORDER BY time DESC LIMIT 0, 1");

	
	
$avilmin date("i",3600-(time()-$result[0][0]));
	
	
$avilsec date("s",3600-(time()-$result[0][0]));

	
	
if (
$result[0][1] == "on")
	
	
{
	
	
	
$status "enable";
	
	
	
$status2 "disable";
	
	
}
	
	
else
	
	
{
	
	
	
$status "disable";
	
	
	
$status2 "enable";
	
	
}

	
	
if(
$result[0][0] > (time() - 3600))
	
	
$ttchange true;
	
	
else
	
	
$ttchange false;

	
	
$state "The cloaking device is <font color=#ffff00>" $status "d</font>.";
	
	
$state .= $ttchange "" " It is now possible to <font color=#ffff00>" $status2 "</font> it. ";
	
	
$state .= $ttchange " It will be possible to <font color=#ffff00>" $status2 "</font> it in " $avilmin "</font> minutes and <font color=#ffff00>" $avilsec "</font> seconds. " "";
	
	
return 
$state $this -> bot -> make_blob("City History"$city);
	
}


Replace it with the following:

	
function 
city_blob()
	
{
	
	
$result $this -> bot -> db -> select("SELECT time, action, player FROM org_city ORDER BY time DESC LIMIT 0, 12");
	
	
if (!
$result)
	
	
{
	
	
	
return 
"No city events found in database.";
	
	
}
	
	
else
	
	
{
	
	
	
$city "<font color=CCInfoHeadline>::::: Recent City Attacks :::::</font><font color=CCInfoText>\n\n";

	
	
	
foreach (
$result as $res)
	
	
	
{
	
	
	
	
$city .= "<font color=CCInfoHeader>Time:</font> <font color=CCCCHeaderColor>" gmdate("M j, Y, G:i"$res[0]) . " GMT</font>\n";
	

	
	
	
	
if (
$res[1] == "attack")
	
	
	
	
$city .= "City was attacked.\n";
	
	
	
	
else if (
$res[1] == "on")
	
	
	
	
$city .= $res[2] . " turned cloaking <font color=CCCCTextColor>on</font>.\n";
	
	
	
	
else if (
$res[1] == "off")
	
	
	
	
$city .= $res[2] . " turned cloaking <font color=CCCCTextColor>off</font>.\n";
	
	
	
	
else if (
$res[1] == "hq")
	
	
	
	
$city .= $res[2] . " destroyed the <font color=CCCCTextColor>HQ</font>.\n";
	
	
	
	
else if (
$res[1] == "house")
	
	
	
	
$city .= $res[2] . " destroyed a <font color=CCCCTextColor>building</font>.\n";

	
	
	
	
$city .= "\n";
	
	
	
}

	
	
	
$result $this -> bot -> db -> select("SELECT time, action FROM org_city WHERE action = 'on' OR action = 'off' ORDER BY time DESC LIMIT 0, 1");

	
	
	
$avilmin date("i",3600-(time()-$result[0][0]));
	
	
	
$avilsec date("s",3600-(time()-$result[0][0]));

	
	
	
if (
$result[0][1] == "on")
	
	
	
{
	
	
	
	
$status "enable";
	
	
	
	
$status2 "disable";
	
	
	
}
	
	
	
else
	
	
	
{
	
	
	
	
$status "disable";
	
	
	
	
$status2 "enable";
	
	
	
}

	
	
	
if(
$result[0][0] > (time() - 3600))
	
	
	
$ttchange true;
	
	
	
else
	
	
	
$ttchange false;

	
	
	
$state "The cloaking device is <font color=#ffff00>" $status "d</font>.";
	
	
	
$state .= $ttchange "" " It is now possible to <font color=#ffff00>" $status2 "</font> it. ";
	
	
	
$state .= $ttchange " It will be possible to <font color=#ffff00>" $status2 "</font> it in " $avilmin "</font> minutes and <font color=#ffff00>" $avilsec "</font> seconds. " "";
	
	
	
return 
$state $this -> bot -> make_blob("City History"$city);
	
	
}
	
}
« Last Edit: May 22, 2006, 04:01:50 am by Khalem »
BeBot Founder and Fixer Kingpin

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #8 on: May 22, 2006, 07:31:46 am »
Made that change and it really hates it.  Now whenever anyone talks at all in org chat the bot crashes.

Maybe if I give you full setup I have it will help...
Runing Windows Server 2k3, IIS 6, and now running php 4.4.2.  Using Bebot 0.2.4 (also put the BeBot-php_v5.1.4 stuff in).  I was using php5 but due to issues came back to php4 to see if it made a difference, but hasn't at all.

Mostly everything works... few issues.

Current issues:
The !city and !cloak commands as stated above.
The !victory command is always blank but I haven't had much of a chance to look at that one yet since I've been working on this.

Anything I could be missing here?

Offline Nogoal

  • BeBot Apprentice
  • ***
  • Posts: 77
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #9 on: May 22, 2006, 09:04:39 am »
Did you set $guild_name = ""; in conf/bot.conf ?

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #10 on: May 22, 2006, 09:17:41 am »
Which version of the AlienAttack_GUILD.php are you using? Is it the one packaged with 0.2.4 or from another version?

If you are running AOChat.php v1.19 with the AOKEX extension try this version here:
http://bebot.link/index.php/topic,210.msg2244.html#msg2244
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #11 on: May 22, 2006, 09:31:48 am »
Its the one that came packaged in it.  I screwed with it a little bit and got it working without crashing the bot now but its got one other flaw now.  I ran a raid and it worked flawlessly for that.  After I re-enabled cloak I did the !city and !cloak commands without crashing and it brought up a link for city history.  The history was blank and it said the cloak was disabled even though it was enabled.

[B.E.E.R. (TnA)] Beerraid: Dabsma turned the cloaking device in our city back on!
[B.E.E.R. (TnA)] Dabsma: -city
[B.E.E.R. (TnA)] Beerraid: The cloaking device is disabled. It is now possible to enable it. City History
[B.E.E.R. (TnA)] Dabsma: -cloak
[B.E.E.R. (TnA)] Beerraid: The cloaking device is disabled. It is now possible to enable it. City History

If I delete the table I built it dosen't crash but it also dosen't work as I stated above (looking at the php module it should have auto-created it if it didn't exist) but it gives a bunch (and I do mean bunch) of mysql errors.  If I have a table in there that I manually create using the colums and types listed in the module it still crashes.  Any other ideas?

Edit:
I manually added info into the table to see if that would work and now I just get:
Fatal error: Cannot use string offset as array in C:\BeBot\BeBot_v0.2.4\BeBot_v0.2.4\modules\AlienAttack_GUILD.php on line 118

Line 118 is:
      $city .= $res[2] . " destroyed the <font color=CCCCTextColor>HQ</font>.\n";

Ok, I manually added an entry in the table and it seems to work (displays the data and everything).  I'll have to test it tomorrow if it actually adds data in when I trigger a raid now.  Thanks for your help so far guys.  Its much appreciated!!
« Last Edit: May 22, 2006, 10:27:24 am by Dabaron »

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Bot crashes with !city or !cloak
« Reply #12 on: May 22, 2006, 03:25:27 pm »
Your really not giving me much to work with here.

First of all, the code changes should in no possible way crash the bot on any given text since its a specific function which is only called on the commands city and cloak.
Second, "It really hates it" and "Throws a bunch of errors" gives me no information about what the problem is, which means i have no way of helping you, because you just told me there was a problem, not what the problem was.

Im particularly interested in knowing what errors your getting when the script is trying to crate the database table if it doesnt exsist, as this seems to be the underlying problem.
If this table isnt created correctly with all the correct fields, the module will never work as intended.

The Victory command sounds like it could be suffering from the same problem, database table missing or not containing the expected fields.
BeBot Founder and Fixer Kingpin

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: Bot crashes with !city or !cloak
« Reply #13 on: May 22, 2006, 05:14:23 pm »
Sorry I wasn't more specific.  I said a lot because there were like 10 messages and trying to write them all down would have been a pain when I knew that the other way there was only 1 real message (and an extra for no data in the table).  I have now completely resolved the issue with data in the table.  For some reason it dosen't like split line sql entries so putting that all on one line fixed most of the issue.

In the tower attack module it was a similar thing.  Split line sql it didn't like.  Also ran into one other issue on that module... it was listing the winning orgs name as the losers faction so had to make a minor change.

Changed
$this -> bot -> db -> query("INSERT INTO tower_result (time, win_guild, win_side, lose_guild, lose_side) VALUES ('" . time() . "', '" . $info[3] . "', '" . $info[2] . "', '" . $info[5] . "', '" . $info[3] . "')");
To
$this -> bot -> db -> query("INSERT INTO tower_result (time, win_guild, win_side, lose_guild, lose_side) VALUES ('" . time() . "', '" . $info[3] . "', '" . $info[2] . "', '" . $info[5] . "', '" . $info[4] . "')");

Here is how it did look:
May 22, 2006, 12:36 GMT
Winner: Neutralizers (Neutral)
Looser: New Order  (Neutralizers)
And now:
May 22, 2006, 15:06 GMT
Winner: Orbitek (Omni)
Looser: ~~ Athalantes ~~  (Clan)

Not sure if its just my sql install that hates those split lines or what, but that seemed to pretty much fix it.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Bot crashes with !city or !cloak
« Reply #14 on: May 22, 2006, 06:36:40 pm »
Copy and Paste is your best friend :)

Split SQL lines shouldnt really be an issue unless they are split in bad places. But the stock files that are shipped with BeBot should not have any splitting issues like that.
As for the Victory logging, i could have sworn i already fixed that, but it seems it never made it into SVN. Thanx for pointing it out.
BeBot Founder and Fixer Kingpin

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 220
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal