noidea
2009-05-24 00:58:52
{*******************************************************************************
Function FindLadderColor: Integer;
by: noidea
Description: Finds the ladder color on the minimap.
*******************************************************************************}
Function FindLadderColor: Integer;
var
TestColor, R, G, B, GC, CTS, AL, i, CC: Integer;
H, S, L : Extended;
TPA: Array of TPoint;
begin
GC := 9039;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.36, 0.97);
FindColorsSpiralTolerance(mmcx, mmcy, TPA, GC , mmx1, mmy1, mmx2, mmy2, 50);
SetColorSpeed2Modifiers(0.2, 0.2);
If Length(TPA) < 1 then
begin
writeln('No Ladder Colors Found!');
exit;
end;
DebugTPA(TPA, '');
AL := GetArrayLength(TPA);
For i := 0 to AL - 1 do
begin
If RS_OnMiniMap(TPA[i].x, TPA[i].y) then
begin
TestColor := GetColor(TPA[i].x, TPA[i].y);
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
if InRange(R - B, 50, 110) then
if InRange(R - G, 25, 65) then
if InRange(G - B, 12, 60) then
if InRange(Round(H - L), -25, 0) then
if InRange(Round(S - H), 45, 100) then
if InRange(Round(S - L), 20, 90) then
If InRange(CountColor(TestColor, TPA[i].x - 10, TPA[i].y - 10, TPA[i].x + 10, TPA[i].y + 10), 25, 120) then
if GetColor(TPA[i].x - 1, TPA[i].y) = TestColor then
if GetColor(TPA[i].x, TPA[i].y + 1) = TestColor then
if GetColor(TPA[i].x, TPA[i].y - 1) = TestColor then
begin
writeln('Found Ladder Color ('+inttostr(TestColor)+') at '+inttostr(TPA[i].x) + ', '+ Inttostr(TPA[i].y));
Result := TestColor;
exit;
end;
end;
end;
writeln('Couldnt Find Ladder Color2!');
Result := 0;
end;The old one ocationally breaks on me.
Like on colour 1193055.
Saturn tells me he made a fix in one of his scripts, but I wanted to release mine like this.
Rate/Hate?