SRL Archive - OSR Help

First fighting script


Syntax

2012-09-02 03:10:34

Hey guys, I was hoping someone would help me with this:
program Fighter;

{$i SRL/SRL.simba}

var
x, y:integer;
i:integer;

procedure fight;
begin
if FindColorSpiralTolerance(x, y, 7834773, MSX1, MSY1, MSX2, MSY2, 5) then
begin
MMouse(x, y, 0, 0);
GetMousePos(x,y);
Mouse(x, y, 0 , 0 ,true);
end;
end;
procedure screen;
begin
case random(10) of
0: begin Keydown(39);
wait(500+randomrange(500,700));
KeyUp(39); end;
1: begin Keydown(37);
wait(500+randomrange(300,600));
Keyup(37);end;
end;
end;




begin
SetUpSRL;
repeat
fight;
wait(1500+randomrange(1200,1600));
screen;
until(false);
end.


It is for an rsps just killing some rock crabs (they're always walking around not like rs) I was wondering how instead of using waits that it'd know when the creature was killed, also how can I make the finding colors more exact I have tried setting tolerance lower, but too low doesn't work.

Thank you greatly !

VastlySuperior

2012-09-02 04:08:07

For the colors, use ACA 3, Auto Color Aid to select the best colors for the crabs, as for checking if you are in a fight, maybe you could use dtm`s or a bitmap to check if you are in a fight, have`nt done a fighting script yet and none on private servers.

riwu

2012-09-02 04:23:37

Use AveragePixelShift, or make a bitmap of the hp bar or the hit splashes or check xp gain (if that exists in ps).

Also better to start early and correct ur standards (http://villavu.com/forum/showthread.php?t=60288).

TPA finding can be more accurate, and you can also use autocolor to get the color during run-time and hence able to lower the tolerance for subsequent searches.