WhiteShadow
2007-07-08 18:27:43
I wrote this fairly quickly just now, with 6 color samples so the values may need to be edited a little.
-WhiteShadow.
program RockColorBruteForcer;
var
RockColor: integer;
{
Returns a an array of colors that match dColor/Tol given
inside the Minimap.
}
function FindColorsCircleTolerance(dColor, Tol: integer): TIntegerArray;
var
Points, TPA: TPointArray;
ci, Wlength, k: integer;
begin
FindColorsTolerance(Points, dColor, 565, 9, 719, 1592, Tol);
Wlength := GetArrayLength(Points);
for ci := 0 to WLength - 1 do
begin
if (rs_OnMinimap(Points[ci].x, Points[ci].y))then
begin
SetArrayLength(TPA, GetArrayLength(TPA) + 1);
TPA[GetArrayLength(TPA) - 1] := Points[ci];
end;
end;
Result := GetColors(TPA);
end;
{
Using HSL, autocolors the MM Rock.
}
function FindRockColorX: integer;
var
aRockColors: TIntegerArray;
Time, wLength, ci : integer;
HV, SV, LV: extended;
begin
Time := GetSystemTime;
aRockColors := FindColorsCircleTolerance(4406089, 50);
wLength := GetArrayLength(aRockColors);
for ci := 0 to wLength - 1 do
begin
ColorToHSL(aRockColors[ci], HV, SV, LV);
if(HV > 14) and (HV < 86) and
(SV > 1 ) and (SV < 12) and
(LV > 24) and (LV < 45) then
begin
Result := aRockColors[ci];
Break;
end;
end;
Writeln('Took '+IntToStr(GetSystemTime - Time) + ' msec.');
if (Result > 0)then
Writeln('RockColor = '+IntToStr(Result))
else
begin
Writeln('ERROR: Could not get RockColor.');
end;
end;
begin
ClearDebug;
RockColor := FindRockColorX;
end.
-WhiteShadow.