[Crossfire-wiki] [Crossfire DokuWiki] page added: user:meflin:scripts:charge.pl
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Mon Nov 19 23:03:37 CST 2007
A page in your DokuWiki was added or changed. Here are the details:
Date : 2007/11/19 23:03
User : meflin
Edit Summary: created
#!/usr/bin/perl
$|=1;
$crystals=7;
sub getstats()
{
print "request stat hp\n";
$input=<STDIN>;
@stats=split(/ /,$input);
$hp=@stats[3];
$hpmax=@stats[4];
$sp=@stats[5];
$spmax=@stats[6];
$gp=@stats[7];
$gpmax=@stats[8];
$food=@stats[9];
}
$mode=0;
$maxcounter=0;
$pointer=1;
while (1)
{
sleep(1);
getstats();
if ($sp>=$spmax)
{
$maxcounter+=1;
}
else
{
$maxcounter=0;
}
if ($maxcounter==10)
{
$mode=0;
print "draw 1 charging crystals\n";
$pointer=1;
}
if ($sp<(($spmax/2)-5) && $mode !=3)
{
$mode=1;
print "draw 1 discharging crystals\n";
$pointer=1;
}
if ($pointer > $crystals)
{
$pointer=1;
}
#charge mode
if ($mode==0)
{
for ($a=$pointer; $a<=$crystals; $a++)
{
if ($sp>=$spmax)
{
print "issue 1 1 apply c".$a."\n";
sleep(1);
getstats();
$pointer=$a;
}
}
if ($sp==$spmax)
{
$mode=2;
print "draw 1 charge comeplete\n";
}
}
#discharge mode
if ($mode==1)
{
for ($a=$pointer; $a<=$crystals; $a++)
{
if ($sp<$spmax)
{
print "issue 1 1 apply c".$a."\n";
sleep(1);
getstats();
$pointer=$a;
}
}
if ($sp<$spmax)
{
$pointer=1;
}
}
}
IP-Address : 71.229.157.100
Old Revision: none
New Revision: http://wiki.metalforge.net/doku.php/user:meflin:scripts:charge.pl
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list