BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: Neo-Vortex on October 25, 2006, 11:32:04 am

Title: AOChat 1.19 Fix
Post by: Neo-Vortex on October 25, 2006, 11:32:04 am
Basicly if the charid of a user is over 2^31, AOChat refuses to see that user, this affects all AOChat based bots (perhaps others), a fix is available at http://aodevs.com/index.php/topic,49.msg244.html (http://aodevs.com/index.php/topic,49.msg244.html), it also contains a far more detailed description of the problem and how it was fixed.

Note, it seems the version of AOChat bundeled with bebot formats tower attack messages differently than the latest version on auno.org (which that patch is based off).

Code: [Select]
      if (preg_match("/^([a-zA-Z0-9]+) \((.+), (Clan|Neutral|Omni)\) attacked (.+) \((Clan|Neutral|Omni)\) in (.+) at ([0-9]+), ([0-9]+).$/i", $msg, $info))
      {
        $off_player = $info[1];
        $off_side = ucfirst(strtolower($info[3]));
        $off_guild = $info[2];
        $def_guild = $info[4];
        $def_side = ucfirst(strtolower($info[5]));
        $zone = $info[6];
        $x_coords = $info[7];
        $y_coords = $info[8];
        $attack = true;
      }

That code is what i use with that version in TowerAttack.php fine.

Also it seems that it returns false not "disconnected" for wait_for_packet(), thus that needs to be fixed in main.php or the bot wont reconnect if it gets disconnected.

Code: [Select]
while(true)
{
        if ($aoc -> wait_for_packet() == false)
                $bot -> reconnect();

        $bot -> cron();
}

Is what i use to fix this issue.

(Note, i used a slightly older version of bebot than the current 0.2.x release, so code given may have to be modified slightly in order to work, if someone is able to verify that it works fine on the latest version, that would be cool).

Edit: Added attachments for both diff and full AOChat.php for lazy people (with the small fix for invalid characters)
Title: Re: AOChat 1.19 Fix
Post by: jjones666 on October 25, 2006, 01:33:44 pm
I've never been quite been sure which version of AOChat to use, I think mine is something Xenixa distributed based on 1.17.  As I use php 4 here for org bot (bebot 0.2.x from around December last year but customised quite a bit).  I'm not sure if I should update while things work fine in case the bot breaks.  php 5 is used fine for our raidbot - which is based on bebot 0.2.9.  Several of Xenixa's fixes for guests etc stopped me updating the org bot to bebot 0.2.9, I guess I'll update when 0.3.x is finalised.

On the second issue, will this fix the bot hitting desktop instead of restarting when !restart is used?  That would be good if so :-)  That issue only came up in recent Bebot versions (again, org bot works fine on !restart, raid bot doesn't).

Cheers for letting everyone know anyway!

-jj-
Title: Re: AOChat 1.19 Fix
Post by: Neo-Vortex on October 25, 2006, 01:54:06 pm
As I use php 4 here for org bot

The patch does not work with php4, if you see the thread on aodevs there is a unified diff for the patch also, with any luck someone will port it to the 1.17 version of aochat, so keep an eye on that (unless you're feeling adventurous yourself)

On the second issue, will this fix the bot hitting desktop instead of restarting when !restart is used?  That would be good if so :-)  That issue only came up in recent Bebot versions (again, org bot works fine on !restart, raid bot doesn't).

No, that error would be within start.php somewhere - you are running start.php right :P?

Edit: That said, it might not be much of a problem now, but keep in mind if you're on Atlantean then any newly created toon from about 2-3 weeks ago onwards will be 100% invisible (see other post for more info) so it'll probobly get a tad more pressing... If you can upgrade to PHP5 it should be relatively easy to apply the fix and make the couple of required changes to make the towerattack and auto recon work properly, reguardless of bebot version used.
Title: Re: AOChat 1.19 Fix
Post by: jjones666 on October 25, 2006, 01:58:53 pm
No, that error would be within start.php somewhere - you are running start.php right :P?

Off hand, I can't check as I'm at work but everthing else works fine, so I'm sure the right file is in use (it is started from batch file) :-P

Grrr on php 5 requirement, looks like I'll have to test update to bebot 0.3 on orgbot then as I don't fancy rechanging all modules to have to change them again soon for final release :-)

Edit on your edit:  Yeah, I understand, I just need to double check what is gonna be broken by PHP5/Bebot 0.2.9 if I did that.  I know last time I tried to upgrade, it wiped my guestlist, a lot of stuff I use is based on Xenixa's modules which involved changed to bot.php etc :-)  Plus this !restart thing is major pain in the ass :-P

-jj-
Title: Re: AOChat 1.19 Fix
Post by: Neo-Vortex on October 25, 2006, 02:05:14 pm
Grrr on php 5 requirement, looks like I'll have to test update to bebot 0.3 on orgbot then as I don't fancy rechanging all modules to have to change them again soon for final release :-)

Edit on your edit:  Yeah, I understand, I just need to double check what is gonna be broken by PHP5/Bebot 0.2.9 if I did that.  I know last time I tried to upgrade, it wiped my guestlist, a lot of stuff I use is based on Xenixa's modules which involved changed to bot.php etc :-)

