SRL Archive - OSR Help

Need explanation


Sawyer

2013-03-31 19:25:24

This code is from Putonajonny's sorceress's garden script, I can't seem to get it right. It is pretty outdated, and the paint is what doesn't work.
Function WaitForColorsInBoxes(Colour : integer; Boxes : array of array of TBox; Tol : integer; TimeOut : integer) : Boolean;
Var
B, B2 : Boolean;
Time, i, j, x, y : integer;
C : array of integer;
begin

C := [clPurple, clLime, clAqua, clBlue, clRed, clDkGray, clPurple, clYellow];

SetArrayLength(C, GetArrayLength(Boxes));

SMART_ClearCanvas;
{$IFDEF SHOWBOXES}
for i := 0 to high(Boxes) do
for j := 0 to high(Boxes[i]) do
SMART_DrawBoxEx(False, Boxes([i],[j]), C[i]);
{$ENDIF}
MarkTime(Time);
//TerminateScript;

Repeat

Wait(10+Random(10));

if(GotCaught)then
exit;

if(not LoggedIn)then
LoginPlayer;

if((TimeOut <> 0) and (TimeFromMark(Time) > TimeOut))then
exit;

B := True;
for i := 0 to high(Boxes) do
begin
B2 := False;
for j := 0 to high(Boxes[i]) do
B2 := B2 or FindColorTolerance(x, y, Colour, Boxes[i][j].x1, Boxes[i][j].y1, Boxes[i][j].x2, Boxes[i][j].y2, Tol);
B := B and B2;
end;

Until(B);

Result := B;

SMART_ClearCanvas;

end;