DarthCarter Report post Posted July 6, 2006 Hi, The first version of my perl bot framework is available at http://search.cpan.org/~franc/ (the cpan mirror might take a couple of hours) You should consider it 'Proof of Concept' quality - please give me feeback. There are 3 classes, Client,Bot and Map. Client is reasonably complete Bot is bits that didn't fit in to Client, Map is the EL map ;-) and is only partly working There are two example bots, Trader.pl - a trade bot . . . Hunter.pl - a rabbit/rat hunting bot, obviously to be run on the test server only I'd like to thank the authors of redknight and phpelbot_amilia for making their code public. I'd also like to thank/congradulate Radu and others for the game and client code. I found the client/sever interaction well thought out. I got some interesting insights in to a large scale distributed game. Nice job guys. Now back to my much neglected character cheers Share this post Link to post Share on other sites
DarthCarter Report post Posted September 2, 2006 Hi, I just released the next version of my by code to http://search.cpan.org/~franc/ Changes are:- non-buffered IO - doh, stupid me pathfinding rewritten in C inter-map path finding beginnings of storage handling Hi, The first version of my perl bot framework is available at http://search.cpan.org/~franc/ (the cpan mirror might take a couple of hours) You should consider it 'Proof of Concept' quality - please give me feeback. There are 3 classes, Client,Bot and Map. Client is reasonably complete Bot is bits that didn't fit in to Client, Map is the EL map ;-) and is only partly working There are two example bots, Trader.pl - a trade bot . . . Hunter.pl - a rabbit/rat hunting bot, obviously to be run on the test server only I'd like to thank the authors of redknight and phpelbot_amilia for making their code public. I'd also like to thank/congradulate Radu and others for the game and client code. I found the client/sever interaction well thought out. I got some interesting insights in to a large scale distributed game. Nice job guys. Now back to my much neglected character cheers Share this post Link to post Share on other sites
the_antiroot Report post Posted September 3, 2006 Very nice work. Thus far ive only had a brief play with it, but the examples plain damn work, and the code is obviously very well planned. I certainly will play with this a bit, Ive missed having an excuse to play with perl Share this post Link to post Share on other sites
DarthCarter Report post Posted September 3, 2006 Very nice work. Thus far ive only had a brief play with it, but the examples plain damn work, and the code is obviously very well planned. I certainly will play with this a bit, Ive missed having an excuse to play with perl Thanks for the compliments ;-) A few horrible things have been found by a friendly test user (thanks LadyPetra), * you need to ulimit -s 32768 or pathfinding crashes * If you run two bots frm the same directory they can mess up the knowledge file Share this post Link to post Share on other sites
the_antiroot Report post Posted September 3, 2006 (edited) * you need to ulimit -s 32768 or pathfinding crashes Well there goes my next question, ty again. (I like this arrangement, you post the solutions before I ask the questions ) As time permits I may try to rewrite the guardbots I run using this framework, It also lends itself to what I was going to do as a php project, just have to cgi'ify and that will play well methinks (not a real bot so dont have to worry about page timeouts killing the bot). Edited September 3, 2006 by the_antiroot Share this post Link to post Share on other sites
DarthCarter Report post Posted September 4, 2006 New version, no real changes just fixed some stupid issues caused by rushing the packaging process - version 0.04 should appear on cpan in the next couple of hours Also, if anyone know of an efficient way to flood fill an area based on height map differences rather than border colours let me know ;-) Hi, The first version of my perl bot framework is available at http://search.cpan.org/~franc/ (the cpan mirror might take a couple of hours) You should consider it 'Proof of Concept' quality - please give me feeback. There are 3 classes, Client,Bot and Map. Client is reasonably complete Bot is bits that didn't fit in to Client, Map is the EL map ;-) and is only partly working There are two example bots, Trader.pl - a trade bot . . . Hunter.pl - a rabbit/rat hunting bot, obviously to be run on the test server only I'd like to thank the authors of redknight and phpelbot_amilia for making their code public. I'd also like to thank/congradulate Radu and others for the game and client code. I found the client/sever interaction well thought out. I got some interesting insights in to a large scale distributed game. Nice job guys. Now back to my much neglected character cheers Share this post Link to post Share on other sites
asc66 Report post Posted September 8, 2006 can anyone put this in c++ please thx... Share this post Link to post Share on other sites
DarthCarter Report post Posted September 9, 2006 can anyone put this in c++ please thx... Putting this in to C++ would be a fairly large job (and I haven't written any C++ in 10 years) Share this post Link to post Share on other sites
jooschi Report post Posted September 16, 2006 (edited) a very nice framework just wsc is too big for the pathfinding system found a little bug in Client.pm sub equipItem: s/1 \.\. 35/0 .. 35/ greetings jooschi Edited September 16, 2006 by jooschi Share this post Link to post Share on other sites
DarthCarter Report post Posted September 16, 2006 Thanks for the bug-find ;-) What's the problem with pathfinding in WSC ? it 'should work' ;-) cheers a very nice framework just wsc is too big for the pathfinding system found a little bug in Client.pm sub equipItem: s/1 \.\. 35/0 .. 35/ greetings jooschi Share this post Link to post Share on other sites
jooschi Report post Posted September 16, 2006 i always get seg faults, when the character is wsc Share this post Link to post Share on other sites
DarthCarter Report post Posted September 17, 2006 There is one problem that I know about with blowing the stack size limit - but I thought it happened on most maps. Anyway, try uping the stack size with ulimit -s 32768 Let me know if this doesn't work and I'll try to replicate and fix the problem cheers i always get seg faults, when the character is wsc Share this post Link to post Share on other sites
jooschi Report post Posted September 20, 2006 i allready had the stacksize @ 32M, but at wsc => segfault here my corrected HERE_YOUR_STATS - Handler (had the problem of very crazy exp-values): sub HERE_YOUR_STATS { my $self = shift; my ($type,$len,$data) = @_; my @v = unpack('v[49]V[16]v[4]V[2]v[2]V[2]',$data); $self->{'stats'} = { 'phy' => [$v[0],$v[1]], 'coo' => [$v[2],$v[3]], 'rea' => [$v[4],$v[5]], 'wil' => [$v[6],$v[7]], 'ins' => [$v[8],$v[9]], 'phy' => [$v[10],$v[11]], }; $self->{'nexus'} = { 'human' => [$v[12],$v[13]], 'animal' => [$v[14],$v[15]], 'vegetal' => [$v[16],$v[17]], 'inorganic' => [$v[18],$v[19]], 'artificial' => [$v[20],$v[21]], 'magic' => [$v[22],$v[23]], }; $self->{'skills'} = { 'man' => [$v[24],$v[25]], 'har' => [$v[26],$v[27]], 'alc' => [$v[28],$v[29]], 'oa' => [$v[30],$v[31]], 'att' => [$v[32],$v[33]], 'def' => [$v[34],$v[35]], 'mag' => [$v[36],$v[37]], 'pot' => [$v[38],$v[39]], 'sum' => [$v[67],$v[68]], 'cra' => [$v[71],$v[72]], }; $self->{'stats'} = { 'carry' => [$v[40],$v[41]], 'mp' => [$v[42],$v[43]], 'ep' => [$v[44],$v[45]], 'food' => [$v[46],45], }; $self->{'research'} = { 'completed' => $v[47], 'researching' => $v[65], 'total' => $v[66], }; $self->{'experience'} = { 'man' => [$v[49],$v[50]], 'har' => [$v[51],$v[52]], 'alc' => [$v[53],$v[54]], 'oa' => [$v[55],$v[56]], 'att' => [$v[57],$v[58]], 'def' => [$v[59],$v[60]], 'mag' => [$v[61],$v[62]], 'pot' => [$v[63],$v[64]], 'sum' => [$v[69],$v[70]], 'cra' => [$v[73],$v[74]], }; btw: http://www.eternal-lands.com/forum/index.p...mp;#entry303713 Share this post Link to post Share on other sites
DarthCarter Report post Posted September 23, 2006 Bummer, looks like I need to fix this more urgently. I'll look in to it once the current bot payment discussion is fully resolved. Thanks for the patch - the stats were pretty stuffed ;-) i allready had the stacksize @ 32M, but at wsc => segfault here my corrected HERE_YOUR_STATS - Handler (had the problem of very crazy exp-values): sub HERE_YOUR_STATS { my $self = shift; my ($type,$len,$data) = @_; my @v = unpack('v[49]V[16]v[4]V[2]v[2]V[2]',$data); $self->{'stats'} = { 'phy' => [$v[0],$v[1]], 'coo' => [$v[2],$v[3]], 'rea' => [$v[4],$v[5]], 'wil' => [$v[6],$v[7]], 'ins' => [$v[8],$v[9]], 'phy' => [$v[10],$v[11]], }; $self->{'nexus'} = { 'human' => [$v[12],$v[13]], 'animal' => [$v[14],$v[15]], 'vegetal' => [$v[16],$v[17]], 'inorganic' => [$v[18],$v[19]], 'artificial' => [$v[20],$v[21]], 'magic' => [$v[22],$v[23]], }; $self->{'skills'} = { 'man' => [$v[24],$v[25]], 'har' => [$v[26],$v[27]], 'alc' => [$v[28],$v[29]], 'oa' => [$v[30],$v[31]], 'att' => [$v[32],$v[33]], 'def' => [$v[34],$v[35]], 'mag' => [$v[36],$v[37]], 'pot' => [$v[38],$v[39]], 'sum' => [$v[67],$v[68]], 'cra' => [$v[71],$v[72]], }; $self->{'stats'} = { 'carry' => [$v[40],$v[41]], 'mp' => [$v[42],$v[43]], 'ep' => [$v[44],$v[45]], 'food' => [$v[46],45], }; $self->{'research'} = { 'completed' => $v[47], 'researching' => $v[65], 'total' => $v[66], }; $self->{'experience'} = { 'man' => [$v[49],$v[50]], 'har' => [$v[51],$v[52]], 'alc' => [$v[53],$v[54]], 'oa' => [$v[55],$v[56]], 'att' => [$v[57],$v[58]], 'def' => [$v[59],$v[60]], 'mag' => [$v[61],$v[62]], 'pot' => [$v[63],$v[64]], 'sum' => [$v[69],$v[70]], 'cra' => [$v[73],$v[74]], }; btw: http://www.eternal-lands.com/forum/index.p...mp;#entry303713 Share this post Link to post Share on other sites
timbol Report post Posted November 11, 2006 (edited) I started use this bot and I found a bug: [2006-10-11 01:15] Trade request from 'printex' Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. and bot says to Printex sth like this: sorry, i can't get your ID, this should not be happen... Plase notify the owner of this bot One more bug: bad packet type in Dispatch at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Client.pm line 2043 Games::EternalLands::Client::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{4}\x{0}') called at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 1225 Games::EternalLands::Bot::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{4}\x{0}') called at ./Trader.pl line 36 then bot exits but after relogin: bad packet type in Dispatch at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Client.pm line 2043 Games::EternalLands::Client::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{86}\x{8}') called at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 1225 Games::EternalLands::Bot::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{86}\x{8}') called at ./Trader.pl line 36 and one more relogin and everything go back to normal Edited November 11, 2006 by Timbol Share this post Link to post Share on other sites
DarthCarter Report post Posted November 12, 2006 Yes, I'm afraid it's a bit buggy. At least partly because I had/have an incomplete/inaccurate understanding of the protocol ;-( Work is sucking up a lot of my time at the moment so it will be several weeks before I can look at these - sorry I started use this bot and I found a bug: [2006-10-11 01:15] Trade request from 'printex' Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. and bot says to Printex sth like this: sorry, i can't get your ID, this should not be happen... Plase notify the owner of this bot One more bug: bad packet type in Dispatch at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Client.pm line 2043 Games::EternalLands::Client::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{4}\x{0}') called at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 1225 Games::EternalLands::Bot::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{4}\x{0}') called at ./Trader.pl line 36 then bot exits but after relogin: bad packet type in Dispatch at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Client.pm line 2043 Games::EternalLands::Client::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{86}\x{8}') called at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 1225 Games::EternalLands::Bot::Dispatch('Games::EternalLands::Bot=HASH(0x862a6ec)', 'O', 5, '\x{1}\x{3}\x{0}\x{86}\x{8}') called at ./Trader.pl line 36 and one more relogin and everything go back to normal Share this post Link to post Share on other sites
timbol Report post Posted November 12, 2006 This error hapens only when tradeing person have guild tag I started use this bot and I found a bug: [2006-10-11 01:15] Trade request from 'printex' Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. and bot says to Printex sth like this: sorry, i can't get your ID, this should not be happen... Plase notify the owner of this bot Share this post Link to post Share on other sites
timbol Report post Posted November 14, 2006 I found bug and fix it. I replayced line 930 in Client.pm with this code: if(length($guild)==0) { $name = substr($title,$i,$j-$i); } else { $name = substr($title,$i,$j-$i-1); } This error hapens only when tradeing person have guild tag I started use this bot and I found a bug: [2006-10-11 01:15] Trade request from 'printex' Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. and bot says to Printex sth like this: sorry, i can't get your ID, this should not be happen... Plase notify the owner of this bot Share this post Link to post Share on other sites
DarthCarter Report post Posted November 15, 2006 Thanks, I'll merge it in for the next release cheers I found bug and fix it. I replayced line 930 in Client.pm with this code: if(length($guild)==0) { $name = substr($title,$i,$j-$i); } else { $name = substr($title,$i,$j-$i-1); } This error hapens only when tradeing person have guild tag I started use this bot and I found a bug: [2006-10-11 01:15] Trade request from 'printex' Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 427. and bot says to Printex sth like this: sorry, i can't get your ID, this should not be happen... Plase notify the owner of this bot Share this post Link to post Share on other sites
timbol Report post Posted November 15, 2006 (edited) I had to make ulimit -s 64000 to make pathfinding work Thanks for the bug-find ;-) What's the problem with pathfinding in WSC ? it 'should work' ;-) cheers a very nice framework just wsc is too big for the pathfinding system found a little bug in Client.pm sub equipItem: s/1 \.\. 35/0 .. 35/ greetings jooschi Bug in Client.pm sub ADD_NEW_ENHANCED_ACTOR my ($name,$guild) = decodeTitle(unpack('Z*',substr($data,28,13))); should be my ($name,$guild) = decodeTitle(unpack('Z*',substr($data,28,14))); if lenght is 13 guild tag has only 3 chars Edited November 15, 2006 by Timbol Share this post Link to post Share on other sites
timbol Report post Posted April 1, 2007 (edited) Someone told me that this is not always working as expected so I check my code and found that I made some more changes. Here all decodeTitle code: sub decodeTitle { my ($title) = @_; my ($name,$nameC,$guild,$guildC) = ("","","",""); my ($i,$j,$k); my $len = length($title); for($i=0; $i <= $len-1; $i++) { (ord(substr($title,$i)) >= 127) || last; } for($j=$i; $j <= $len-1; $j++) { (ord(substr($title,$j,1)) < 127) || last; } if ($j <= $len-1) { for($k=$j; $k <= $len-1; $k++) { (ord(substr($title,$k,1)) >= 127) || last; } $guildC = ord(substr($title,$j,$k-$j)); $guild = substr($title,$k); $name = substr($title,$i,$j-$i-1); } else { $name = substr($title,$i,$j-$i); } $nameC = ord(substr($title,0,$i)); return ([$nameC,$name],[$guildC,$guild]); } and I use this function like that (line 1001 in oryginal Client.pm): my ($name,$guild) = decodeTitle(unpack('Z*',substr($data,28,14))); I found bug and fix it. I replayced line 930 in Client.pm with this code: if(length($guild)==0) { $name = substr($title,$i,$j-$i); } else { $name = substr($title,$i,$j-$i-1); } Edited April 1, 2007 by Timbol Share this post Link to post Share on other sites
DarthCarter Report post Posted April 1, 2007 thanks Someone told me that this is not always working as expected so I check my code and found that I made some more changes. Here all decodeTitle code: sub decodeTitle { my ($title) = @_; my ($name,$nameC,$guild,$guildC) = ("","","",""); my ($i,$j,$k); my $len = length($title); for($i=0; $i <= $len-1; $i++) { (ord(substr($title,$i)) >= 127) || last; } for($j=$i; $j <= $len-1; $j++) { (ord(substr($title,$j,1)) < 127) || last; } if ($j <= $len-1) { for($k=$j; $k <= $len-1; $k++) { (ord(substr($title,$k,1)) >= 127) || last; } $guildC = ord(substr($title,$j,$k-$j)); $guild = substr($title,$k); $name = substr($title,$i,$j-$i-1); } else { $name = substr($title,$i,$j-$i); } $nameC = ord(substr($title,0,$i)); return ([$nameC,$name],[$guildC,$guild]); } and I use this function like that (line 1001 in oryginal Client.pm): my ($name,$guild) = decodeTitle(unpack('Z*',substr($data,28,14))); I found bug and fix it. I replayced line 930 in Client.pm with this code: if(length($guild)==0) { $name = substr($title,$i,$j-$i); } else { $name = substr($title,$i,$j-$i-1); } Share this post Link to post Share on other sites
Florian Report post Posted April 15, 2007 When will the Module on CPAN be updated? Flo Share this post Link to post Share on other sites
timbol Report post Posted May 6, 2007 (edited) Another bug in Bot.pm. Whene you want bot to give you more of item then it have it will exit with such message: Can't use string ("60") as a HASH ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.8/i686-linux/Games/EternalLands/Bot.pm line 1622, <FP> line 47. In line 1622 there is now: $self->sendPM($user,"Sorry, I only have ".$give->{'quantity'}." $name"); but should be: $self->sendPM($user,"Sorry, I only have ".$give." $name"); and it fix this error Edited May 6, 2007 by Timbol Share this post Link to post Share on other sites