BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: Dice on April 26, 2006, 05:48:08 pm
-
I set up a v0.2.3 BeBot for my org as a raidbot on a win98 machine in my basement that also hosts the orgs IGN guildbot.
The BeBot runs perfeclty and does its job, but everytime it is disconnected from the chatserver its not reconnecting itself. I tried to figure it out for some time now, but cannot seem to find a solution.
The bot didn't crash, it was just disconnected. IGN just reconnects... and BeBot stays offline.
When I walk down to the bot machine and look at the console, it's spamming:
Warning: socket_select(): unable to select [317]: in C:\Bebot\AOChat.php on line 234
Warning: socket_select(): supplied argument is not a valid Socket resource in C:\Bebot\AOChat.php on line 234
in a endless loop. I have to CTRL-C out of it and manually restart it. Then it works fine again.
main.php
while(true)
{
if ($aoc -> wait_for_packet() == "disconnected")
$bot -> reconnect();
$bot -> cron();
}
I'm not sure, but I think this might be where the problem is hidden... Line 234 in AOChat.php is inside the wait_for_packet() function.
I use AOChat.php $Id: AOChat.php,v 1.19 2005/11/29 23:22:46 os Exp $
Any idea what is causing this? Since noone else posted about this problem (or at least I didn't find anything about it) I guess it's a problem unique to my setup... help please.
-
It just happened again. This time I was online with the game client too. I got the login greeting message you get when you log into the game, a moment later IGN send me the news again, like it does when you log on... and the raidbot went offline and stayed offline.
It was spamming the exact same warnings again.
I love the BeBot as a raidbot, because it's not bloated with useless features like IGN... but when I cannot make it available for the org 24/7 it's rendered virtually useless. :(
I'm wondering now if it's possible to setup PHP in a way that it stops executing the current script when a warning is issued? When the bot would "crash" instead of doing this warning message loop I could make it restart automagically.
Of course that wouldn't be a perfect solution, if a raid would be in progress everybody would have to rejoin the bot... but it's better than the bot being unavailable for hours... any ideas? Please?
-
I hope your not using AOChat.php 1.19 with Bebot 0.2.3 That version of the bot wasn't written to support the newest AOChat. For 1.19 of AOChat you'd want at least a 0.3.2 or higher version.
BTW, that error your getting is what happens when the Bot looses contact with the Internet. Also AOChat will never get a 'disconnected' packet if it can't see the chat server. Keep in mind Bebot is still in a Beta stage and event handlers for some things have yet to be written ... like what to do when it gets disconnected from the Net.
I've had that same error occur a few times that you report here. Each and everytime is was because my DSL router reset and wouldn't re-connect to the far end router without manually resetting my DSL router. Only had a chat server disconnect once and true to form the bot reconnected. Thats just my case however. Your case... could be anything that interupts the net connection to the machine long enough to time the bots connection out. As stated there's no code in the bot to handle a net connection drop like that so it spams the error from AOC. IGN on the other hand has error handling that will keep retrying to connect after a given amount of time. Maybe Khalem or one of the others around here that work on Bebot(inlc myself) will look into that for the next version (0.4.x series).
Oh and one last thing. Win98??? Are you crazy? Thats not even a server environment. I highly recommend at least WinNT 4.0 if you can still get a copy. I use Win2K myself. Or you could go with one of the many Linux flavors out there. I wouldn't be surprised if it's the TCP/IP Stack buffers overflowing in Win98 that keep resetting and killing the bot on you.
-
Aaaah. That explains alot. So it's just not implemented ie working as intended ;D In that case I'll have to write my own handler to deal with a connection timeout. Thanks a ton.
-
For now I just changed the main loop in main.php to
while(true)
{
$result = $aoc -> wait_for_packet();
if (($result == "disconnected") || ($result === false))
$bot -> reconnect();
$bot -> cron();
}
This will prevent the endless warning message loop and just make the bot reconnect by shuting down and then being restarted by start.php.
Not the best fix, but makes sure the bot is always available.