LazerKitty Report post Posted November 15, 2011 EL-bot dotnet homepage Hello everyone, Has anyone used this code linked above before? I'm having trouble with converting it to modern EL. It's like 5 years old lol. If someone could take a look at it (just the parts which are important for a bot, not the UI or anything) and give me some advice on converting it? Particularly the protocol file and the PM interaction appeared to have trouble when I wrote a cmd center program using them. I plan to reconstruct the protocal file from the EL source one. If I understand correctly, sending a message is encoded like this: First byte: channel number Second byte: color (??) All remaining:: message How would I confirm this and how is the message encoded? Lots O questions lol. ... Anybody that helps (significantly, "RTFM" etc is not helping) can have free alerts for a month when my bot goes up. It sends sms messages on special days, can send afk/offline messages to phone, many other phone based services for EL. Brian Share this post Link to post Share on other sites
themuntdregger Report post Posted November 15, 2011 EL-bot dotnet homepage Hello everyone, Has anyone used this code linked above before? I'm having trouble with converting it to modern EL. It's like 5 years old lol. If someone could take a look at it (just the parts which are important for a bot, not the UI or anything) and give me some advice on converting it? Particularly the protocol file and the PM interaction appeared to have trouble when I wrote a cmd center program using them. I plan to reconstruct the protocal file from the EL source one. If I understand correctly, sending a message is encoded like this: First byte: channel number Second byte: color (??) All remaining:: message How would I confirm this and how is the message encoded? Lots O questions lol. ... Anybody that helps (significantly, "RTFM" etc is not helping) can have free alerts for a month when my bot goes up. It sends sms messages on special days, can send afk/offline messages to phone, many other phone based services for EL. Brian Sounds a great project. I've a simple bot structure written in php which might help. PM if you'd like a copy. Share this post Link to post Share on other sites
LazerKitty Report post Posted November 16, 2011 (edited) I've successfully now sent a PM. The error was that instead of sending the length as a short, it was sending it as a string literal encoded into bytes. New issue is that after a PM is sent the bot instantly disconnects from the server. Any idea why? Brian Edited November 16, 2011 by BiffBafflemore Share this post Link to post Share on other sites
revi Report post Posted November 17, 2011 At least 2 possibilities : either there's an error in your message format, or you are sending too many messages too fast. You might get better answers if you post relevant and current code... I for one don't want to look through all of a 5 year old program to answer a question about new code :/ Also, in order to see how the protocols work, you could just copy all messages you receive from the server to a file, and I mean the full server data as a byte stream, not just the text messages. The basic format used by the server and client is the same. To see the meaning of the protocol codes (the 1st byte of a message) have a look at 'client_serv.h' in the EL client code, this also gives you the different colour codes, and lots more. Share this post Link to post Share on other sites
LazerKitty Report post Posted November 17, 2011 At least 2 possibilities : either there's an error in your message format, or you are sending too many messages too fast. You might get better answers if you post relevant and current code... I for one don't want to look through all of a 5 year old program to answer a question about new code :/ Also, in order to see how the protocols work, you could just copy all messages you receive from the server to a file, and I mean the full server data as a byte stream, not just the text messages. The basic format used by the server and client is the same. To see the meaning of the protocol codes (the 1st byte of a message) have a look at 'client_serv.h' in the EL client code, this also gives you the different colour codes, and lots more. ^^ the above code isn't relevent I've modified it too far... I'm now writing to the main stream of the TPC connecting using a binary writer and reading from the same stream using a binary reader. I'm hand coding the various interactions based on the protocol documentary wiki. How would I determine if I'm writing too fast? I'm simply saying: bOUT.write(mybytes) bOUT.flush() where mybytes is a byte array created to the proper format for the message I'm trying to send and bOUT is a binary reader created on the tcpconnection's stream property. Brian P.S. with the help of Puntif i've essentially ruled out the possibility I'm sending an improper message. I've also send a sit down message. {[sit_down][3][0]} to stand up and the bot disses the same way. Share this post Link to post Share on other sites
revi Report post Posted November 18, 2011 (edited) Because your message is wrong: {[sit_down][3][0]} is three bytes, where it should be four bytes: {[protocol][length LSB][length MSB][parameter]}, as the length is a 16-bit (2-byte) value. You are missing the parameter ('0' or '1' in this case), so the server will take whatever comes in next (most likely a HEART_BEAT, value 14) => illegal => disconnect (or missing heart beat, as your messages are out of sync, but that also disconnects you) This page has some information. Be aware that not everything is there. Edit: according to that page, your sit-down message should have been: {[7][2][0][0]} : [7] : protocol code [2][0] : length (in order LSB,MSB): 1+datalength = 2 [0] : data (bool, so 0 or 1) and all I can suggest is: read those pages, including the coding examples. And for details/up-to-date information about the protocols used, study the client code. It's the only official documentation available (afaik) Edited November 18, 2011 by revi Share this post Link to post Share on other sites
LazerKitty Report post Posted November 18, 2011 (edited) Because your message is wrong: {[sit_down][3][0]} is three bytes, where it should be four bytes: {[protocol][length LSB][length MSB][parameter]}, as the length is a 16-bit (2-byte) value. You are missing the parameter ('0' or '1' in this case), so the server will take whatever comes in next (most likely a HEART_BEAT, value 14) => illegal => disconnect (or missing heart beat, as your messages are out of sync, but that also disconnects you) This page has some information. Be aware that not everything is there. Also you reference LSB and MSB, is this really important? I do alot of client/server stuff while programming but not quite that deep. Can I just convert a int16 datatype into a byte array using a bitconverter class? << is an edit, btw So... the length should be 4? does the total length include the two bytes of length info and the command byte? So the length value would be the length of the message data + 3? I'll post my code on sunday. Brian Edited November 18, 2011 by BiffBafflemore Share this post Link to post Share on other sites
Alberich Report post Posted November 18, 2011 So... the length should be 4? does the total length include the two bytes of length info and the command byte? So the length value would be the length of the message data + 3? Brian it's all on the page revi gave you: Message Format there is even an example for sit down and send pm Share this post Link to post Share on other sites
LazerKitty Report post Posted November 18, 2011 (edited) So... the length should be 4? does the total length include the two bytes of length info and the command byte? So the length value would be the length of the message data + 3? Brian it's all on the page revi gave you: Message Format there is even an example for sit down and send pm ---edited out--- P.S. successfully stood up! Going to figure out wth is wrong with my PM code now... still a bit confused about the lenght tag on that. Edited November 18, 2011 by BiffBafflemore Share this post Link to post Share on other sites