sub lookup_tb_server
{
my $server = shift;
my $list = IO::Socket::INET->new(
PeerAddr => '176.9.64.22',
PeerPort => 22000,
Proto => 'tcp'
);
while (<$list>)
{
if (/SERVER 0; (.+?)\:(.+?) $server/i)
{
close $list;
return ($1, $2);
}
}
die 'server not found';
}
Then, using a similar method, connect to the IP:port pair you just obtained.You could do it quite easily in TB Lua if you felt like leaving the TB client open all the time (and your connection was up to it).
I wrote that bot. The basic process is this:
Create a connection to 176.9.64.22:22000 to obtain a copy of the server list. You can use something like this:
Code
Then, using a similar method, connect to the IPort pair you just obtained.
While reading from the socket, parse anything that is relevant to your interests and generate replies where necessary. Make sure you ping the server every minute or so (I've made mine do it about every 30 seconds, to be safe).
There really isn't much more to it than that.
AAAAAAAAAAAAAAAAAAAAAAAAAALSO it is most certainly not illegal to make a bot that doesn't play. If it were then blam/juntalis/illepidus (yes i know they all were/are staff, but so was I so vOv) would all have been banned. (o/
According to LUA FAQ, LUA is not applicable online.
http://forum.toribash.com/showthread...sics%20online.
:/
According to LUA FAQ, LUA is not applicable online.
http://forum.toribash.com/showthread...sics%20online.
:/