SRL Archive - OSR Help

PixelShift Help


Valithor

2012-04-01 18:58:31

Hey Guys…
I'm working a fishing script at the moment, but I'm a little unhappy with one spot of my script. I find the Fishing Spot just fine, but I'm using PixelShift to determine when my character is not animating, though sometimes the PixelShift will "Result:= True" when my character is still animating, causing the script to look really bot like. Soo… I tried coming up with a work around, but that's when I run into problems… >_>

function PixelShift_1: Boolean;     // This works, but results 
var //true too frequently.
PBox: TBox;

begin
PBox := IntToBox(245, 130, 285, 195);
if (AveragePixelShift(PBox, 250, 500) < 160) then
begin
FindNormalRandoms;
Writeln('PixelShift is Low; Not Animating');
Result:= True;
end;
end;

function NotFishing: Boolean; //This is what I'm struggling with...
var
Retry: Integer;

begin
Retry:= 0;

if PixelShift_1 then
begin
Inc(Retry);
repeat
PixelShift_1;
until ((Retry) > 3) then
Result:= true;
end;
end;

What I would LIKE for it to do is when PixelShift_1 results true then it will increase the Retry count. When (Retry > 3) three times in a row (consecutively) then "NotFishing" would result true.

I'm sure I'm super far off… which is why I'm asking for help.
Any ideas? :frusty:

Nebula

2012-04-01 19:46:40

Try something like this:


Repeat
if (PixelShift_1 = true) then
inc(trys);
else
trys := 0;
until (Trys = 3)