JuKKa
2008-03-25 13:48:28
If i understood right. The whole Doorprofiles.Scar is used to find the red door color. Well.. If yes.. I have a simple small fix :P
Of course this can be improved. But it works. 15msec mostly.
Function FindDoorColor: Integer;
Var
GC, TestColor, T, L, A, Red, Green, Blue: Integer;
P: TPointArray;
Begin
T := GetSystemTime;
GC := 200;
FindColorsSpiralTolerance(MSCX, MSCY, P, GC, MMX1, MMY1, MMX2, MMY2, 54);
L := High(P);
For a:= 0 To L Do
Begin
If(Not rs_OnMinimap(p[a].x, p[a].y))Then Continue;
TestColor := GetColor( P[a].X, P[a].Y );
Red := (TestColor mod 256);
Green := ((TestColor / 256) mod 256);
Blue := ((TestColor / 256) / 256);
If(Green = 0)And(Blue = 0)Then
If( Red > 200)And(Red < 255)Then
If(GetColor( P[a].X + 1, P[a].Y ) = Red )Or
(GetColor( P[a].X, P[a].Y + 1 ) = Red )Then
Begin
Result := TestColor;
Writeln('Doorcolor color = ' +
IntToStr(Result)+ ' - took '+IntToStr(GetSystemTime - T)+' Msec');
Exit;
End;
End;
Writeln('Couldnt Find Door Color - took '+IntToStr(GetSystemTime - T)+ ' Msec');
Result := 0;
End;Of course this can be improved. But it works. 15msec mostly.