SCAR Code:
program AutoColor;
{.include SRL\SRL.scar}
function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
if not (FindColorsTolerance(arP, 1468528, MMX1, MMY1, MMX2, MMY2, 0)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
if (rs_OnMinimap(arP[i].x, arP[i].y)) then
begin
ColorToHSL(arC[i], H, S, L);
if (H >= 15.17) and (H <= 15.21) and (S >= 67.14) and (S <= 67.18) and (L >= 26.25) and (L <= 26.29) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 11.76) and (X <= 11.80) and (Y >= 13.38) and (Y <= 13.42) and (Z >= 2.71) and (Z <= 2.75) then
begin
Result := arC[i];
Mouse(arP[i].x, arP[i].y, 2, 2, True);
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
begin
SetupSRL;
AutoColor;
end.
There you go.