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: 32bit character int fix for aochat.  (Read 15184 times)

0 Members and 1 Guest are viewing this topic.

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
32bit character int fix for aochat.
« on: October 26, 2006, 10:49:49 pm »
Thought i'd try my luck at this one. Downloaded bebot 2.9 and coded/tested a few hours ago. So I have only tested !is and !member (which does not work due to FC also having integer probs).
Note a: Problems might occur depending on your MySQL version and setup. (Strict mode)
Note b: All Character id's are now passed as strings, so if you like to define variables in (ie: $id = (int)$this...) your scripts it will have unintended results upon meeting an id > 2^32

Another thread, with the same theme already exists. This is very different code tho and i did not want to step on the other posters toes.

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #1 on: October 26, 2006, 11:03:21 pm »
ohh and btw, please post if it works or not :)

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #2 on: October 27, 2006, 08:10:11 am »
Solved the problem with new users :-)

Tower attacks get parsed somewhat strangely now tho:

[2006-10-27 05:23:02]   [GROUP] [MSG]   [All Towers] -1: ~&!!!&r!5b/RR!!!8S!!!!"
s"The Society for Rollerrat Crueltys?JeekR!!!8S!!!!"sĀ¶Ancarim Iron LegionsAvalon
i!!!Asi!!!IC~

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: 32bit character int fix for aochat.
« Reply #3 on: October 27, 2006, 01:24:07 pm »
think bebot had a modded version that parsed them.
the output you gave is an unparsed message, that's the original format the bot receives those messages in.
maybe this new version didn't include the same modifications bebot's one had?

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #4 on: October 27, 2006, 01:38:37 pm »
I just downloaded the 2.9 version and slapped this together from it's AOChat.php, for the tower message to be parsed as such the username must be "0" the towermsg posted by jjones is from "-1" so it won't get parsed.

edit: Fixed version posted further down.
« Last Edit: October 27, 2006, 02:35:25 pm by Nesi »

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #5 on: October 27, 2006, 02:06:22 pm »
Hmm, I don't understand how this change of number can happen?  What should cause that?

-jj-

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #6 on: October 27, 2006, 02:34:36 pm »
Ah, a small problem occured in get_uname thats called on incomming group messages - it evaluated the $user "0" as a numeric and then tried to get the associated username, instead it should just return "0" as the uname, which it is.
Should be fixed now.

Edit: New version on page 2
« Last Edit: November 15, 2006, 09:24:33 am by Nesi »

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #7 on: October 27, 2006, 07:06:48 pm »
Works fine so far :-)

Thanks again!

-jj-

Offline Lyledesol

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #8 on: October 28, 2006, 08:11:44 am »
I'm getting an SQL error on INSERT INTO members, with the new toons;

Out of range value adjusted for column 'id' at row 1

id = INTEGER in the table.. should I modify it?

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #9 on: October 28, 2006, 01:00:53 pm »
Try changing the id  int -> bigint, it has builtin string -> integer conversion so that should do the trick.

edit: On second thought the BigInt will prolly break equals comparison  between id's because it will be converted to float type when fetched by php, so varchar(11) might be better, since it will return a string.
« Last Edit: October 28, 2006, 05:49:11 pm by Nesi »

Offline Lyledesol

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #10 on: October 29, 2006, 04:36:06 am »
I think I've fixed it by changing the ID column in table Members to Unsigned Integer..  seems to be working fine atm :)

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: 32bit character int fix for aochat.
« Reply #11 on: October 29, 2006, 11:25:17 pm »
I'll have a look at this asap.
BeBot Founder and Fixer Kingpin

Offline Dabaron

  • BeBot Apprentice
  • ***
  • Posts: 163
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #12 on: October 30, 2006, 09:01:42 am »
More than likely the real issue here is that some people are ending up with negative character id's now in funky lengths and seems to be unpredictable from what I've seen.  Should be easily fixable with just a change of type on the table as noted above.
« Last Edit: October 30, 2006, 09:09:18 am by Dabaron »

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #13 on: October 30, 2006, 05:53:00 pm »
As long as there are only loose id comparisons , changing the id column to unsigned integer will be ok.
Im not very familiar with the current bebot tho, so i don't know if any methods use strict comparisons on id's.

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: 32bit character int fix for aochat.
« Reply #14 on: October 30, 2006, 06:03:37 pm »
More than likely the real issue here is that some people are ending up with negative character id's now in funky lengths and seems to be unpredictable from what I've seen.  Should be easily fixable with just a change of type on the table as noted above.

The bot ends up with negative id's because the new players have id's higher than 32bits signed, which is the only integer type available in php, this will then overflow into the negative.
This is 100% predictable behavior and can be reversed, only you can't use floats, php's other numeric type, as array keys since php will round and convert that to an integer. The only type left then are strings...
« Last Edit: October 30, 2006, 06:07:06 pm by Nesi »

 

* 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: 103
  • 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