Odd, my upgrade from php4 to php5 went completely seamlessly (i have some pretty heavy modifications on almost everything on my bot - heck, im running 3 bots using the same install ;P, 2 guild and one raid, shared alts and whoiscache, etc etc), best bet would be to backup the db before trying if thats happened in the past... that way if things happen, just revert the backup ;)
Title: Re: AOChat 1.19 Fix
Post by: jjones666 on October 25, 2006, 02:15:50 pm
Yeah, I think the main problem was the fixes Xen did to is_member etc, I guess I'd just have to look thru some old threads to find out exactly what was changed.  The guest list and autoinvite (guests only and not spamming members), is essential for me :-)  The problem wasn't with the database, it had actually deleted the buddies from the bot's contactlist :-)

-jj-
Title: Re: AOChat 1.19 Fix
Post by: Nesi on October 26, 2006, 02:29:19 am
seems FC are having some problems with this on their website aswell - Not possible searching for the newest chars :)
Title: Re: AOChat 1.19 Fix
Post by: Neo-Vortex on October 26, 2006, 12:58:05 pm
seems FC are having some problems with this on their website aswell - Not possible searching for the newest chars :)

Completely unrelated, just the people of RK lookup hasnt updated in a little while, Gimp69 for example is lookupable on it fine (and it is affected) as it was one of the earlier ones, also Wirent wasn't at first, but i believe now is on the lookup as well, so its very unlike this has anything to do with it (especially as it seems FC's website for the people of rk lookup dosen't use php)
Title: Re: AOChat 1.19 Fix
Post by: Lyledesol on October 26, 2006, 02:01:56 pm
Tried to use the fixed 1.19 with 0.2.x and 0.3.x bots, no joy here :(

This is the ID for the AOChat.php im using... (works on php4 and 5 btw)
   * $Id: AOChat.php 78 2006-03-03 06:48:50Z shadowmaster $

Neo-Vortex's AOChat is an older version?
   * $Id: AOChat.php,v 1.19-NVX 2005/11/29 23:22:46 os Exp $


Any chance of posting individual changes so I can try and apply to mine?
Title: Re: AOChat 1.19 Fix
Post by: Nesi on October 26, 2006, 06:39:31 pm
Yeah, completely unrelated....

Error
exceptions.ValueError on Invalid integer value for charinstance in ""



They may not be using php, but they are using Integers...
Title: Re: AOChat 1.19 Fix
Post by: Vhab on October 26, 2006, 07:11:27 pm
but erm, the aochat protocol uses 32bit integers for character IDs.
they magically found a way to fit more into 4 bytes or am I completely misunderstanding the issue?
*scratches head*
Title: Re: AOChat 1.19 Fix
Post by: Nesi on October 26, 2006, 07:43:37 pm
AOChat uses unsigned long afaik, it may convert it to float but assigning a float as an array key, which aoc does, does not yeild the intended results.
Title: Re: AOChat 1.19 Fix
Post by: Neo-Vortex on October 27, 2006, 03:03:05 pm
but erm, the aochat protocol uses 32bit integers for character IDs.

AOChat uses unsigned long afaik, it may convert it to float but assigning a float as an array key, which aoc does, does not yeild the intended results.

It is 32bit intgers, yes, however AOChat does not uses unsigned longs, that's C, AOChat uses php, php uses signed intgers, it is not possible to specify if it is signed or not, http://php.net/manual/en/language.types.integer.php (http://php.net/manual/en/language.types.integer.php) explains it:

Quote
The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits signed). PHP does not support unsigned integers.

So yeah, its equivilent of a signed long ;) (which on a 32bit machine is 32bit signed, same as php, whose range is (2^31-1) to -(2^31-1), go figure)
Title: Re: AOChat 1.19 Fix
Post by: Vhab on October 27, 2006, 03:04:44 pm
nesi explained it to me.
i forgot to take in account signed/unsigned.
it wasn't int32 but uint32
Title: Re: AOChat 1.19 Fix
Post by: Nesi on October 27, 2006, 03:45:33 pm
Well the incomming and outgoing packets that AOChat handles have the id's in unsigned long. Problem comes when unpacking those in php, due to the reasons already stated.
Title: Re: AOChat 1.19 Fix
Post by: Khalem on October 30, 2006, 12:02:57 am
There is currently a few different versions of AOChat.php in use for BeBot.

One is the most current version in 0.3 (trunk) svn which is the latest official library adapted to work on php 4 but without the new queue Auno added.
0.2 uses yet a slightly different one to avoid the changes in output made by Auno's very latest version to preserve backwards compactibility of modules as much as possible.

Ontop of that there are some older versions of the library from earlier 0.2 release aswell as Xenixa's modified one.
Title: Re: AOChat 1.19 Fix
Post by: Neo-Vortex on November 01, 2006, 01:40:50 pm
It seems i made a small oversight for invalid/nonexistant characters with get_uid and get_uname causing invalid characters to be treated as valid in most bots (bebot included).

A fix has been uploaded at the same place (see origional post) on both the AODevs attachment and on my fstore link.
SimplePortal 2.3.7 © 2008-2024, SimplePortal