SCAR Code:
{*******************************************************************************
function FindObjTPAMulti(var X, Y: integer; Color: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount :Integer; UpText: TStringArray): Boolean;
By: Wizzup?, Modified by Torrent of Flame
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;
I noticed there was a gap in SRL. A lot of people are currently using FindObjTPA in their scripts, but not a FindObjTPAMulti.
This uses a TInteger array to find the tree so if you want to use multiple colours in the function you would have to declare about 4 and then do for i := 0 to 4, etc, whereas with this you can declare is as such;
SCAR Code:
procedure TreeVariables;
begin
TreeCol := [3241318, 2119755, 2645844, 3240035];
UpTextz := ['Tree', 'Tre', 'ree'];
end;
begin
FindObjTPAMulti(x, y, TreeCol, 30, 2, 15, 25, 10, UpTextz);
end;
Or you can just put the Variables straight into the funciton.