SRL Archive - SRL Archives

FindFryer(FrX, FrY): Boolean;


TheGodfather

2007-03-28 22:00:25

Hey, I made a universal range finder, (tested it with all the ranges, and it worked.) So since what SRL has doesn't work, I thought I'd make one.


{********** Finds the range to cook on **********}
Function FindFryer(var FrX, FrY: integer): Boolean;
var c, tol: integer;
Begin
Repeat
if (not (LoggedIn) ) then Break; //or exit; but Jukka prefers break;
result := false;
Writeln('Searching for range...');
c := c + 1;
if (FindColorSpiralTolerance(x, y, 857975, MSX1, MSY1, MSX2, MSY2, tol))
or
(FindColorSpiralTolerance(x, y, 924553, MSX1, MSY1, MSX2, MSY2, tol))
or
(FindColorSpiralTolerance(x, y, 1187474, MSX1, MSY1, MSX2, MSY2, tol))
or
(FindColorSpiralTolerance(x, y, 1121424, MSX1, MSY1, MSX2, MSY2, tol))
or
(FindColorSpiralTolerance(x, y, 1122196, MSX1, MSY1, MSX2, MSY2, tol)) then
begin
result := true;
Writeln('Range Found');
FrX := x;
FrY := y;
break;
end;
tol:= tol + 5;
FTWait(1);
Until(c >= 4)
if (c >= 4) then
begin
result := False;
Writeln('Range not found');
end;
End;

Post feedback please.

Boreas

2007-03-28 23:30:31

Um, it always returns true for me, where there is a range or not.

TheGodfather

2007-03-28 23:40:24

Did you add a MMouse(x, y, 0, 0);??

edit: yeah my Tolerance was too high, Here i edited it… edited in my 1st post

JuKKa

2007-03-31 08:46:58

shouldnt

Repeat
if (not (LoggedIn) ) then Exit;

be:


Repeat
if (not (LoggedIn) ) then Break;

TheGodfather

2007-04-03 20:19:56

From: JuKKa
shouldnt

Repeat
if (not (LoggedIn) ) then Exit;

be:


Repeat
if (not (LoggedIn) ) then Break;


Maybe, but from what I understand break means "to exit that loop", exit means "to exit the whole procedure/function".
I dont know, but break does look prettier :p

Thick As Blood

2007-04-05 15:38:47

also, maybe use 'IsUpText' ?

TheGodfather

2007-04-05 23:52:25

From: Thick As Blood
also, maybe use 'IsUpText' ?


Problem with that is, stoves/ranges/pans/fryers have different texts to them, and the only way SCAR would have to be 100% sure that it is a range, is by right clicking on the color (that window comes up) and searching for the text I recently stated. I belive that would be very inhuman-like and I think you would too.

JuKKa

2007-04-10 15:03:21


Repeat
if (not (LoggedIn) ) then Exit;
......
Until(c >= 4)

arent u in a loop right there?

TheGodfather

2007-04-10 20:37:30

yeah. But they do the same thing. My OCD just makes it so that I like to write exit; instead of break;.

OFFTOPIC: Jukka welcome back from your week :)