Walt-Her Report post Posted September 20, 2008 Hi, got a little problem with tanglebones, this must apply to all bots that uses the BlackThorne botcode. if a player uses a name that belonged to another char before and want to trade he gets an oops bot thread exited, and logges of. eg. Char get sold and a rename, to Player. A new player calls his toon Char but cant trade anymore cos the bot will disappear on the tradewindow. I know some ppl have a fix but somehow they don't want to provide it (keceus does have the fix but after a new botowner has asked for it he still got no responce) Does anybody know what to look for and how to avoid that trigger? thanks ps. if you want to check the code i will upload a fresh copy. Share this post Link to post Share on other sites
LabRat Report post Posted September 20, 2008 Could you try this in English please? Are you saying the bot crashes when it sees a namechanged player? How about a player that just had a looks change? If you explain exactly what happens I will look into it (please provide the code and the requirements for getting the bot compiled and operational) Share this post Link to post Share on other sites
LeFallen Report post Posted October 29, 2008 (edited) It would seem that the server either stores the name length as a value and doesn't reset it, or doesn't clear the old data out and uses fixed length. So if a char was 'SUPER_WINGMAN' then it has a length of 13. This is stored as 'SUPER_WINGMANx' where 'x' is a NULL character (character 0). Then they rename to 'SLACKER' but length is kept at 13 (or again, in the case of fixed length, doesn't clear it). So 'SLACKER' here is actually: 'SLACKERxNGMAN' where 'x' is actually a NULL character. The client doesn't display this as it most likely uses standard string handling which terminates with the NULL. But because there's more data following the NULL, I assume Python is keeping it all as the name. Really the server should probably be truncating the data but as it does not, you have to do it client side. Split the data at the NULL ('\0') and take the front half. You can then deal with it correctly. Hope that's clear - if you need more help, just ask. Edited October 29, 2008 by Le Fallen Share this post Link to post Share on other sites
robotbob Report post Posted October 29, 2008 (edited) Then they rename to 'SLACKER' but length is kept at 13 (or again, in the case of fixed length, doesn't clear it). So 'SLACKER' here is actually: 'SLACKERxNGMAN' where 'x' is actually a NULL character. The client doesn't display this as it most likely uses standard string handling which terminates with the NULL. But because there's more data following the NULL, I assume Python is keeping it all as the name. Really the server should probably be truncating the data but as it does not, you have to do it client side. Split the data at the NULL ('\0') and take the front half. You can then deal with it correctly. What? The server is not sending SLACKERxNGMAN ,that would be the result of not clearing your OWN buffer. Edit: Are we assuming that renames create SLACKER[null]NGMAN in the players char file, of whatever format its on the server? Myself, in the 3 different langauges bots I've created, kill and trades, never received newplayername[null]partoftheoldname Can you give an example? Edited October 29, 2008 by robotbob Share this post Link to post Share on other sites
Ringil_Oddsocks Report post Posted October 29, 2008 The problem appears to be a little different to this. Both bots 'Tanglebones' and 'Herb' are run using the same code that was originally written by BlackThorne but has been modified in various forks by a number of people. Here is the situation if I attempt to trade with either Tanglebones or Herb they immediately dis-connect and re-connect meaning I can never trade with them. Herb is my bot so this causes a problem for me. Originally my ingame name was Keorn_Asata which I changed using Learners services to Ringil_Oddsocks and then later to Cthulhu. I then gave this char away to someone else who again using Learners services changed the name at least 2 more times. I started a new char and decided to use my old ingame name of Ringil_Oddsocks. So my current char is not the original owner of the name Ringil_Oddsocks, this appears to be the only difference that could possibly explain why everyone else can trade with Tanglebones and Herb without a problem but every time I try to trade the log off briefly. I don't know if this is a better explaination but if anyone wants to speak to me ingame about it feel free, and if anyone has any experience or ideas on how to correct it I would be most grateful. Share this post Link to post Share on other sites
robotbob Report post Posted October 29, 2008 That is bizarre since TRADE_WITH uses a number, an actor id. When you receive the add enhanced actor stuff, you get [colour byte][playername][space][colour byte][guild short name][null] and [actor id] in the inbound data. I, and what I've seen of the client and others, just save this actor data in a linked list. Its created when the player arrives and its deleted when the server sends (Remove Actor). So I cannot see how and past names could have any bearing on it. UNLESS it for some reason is saving this actor data in a file\database? The disconnect, is probably the server reacting to a bad trade_with. If you get anything wrong in the size, order, etc. the server just disconnects the client. Do you have a link to this source, so someone can identify the bug? Share this post Link to post Share on other sites
Learner Report post Posted October 29, 2008 The problem appears to be a little different to this. Both bots 'Tanglebones' and 'Herb' are run using the same code that was originally written by BlackThorne but has been modified in various forks by a number of people. Here is the situation if I attempt to trade with either Tanglebones or Herb they immediately dis-connect and re-connect meaning I can never trade with them. Herb is my bot so this causes a problem for me. Originally my ingame name was Keorn_Asata which I changed using Learners services to Ringil_Oddsocks and then later to Cthulhu. I then gave this char away to someone else who again using Learners services changed the name at least 2 more times. I started a new char and decided to use my old ingame name of Ringil_Oddsocks. So my current char is not the original owner of the name Ringil_Oddsocks, this appears to be the only difference that could possibly explain why everyone else can trade with Tanglebones and Herb without a problem but every time I try to trade the log off briefly. I don't know if this is a better explaination but if anyone wants to speak to me ingame about it feel free, and if anyone has any experience or ideas on how to correct it I would be most grateful. The logs show that Herb & Tanglebones have been sending PM's that are too long. Sounds like the bot code isn't handling long names + a long line properly. The server will disconnect you if you exceed the limit allowed to the official client and log the abuse of the server. Share this post Link to post Share on other sites
Walt-Her Report post Posted October 29, 2008 http://www.xs4all.nl/~stolkjca/tar-gz/EL-T...-17-4-08.tar.gz not the latest version but thisone behaves the same Share this post Link to post Share on other sites
LabRat Report post Posted October 29, 2008 (edited) file bot.py def send_pm(actor, message): global s log.write(message.strip()) pm_message = "%s %s" % (actor, message) if len(pm_message)>159: pm_message = pm_message[0:158] #trim the message if longer than 159 bytes packet.packet(SEND_PM, pm_message).send(s) This may or may not work, I am not a python programmer but it seems loosely based on c/c# Edited October 29, 2008 by LabRat Share this post Link to post Share on other sites
2coolfool Report post Posted October 31, 2008 def send_pm(actor, message): global s log.write(message.strip()) pm_message = "%s %s" % (actor, message) packet.packet(SEND_PM, pm_message[:158]).send(s) slightly faster than posted above. Share this post Link to post Share on other sites
LabRat Report post Posted October 31, 2008 As I stated, I am not a python programmer but one thing pops out at me for that code: What happens if the string is less that 160 characters in length? does it get padded by [:158], cause a crash due to accessing past the end of the string or left as it was (ie if it was 64 chars before it will be 64 chars after)? Share this post Link to post Share on other sites
Walt-Her Report post Posted October 31, 2008 well call me dumb if you like, but i dont understand how these bots can give too long pm's. But most important is it works Thanks all for thinking about it. Share this post Link to post Share on other sites
Vegar Report post Posted October 31, 2008 As I stated, I am not a python programmer but one thing pops out at me for that code: What happens if the string is less that 160 characters in length? does it get padded by [:158], cause a crash due to accessing past the end of the string or left as it was (ie if it was 64 chars before it will be 64 chars after)? The latter. Share this post Link to post Share on other sites
LeFallen Report post Posted December 9, 2008 (edited) What? The server is not sending SLACKERxNGMAN ,that would be the result of not clearing your OWN buffer. Edit: Are we assuming that renames create SLACKER[null]NGMAN in the players char file, of whatever format its on the server? Myself, in the 3 different langauges bots I've created, kill and trades, never received newplayername[null]partoftheoldname Can you give an example? Sure. This only occurs with certain players however so it's sometimes difficult to track. Ironically you are one of them In a ~40 day period, of the 1503 unique player/guild pairs that went through EVTR, 76 of them had names like this. A normal ADD_NEW_ENHANCED_ACTOR from the server contains various data including the name and guild tag (where applicable) as well as the size of the message (as with all msgs in EL). Examples are as follows. Note that I don't necessarily know these people - this is just the data from the server: Player: Viorica OFFSET:000 - 051 (ADD_NEW_ENHANCED_ACTOR) OFFSET:001 - 037 000 (LENGTH = 37) OFFSET:003 - * 28 bytes of char appearence data * OFFSET:031 - 'Viorica' OFFSET:038 - 000 (Null terminator perhaps) This brings us to 39 bytes in total (LENGTH + 2 as per all EL msgs) Player: ThunderCloud wWw (as in 'ThunderCloud' in guild 'wWw') OFFSET:000 - 051 (ADD_NEW_ENHANCED_ACTOR) OFFSET:001 - 049 000 (LENGTH = 49) OFFSET:003 - * 28 bytes of char appearence data * OFFSET:031 - 'ThunderCloud' OFFSET:043 - 032 (Space) OFFSET:044 - 131 (Colour - Light Blue) OFFSET:045 - 'wWw' OFFSET:048 - 000 (Null terminator perhaps) OFFSET:049 - 051 (the character '3') OFFSET:050 - 067 (the character 'C') This brings us to 51 bytes in total (LENGTH + 2 as per all EL msgs) Player: ThunderCloud (as in 'ThunderCloud' NOT in any guild) OFFSET:000 - 051 (ADD_NEW_ENHANCED_ACTOR) OFFSET:001 - 044 000 (LENGTH = 44) OFFSET:003 - * 28 bytes of char appearence data * OFFSET:031 - 'ThunderCloud' OFFSET:043 - 000 (Null terminator perhaps) OFFSET:044 - 051 (the character '3') OFFSET:045 - 067 (the character 'C') This brings us to 46 bytes in total (LENGTH + 2 as per all EL msgs) BlackThorne's bot code does something like splitting the incoming data at the space if there is one, and using the first part for the name, the second for the guild. In the event there is no space, it just takes it all as the name. This of course makes poor ThunderCloud's name "ThunderCloud[NULL]3C" which makes him unrecognised by any bot using this code (or ANY code that listens to the server's length variable and uses it to determine the data length). This data varies in length (1 - 2) and value, including 51, 67 and 204. Why don't more people notice this then? Because it doesn't happen if they are in a guild (the [NULL]3C is in the GUILD data then, not the name data) and probably also because if you were to use C string functions they will hit the NULL and take that as string termination. In the example above, the server should send 2 less bytes of data and have LENGTH -= 2 as well. The other possibility is that this represents some other piece of information but it is then strange that it's only some users. Try it out with yourself - as I say you are one of the lucky few (You have just 1 byte: 51). Either way, the server does send this extra data so we need to instead look to the [NULL] and ignore the length (for the most part). After thinking about it it's probably more likely it's a new or mod related feature and not the server not storing/dealing with it's data properly but from the bot point of view the result at this end is the same. EDIT: Formatting Edited December 9, 2008 by Le Fallen Share this post Link to post Share on other sites