SCAR Code:
{*******************************************************************************
function FindObjTPAMulti(var X, Y: integer; Color: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount :Integer; UpText: TStringArray): Boolean;
By: Wizzup?
Description: This is a modification of FindObjTPA, which uses a TIntegerArray for the Colors.
Date: 29th August 2009
*******************************************************************************}
function FindObjTPAMulti(var X, Y: Integer; Colour: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: TStringArray): Boolean;
var
i, tCTS: Integer;
myPoint: TPoint;
aPoints: T2DPointArray;
ATPA: T2DPointArray;
TPA: TPointArray;
begin
Result := False;
if not LoggedIn then exit;
tCTS := GetColorToleranceSpeed;
if CTS * 9 mod 3 <> 0 then
CTS := 1;
ColorToleranceSpeed(CTS);
SetLength(ATPA, Length(Colour));
for i := 0 to High(Colour) do
begin
FindColorsSpiralTolerance(x, y, ATPA[i], Colour[i], MSX1, MSY1, MSX2, MSY2, Tol);
end;
TPA := MergeATPA(ATPA);
if Length(TPA) = 0 then
begin
ColorToleranceSpeed(tCTS);
Exit;
end;
ColorToleranceSpeed(1);
aPoints := TPAtoATPAEx(TPA, ObjWidth, ObjHeight);
for I := 0 to High(aPoints) do
begin
if Length(aPoints[i]) < minCount then
Continue;
myPoint := MiddleTPA(aPoints[i]);
MMouse(myPoint.x, myPoint.y, 0, 0);
if WaitUpTextMulti(UpText, 300) then
begin
GetMousePos(X, Y);
Result := True;
ColorToleranceSpeed(tCTS);
Exit;
end;
end;
ColorToleranceSpeed(tCTS);
end;
{*******************************************************************************
function FindObjTPA(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray): Boolean;
By: Wizzup?
Description: Finds object using WizzyPlugin functions.
Starts with a Spiral from x and y.
Put in the color, Tolerance and ColorToleranceSpeed.
If you don't know what colortolerancespeed to choose, put in -1.
ObjWidth and ObjHeight are the parameters TPAToATPAEx uses, thus filtering
the MS's FindColorsSpiralTolerance points in boxes defined by
ObjWidth and ObjHeigth.
minCount is the amount of colors it should at least find in a Object box.
UpText, is ofcourse the text the object should have. In the Multi variant the
UpText is a string array.
*******************************************************************************}
function FindObjTPA(var X, Y: Integer; Color, Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: TStringArray): Boolean;
begin
Result:=FindObjTPAMulti(X, Y, [Color], Tol, CTS, ObjWidth, ObjHeight, minCount, UpText);
end;