SCAR Code:
function AutoColorDirtRoad: Integer;
var
R,G,B : Integer;
H,S,L : Extended;
X,Y,Z : Extended;
MyColor, TestColor : Integer;
TPA : TPointArray;
C1 : TIntegerArray;
i, C2 : Integer;
begin
MyColor := 5598078;
FindColorsSpiralTolerance(MMCX, MMCY, TPA, MyColor, MMX1, MMY1, MMX2, MMY2, 60);
C1 := GetColors(TPA);
C2 := Length(C1) -1;
for i := 0 to C2 do
begin
if RS_OnMinimap(TPA[i].X, TPA[i].Y) then
begin
TestColor := GetColor(TPA[i].X, TPA[i].Y);
begin
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
ColorToXYZ(TestColor, X, Y, Z);
if InRange(R - G, -1, 39) then
if InRange(R - B, 21, 61) then
if InRange(G - B, 2, 42) then
if InRange(Round(S) - Round(H), -5, 25) then
if InRange(Round(L) - Round(H), 17, 47) then
if InRange(Round(S) - Round(L), -37, -7) then
if InRange(Round(X) - Round(Y), -7, 7) then
if InRange(Round(Y) - Round(Z), -2, 12) then
if GetColor(TPA[i].X + 2, TPA[i].Y + 2) = TestColor then
if GetColor(TPA[i].X + 1, TPA[i].Y + 1) = TestColor then
begin
Writeln('Dirt Road Color = '+Inttostr(TestColor));
Result := TestColor;
Exit;
end;
end;
end;
end;
Writeln('Couldnt find My Color!');
Result := 0;
end;