Lumino Report post Posted May 8, 2007 I am an experienced Python programmer, and it is my personal opinion that Python is an excellent language for writing an EL bot in. The only part I am struggling with is the binding. I'm good at learning new rules and working in bindings, but I haven't a clue as far as creating them. Is there anyone with a good experience in C and Python who knows how to create a decent binding between them for EL bots that includes trade functionality? Lum Share this post Link to post Share on other sites
LabRat Report post Posted May 8, 2007 I have very recently seen a python EL trade bot, but it is not yet public. I like it because the bot can happily run on my mobile phone (Nokia N95) I won't say who the bot code developer is but I have no doubt the individual reads these forums so maybe a reply will be forthcoming - who knows? Share this post Link to post Share on other sites
Lumino Report post Posted May 8, 2007 Ok, cool; sounds great, LabRat. My bot, by the way, is not planned to be a traditional buying/selling bot, but it does require chat and trade functions. The chat functionality is already provided through the open source bot for ALCH, I believe called Trismegetus? Or something like that. If the writer of this bot doesnt post here, could you possibly contact him/her, LabRat, and see if he/she is willing to share a binding? On the other hand, if anyone knows how to create a binding (I've heard it's pretty simple) or what files from the EL source I would need to use to do so, I'm all ears. Thanks, Lum Share this post Link to post Share on other sites
Alia Report post Posted May 8, 2007 It is really very easy. Look in file trade.c, there are some functions which process your work with trade window and messages from server (those functions are called from multiplayer.c so it is also good to look into it First put some printf's or anything like it and play with trade window to understand how that functions work. Then add hooks and bindings to python for that functions. If you don't know how to make bindings then just take examples from python docs. I wish I could say more, but trading wasn't thing that I looked in Share this post Link to post Share on other sites
dejan Report post Posted May 9, 2007 As an experienced Python programmer You should already know that there is no need for writing a binding in order to have a bot in Python. Furthermore, there is no EL client library (AFAIK), so what to bind? Bunch of object files from EL client? As a Python programmer, all You have to know is little of network programming, how to pack/unpack bytes received, and, naturaly the EL protocol. Share this post Link to post Share on other sites
nathanstenzel Report post Posted May 9, 2007 (edited) Ok, cool; sounds great, LabRat. My bot, by the way, is not planned to be a traditional buying/selling bot, but it does require chat and trade functions. The chat functionality is already provided through the open source bot for ALCH, I believe called Trismegetus? Or something like that. If the writer of this bot doesnt post here, could you possibly contact him/her, LabRat, and see if he/she is willing to share a binding? On the other hand, if anyone knows how to create a binding (I've heard it's pretty simple) or what files from the EL source I would need to use to do so, I'm all ears. Thanks, Lum I took over the Trismegitus project. I am not in ALCH anymore and neither is the original programmer (boognish). Alot of the functionality of it was added by me. I started working on trade bot code, but I have put it to the side to try to train my manufacturing skill some more. http://sourceforge.net/projects/trismegitus By the way, get the SVN copy. I have not released a file for download for a while and I have made alot of updates since then. Edited May 9, 2007 by nathanstenzel Share this post Link to post Share on other sites
Placid Report post Posted May 10, 2007 (edited) I am an experienced Python programmer, and it is my personal opinion that Python is an excellent language for writing an EL bot in. The only part I am struggling with is the binding. I'm good at learning new rules and working in bindings, but I haven't a clue as far as creating them. Is there anyone with a good experience in C and Python who knows how to create a decent binding between them for EL bots that includes trade functionality? Lum Why do you need to bind to C? Learn the protocol (see here: http://wiki.beplacid.com/EL_Protocol). If you're desperate to bind, speak to Vegar - his bot has this exact ability. [Edit, damn auto-linking] Edited May 10, 2007 by Placid Share this post Link to post Share on other sites
vytukas Report post Posted May 10, 2007 (edited) I have very recently seen a python EL trade bot, but it is not yet public. I like it because the bot can happily run on my mobile phone (Nokia N95) I won't say who the bot code developer is but I have no doubt the individual reads these forums so maybe a reply will be forthcoming - who knows? I guess Labrat is talking about my new python code. The source code is currently private, as it operates the real bot (Blondine) and I want to test it more in action. Later I will make it available under some open source licence. But if you want just to take a look at working python bot example, take a look at Trismegitus or whatever its called. I have looked at its source briefly, it's clean (MUCH cleaner than my own ) and easily understandable. Also, read the Placid's protocol wiki, and the el client source code (YES, it is necessary). Although Placid's wiki is a very good resource, be warned that Python examples at http://wiki.beplacid.com/EL_Protocol_Code_Examples are completely broken. Edit: this is a working example code to send a message to a server (taken from my bot): def send_message (message, data = ''): # Debug protocol_debug (1, message, data) length = len (data)+ 1 to_send = struct.pack('<BH', message, length)+ data try: sock.sendall (to_send) except: log ('Connection error when sending.') CONNECTED = False Edited May 10, 2007 by vytukas Share this post Link to post Share on other sites
Placid Report post Posted May 19, 2007 (edited) Also, read the Placid's protocol wiki, and the el client source code (YES, it is necessary). Although Placid's wiki is a very good resource, be warned that Python examples at http://wiki.beplacid.com/EL_Protocol_Code_Examples are completely broken. Thanks. Although you could've fixed the examples or provided your own. That's the idea of a Wiki I've never had much faith in those examples myself either, so i've decided to take them down. If you could provide some examples that you know work, i'd appreciate it. Also, i'd suggest reading http://wiki.beplacid.com/EL_Protocol, that's better written and much more descriptive of the protocol. Edited May 19, 2007 by Placid Share this post Link to post Share on other sites
trollson Report post Posted May 19, 2007 BTW: If you want to produce bindings to C/C++APIs for scripts (python, perl, ruby, ...) or Java JNI, I would seriously recommend taking a look at SWIG (www.swig.org). Share this post Link to post Share on other sites
nathanstenzel Report post Posted May 20, 2007 (edited) <CLIP> I guess Labrat is talking about my new python code. The source code is currently private, as it operates the real bot (Blondine) and I want to test it more in action. Later I will make it available under some open source licence. But if you want just to take a look at working python bot example, take a look at Trismegitus or whatever its called. I have looked at its source briefly, it's clean (MUCH cleaner than my own ) and easily understandable. <CLIP> All the bots must be open source according to the rules of the game....although I can't pinpoint the rule right now. ...rule #5 as per http://www.eternal-lands.com/forum/index.php?showtopic=14582 Thanks for the compliment on my code. I love getting compliments. It is the SVN copy you are looking at, right? I hope so. that is the most up-to-date. Edited May 20, 2007 by nathanstenzel Share this post Link to post Share on other sites
ttlanhil Report post Posted May 20, 2007 All the bots must be open source according to the rules of the game...yes, but you wouldn't suggest that being open source means we have to show you the source if we don't give you the binary, would you? open source means (among other things) that you get the source under some license if you (legally) get the binary Share this post Link to post Share on other sites
Lumino Report post Posted May 21, 2007 Thanks everyone for the great stuff you've posted. I would have to say the most helpful have been from Placid and probably nathanstenzel for his code (albeit without trade functionality), as well as LabRat's mysterious code-writer, who did PM me and let me peruse This task seems quite a bit easier now and from Placid's page a lot of the way EL works is clearer. Thank you very much Placid! Also, if I get stuff to work, perhaps I can write new Python examples for the other wiki page. Hopefully I will. Lum Share this post Link to post Share on other sites
Placid Report post Posted May 21, 2007 Thanks everyone for the great stuff you've posted. I would have to say the most helpful have been from Placid and probably nathanstenzel for his code (albeit without trade functionality), as well as LabRat's mysterious code-writer, who did PM me and let me peruse This task seems quite a bit easier now and from Placid's page a lot of the way EL works is clearer. Thank you very much Placid! Also, if I get stuff to work, perhaps I can write new Python examples for the other wiki page. Hopefully I will. Lum Glad the Wiki helped! I must stress that it wasn't just me who wrote the article (though I did write large parts of it). Please see the acknowledgements section for a full list. If you could provide some Python examples, that'd be great. Python's becoming ever more popular now. Share this post Link to post Share on other sites
vytukas Report post Posted May 21, 2007 I added some examples to the wiki Share this post Link to post Share on other sites
Placid Report post Posted May 22, 2007 I added some examples to the wiki Yup, I noticed. Thanks a lot, they're much more readable now Share this post Link to post Share on other sites
Lumino Report post Posted August 8, 2007 Well, back to this thread again...obviously my bot coding has gone really slow. I haven't had much time until now, and my Python experience had not previously taken me towards network programming so I had some things to work out first. Anyway, the EL Protocol Article seems to lack information about receiving data from the server (like PMs, trade requests, etc..) Maybe I'm just not reading it right. Can anyone help? (Sorry if these are newbish questions, one of my first networking projects and first working with a message system at this level of sophistication) Thanks Lum Share this post Link to post Share on other sites
jamincollins Report post Posted August 8, 2007 There are a number of bot implementations in python. If you don't mind GPL'd code you are welcome to look at my bot code as a reference: http://el.asgardsrealm.net/dokuwiki/doku.p...d=el:bot:python Share this post Link to post Share on other sites
Placid Report post Posted August 9, 2007 Well, back to this thread again...obviously my bot coding has gone really slow. I haven't had much time until now, and my Python experience had not previously taken me towards network programming so I had some things to work out first. Anyway, the EL Protocol Article seems to lack information about receiving data from the server (like PMs, trade requests, etc..) Maybe I'm just not reading it right. Can anyone help? (Sorry if these are newbish questions, one of my first networking projects and first working with a message system at this level of sophistication) Thanks Lum What protocol issues are you having? Share this post Link to post Share on other sites
Lumino Report post Posted August 9, 2007 Well, the server must send messages back at you (through the socket if were talking about python) about things like PMs and basically all other information about the world around you...so how do you interpret these messages? Thanks jamincollins, already have your code, looking at it has helped a bit Share this post Link to post Share on other sites
Placid Report post Posted August 9, 2007 (edited) Well, read the protocol description. You need to parse the particular packets, making sure you take into account the LENGTH byte of each message (it's a stream, split into individual messages). Each message from the server has a defined TYPE, LENGTH and DATA section that you need to parse to be able to act upon it. Seriously, read http://wiki.beplacid.com/Eternal_Lands_Network_Protocol. It explains this. Edited August 9, 2007 by Placid Share this post Link to post Share on other sites
nathanstenzel Report post Posted August 11, 2007 Well, you have two bot projects to work from, that I know of. http://sourceforge.net/projects/trismegitus http://el.asgardsrealm.net/dokuwiki/doku.p...d=el:bot:python You also have the EL protocol page. http://wiki.beplacid.com/EL_Protocol#Message_Format There is also this page, but it does not seem to be a complete bot. http://trac.grove.org.ru/pytbot/browser If you can understand C, C++, Perl, etc, there are a number of other bot projects to gather understanding off as well. Personally, my weakness in bot programming is the darned trade code. I have a really good secretary though. Share this post Link to post Share on other sites