program New;
{.include SRL\SRL.scar}
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.39);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 5608325, MSX1, MSY1, MSX2, MSY2, 13);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);
if (R >= 93) and (R <= 167) and (G >= 101) and (G <= 183) and (B >= 64) and (B <= 115) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 10.30) and (X <= 35.51) and (Y >= 12.24) and (Y <= 42.80) and (Z >= 6.80) and (Z <= 22.32) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
function FindTreeColors: TPointArray;
var
x, y: integer;
begin
FindColorsSpiralTolerance(x, y, result, AutoColor, MSX1, MSY1, MSX2, MSY2, 3);
Writeln(Length(result));
for x := 0 to high(result) do
begin
MoveMouse(result[x].x, result[x].y);
wait(1000);
end;
end;
begin
SetupSRL;
FindTreeColors;
end.
Stand by a tree.
Worst way to use TPA's but you didn't ask for the best ;)