program new;
{.include SRL/SRL.Scar}
var
Road2Color,time: integer;
procedure DebugSamples;
var
c: integer;
mmColors: array of Integer;
Hue, Sat, Lum, tX, tY, tZ: Extended;
tR, tG, tB: integer;
begin
mmColors := [6714496, 6847619, 6518909, 6781826, 6716802, 6781826, 6387578
];
for c := 0 to getarraylength(mmColors) - 1 do
begin
ColorToXYZ(mmColors[c], tX, tY, tZ);
ColorToHSL(mmColors[c], Hue, Sat, Lum);
ColorToRGB(mmColors[c], tR, tG, tB);
Writeln('['+IntToStr(mmColors[c])+']');
Writeln('H = '+FloatToStr(Hue)+ '; S = '+FloatToStr(sat)+'; L = '+FloatToStr(Lum));
Writeln('X = '+FloatToStr(tX) + '; Y = '+FloatToStr(tY) +'; Z = '+FloatToStr(tZ));
Writeln('R = '+FloatToStr(tR) + '; G = '+FloatToStr(tG) +'; B = '+FloatToStr(tB));
Writeln('');
end;
TerminateScript;
end;
function FaladorRoadColor: integer;
var
RoadPTs, GRoadPts, HoldPts: TPointArray;
Size, ci, j, tR,t,color, tG, tB: integer;
RoadColors: TIntegerArray;
begin
for x := 615 to 705 do
begin
y:=x-555;
if (Result > 0)then
begin
Writeln('Falador RoadColor = '+IntToStr(Result));
exit;
end;
//ColorToRGB(RoadColors[ci], tR, tG, tB);
color:=getcolor(x,y);
if SimilarColors(color,6518909,45) then
begin
ColorToRGB(color, tR, tG, tB);
if (tR > 100) and (tR < 140) and
(tG > 100) and (tG < 130) and
(tB > 90 ) and (tB < 105) then
begin
FindColorsTolerance(HoldPts, color, x - 5,
y - 5, x + 5, y + 5, 0);
if (GetArrayLength(HoldPts) > 10)then
Result := color;
end;
end;
end;
y:=85;
for x := 585 to 696 do
begin
if (Result > 0)then
begin
Writeln('Falador RoadColor = '+IntToStr(Result));
exit;
end;//ColorToRGB(RoadColors[ci], tR, tG, tB);
color:=getcolor(x,y);
if SimilarColors(color,6518909,45) then
begin
ColorToRGB(color, tR, tG, tB);
if (tR > 100) and (tR < 140) and
(tG > 100) and (tG < 130) and
(tB > 90 ) and (tB < 105) then
begin
FindColorsTolerance(HoldPts, color, x - 5,
y - 5, x + 5, y + 5, 0);
if (GetArrayLength(HoldPts) > 10)then
Result := color;
end;
end;
end;
x:=645;
for y := 20 to 145 do
begin
if (Result > 0)then
begin
Writeln('Falador RoadColor = '+IntToStr(Result));
exit;
end;
//ColorToRGB(RoadColors[ci], tR, tG, tB);
color:=getcolor(x,y);
if SimilarColors(color,6518909,45) then
begin
ColorToRGB(color, tR, tG, tB);
if (tR > 100) and (tR < 140) and
(tG > 100) and (tG < 130) and
(tB > 90 ) and (tB < 105) then
begin
FindColorsTolerance(HoldPts, color, x - 5,
y - 5, x + 5, y + 5, 0);
if (GetArrayLength(HoldPts) > 10)then
Result := color;
end;
end;
end;
for x := 615 to 705 do
begin
y:=x-555;
if (Result > 0)then
begin
Writeln('Falador RoadColor = '+IntToStr(Result));
exit;
end;
//ColorToRGB(RoadColors[ci], tR, tG, tB);
color:=getcolor(x,y);
if SimilarColors(color,6518909,45) then
begin
ColorToRGB(color, tR, tG, tB);
if (tR > 100) and (tR < 140) and
(tG > 100) and (tG < 130) and
(tB > 90 ) and (tB < 105) then
begin
FindColorsTolerance(HoldPts, color, x - 5,
y - 5, x + 5, y + 5, 0);
if (GetArrayLength(HoldPts) > 10)then
Result := color;
end;
end;
end;
y:=150;
for x := 615 to 705 do
begin
y:=y-1;
if (Result > 0)then
begin
Writeln('Falador RoadColor = '+IntToStr(Result));
exit;
end;
//ColorToRGB(RoadColors[ci], tR, tG, tB);
color:=getcolor(x,y);
if SimilarColors(color,6518909,45) then
begin
ColorToRGB(color, tR, tG, tB);
if (tR > 100) and (tR < 140) and
(tG > 100) and (tG < 130) and
(tB > 90 ) and (tB < 105) then
begin
FindColorsTolerance(HoldPts, color, x - 5,
y - 5, x + 5, y + 5, 0);
if (GetArrayLength(HoldPts) > 10)then
Result := color;
end;
end;
end;
if (Result = 0)then Writeln('ERROR unable to Find FaladorRoadColor !! ');
ColorToleranceSpeed(1);
end;
begin
//DebugSamples;
// SetUpSRL;
//NewLine := '';
//ClearDebug;
//FindWindowBySize(766, 504);
ActivateClient;
time:=getsystemtime;
Road2Color := FaladorRoadColor;
Writeln('Time took '+IntToStr(getsystemtime-time) + ' ms.');
end.