SCAR Code:
{*******************************************************************************
Function WaitColor(x, y, Color, Tol, MaxTime: integer): Boolean;
By: Rasta Magician, fixed by TRiLeZ
Description: Waits for a color at (x, y) with tolerance Tol, returns true if found
*******************************************************************************}
Function WaitColor(X, Y, Color, Tol, MaxTime: Integer): Boolean;
var
Time: Integer;
begin
Result := False;
Time := GetSystemTime + MaxTime;
while (Time > GetSystemTime) do
begin
if SimilarColors(GetColor(X, Y), Color, Tol) then
begin
Result := True;
Exit;
end;
Wait(5 + Random(6));
end;
end;