DidClick(Red: boolean, Time: integer): boolean; - Mouse.scar
SCAR Code:
Function DidClick(Red: Boolean; Time: integer);
var
TimeOut, x, y, Trash: integer;
begin
GetMousePos(x, y);
TimeOut := GetSystemTime + Time;
while not GetSystemTime > TimeOut do
begin
wait(25);
if FindColor(Trash, Trash, 255, x - 5, y - 5, x + 5, y + 5) then
begin
if Red then
Result := true
else
Result := false;
break;
end;
if FindColor(Trash, Trash, 128, x - 5, y - 5, x + 5, y + 5) then
begin
if not Red then
Result := true
else
Result := false;
break;
end;
end;
end;
Function DidRedClick: boolean;
begin
Result := DidClick(true, 500);
end;
Function DidYellowClick: boolean;
begin
Result := DidClick(false, 500);
end;
{
useful to check if we clicked something correctly
}
what do you guys think?
~RM