Hi =), 2bh i was realy fed up of having 2 write 20 odd lines of code for a tpa.. so i made this an include that doe's it for u!!!!!
This Does Work ive tested it myself and only took 0.76 secs to find it and move the mouse to it!
run thorugh of teh function:
x and y - Were you whant your cords to be stored
color 1 , 2 & 3 - 3 colours of the thing you are whanting to click 
TheUpText - the important part of the string at the top eg Oak (Case sensative)
and there u have it we have located our object in 2 lines 
edit (lost count of the number of times XD):
this sould work correctly has everything in it and uses TIntegerArray =)
with special thank to Mastaraymond and ProphesyOfWolf For helping alot in the development of this Funciton!
SCAR Code:
Function TPAFind(Var X, y :integer; colors :TIntegerArray; TheUpText :String):boolean;
var
CTS, Ic : Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
H, S, L, HueMod, SatMod, tolerance :extended;
midcolor: integer;
I,II : integer;
HSLColor : Array[1..3] of Extended;
HSL: Array[0..1] of Array[1..3] of Extended;
begin
//Work Out some values
For Ic:= 1 to 3 do
begin;
HSL[0][ic] := 255; //Max is 240?
end;
For Ic:= 0 to High(Colors) do
begin;
ColortoHSL(Colors[ic],HSLColor[1],HSLColor[2],HSLColor[3]);
For II:= 1 to 3 do
begin;
HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
end;
end;
For Ic:= 0 to 9 do
begin;
end;
H := HSL[1][1] - HSL[0][1];
S := HSL[1][2] - HSL[0][2];
L := HSL[1][3] - HSL[0][3];
midcolor := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
HueMod := (H/L);
SatMod := (S/L);
tolerance := L;
//FIND the TPA!
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Huemod, satmod );
FindColorsSpiralTolerance(MSCX, MSCY, TPA, MidColor, MSX1, MSY1, MSX2, MSY2, round(tolerance+0.5));
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For Ic := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
Wait(50);
If(IsUpTextMultiCustom([TheUpText])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;
SCAR Code:
program New;
{.include SRL/SRL.scar}
Function TPAFind(Var X, y :integer; colors :TIntegerArray; TheUpText :String):boolean;
var
CTS, Ic : Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
H, S, L, HueMod, SatMod, tolerance :extended;
midcolor: integer;
I,II : integer;
HSLColor : Array[1..3] of Extended;
HSL: Array[0..1] of Array[1..3] of Extended;
begin
//Work Out some values
For Ic:= 1 to 3 do
begin;
HSL[0][ic] := 255; //Max is 240?
end;
For Ic:= 0 to High(Colors) do
begin;
ColortoHSL(Colors[ic],HSLColor[1],HSLColor[2],HSLColor[3]);
For II:= 1 to 3 do
begin;
HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
end;
end;
For Ic:= 0 to 9 do
begin;
end;
H := HSL[1][1] - HSL[0][1];
S := HSL[1][2] - HSL[0][2];
L := HSL[1][3] - HSL[0][3];
midcolor := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
HueMod := (H/L);
SatMod := (S/L);
tolerance := L;
//FIND the TPA!
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Huemod, satmod );
FindColorsSpiralTolerance(MSCX, MSCY, TPA, MidColor, MSX1, MSY1, MSX2, MSY2, round(tolerance+0.5));
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For Ic := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
Wait(50);
If(IsUpTextMultiCustom([TheUpText])) then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;
var
OakColors :TIntegerArray;
x, y, T :integer;
begin
SetUpSRL;
marktime(t);
//Change the below ;)
OakColors := [2582619, 2185550, 2384468]// or your own colors
TpaFind(x, y, OakColors, 'Oak');// or your TPA values
//Injoy =)
mouse(x, y, 2, 2, true);
writeln('Took '+inttostr(TimeFromMark(t))+'To Find Your Object!');
end.