TViYH
2008-09-27 20:32:37
function vFindObjectTPAEx(x, y, width, height, color, tolerance, xs, ys, xe, ye:
integer; UpText: string): Boolean;
var
cX, cY, i: integer;
TempTPA: TPointArray;
TempATPA: T2DPointArray;
begin
Result := False;
FindColorsSpiralTolerance(x, y, TempTPA, color, xs, ys, xe, ye, tolerance);
if Length(TempTPA) = 0 then
begin
FindColorsSpiralTolerance(x, y, TempTPA, color, xs, ys, xe, ye, Tolerance + 10);
if Length(TempTPA) = 0 then
begin
WriteLn('Color not found, please use a better color.');
Exit;
end;
end;
TempATPA := SplitTPAEx(TempTPA, width, height);
SortATPASize(TempATPA, True);
for i := 0 to High(TempATPA) do
begin
MiddleTPAEx(TempATPA[i], cX, cY);
MMouse(cX, cY, 6, 6);
Wait(140 + random(170));
if Pos(RS_GetUpText, UpText) > 0 then
begin
GetMousePos(cX, cY);
Mouse(cX, cY, 0, 0, True);
Result := True;
Exit;
end else
Continue;
end;
end;
Finds a TPA using the provided info, sorts it into ATPAs, then uses MiddleTPA to check the point if it finds the UpText.