SCAR Code:
{*******************************************************************************
function MouseColorUptext(X, Y, Rx, Ry : Integer; Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime, Action : Integer; UpTxt : string) : Boolean;
By: R1ch
Description: Waits for a color at X, Y with tolerance Tol, then checks for uptext.
If uptext is found, then performs Action. 0 = Nothing
1 = Left click
2 = Right click
Returns true if Action is performed
*******************************************************************************}
function MouseColorUptext(X, Y, Rx, Ry : Integer; Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime, Action : Integer; UpTxt : string) : Boolean;
begin
if not InRange(Action, 0, 2) then
begin
SRL_Warn('MouseColorUptext', 'Incorrect action: ' + IntToStr(Action), warn_AllVersions);
Exit;
end;
if WaitFindColor(X, Y, Cx1, Cy1, Cx2, Cy2, Col, Tol, MaxTime) then
begin
MMouse(X, Y, Rx, Ry);
if WaitUptext(Uptext, MaxTime) then
begin
GetMousePos(X, Y);
if Action > 0 then
1, 2 : Mouse(X, Y, 0, 0, Action = 1);
Result := True;
end;
end;
end;
{*******************************************************************************
function WaitFindColorSpiral(X1, Y1, X2, Y2, Col, Tol, MaxTime: Integer) : Boolean;
By: R1ch
Description: Waits for a color spiraling with tolerance Tol, returns true if found
*******************************************************************************}
function WaitFindColorSpiral(X1, Y1, X2, Y2, Col, Tol, MaxTime: Integer) : Boolean;
var
Time: Integer;
begin
Time := GetSystemTime + MaxTime;
while GetSystemTime < Time do
Begin
Result := FindColorSpiralTolerance(MSCX, MSCY, Col, X1, Y1, X2, Y2, Tol);
If Result then Exit;
end;
end;