SRL Archive - SRL Archives

Doorprofiles.Scar ???


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

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.

n3ss3s

2008-03-25 13:56:37

Lol -


Function GetBarbarianDoorColor: Integer;

Var
Colors: TIntegerArray;
TPAA: T2DPointArray;
TPA: TPointArray;
I: Integer;
Begin
FindColorsPie(TPA, 239, 15, 0, 360, 5, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY);
TPAA := SplitTPA(TPA, 1);
For I := 0 To High(TPAA) Do
If GetArrayLength(TPAA[i]) = 8 Then
Begin
Colors := GetColors(TPAA[i]);
ClearSameIntegers(Colors);
If GetArrayLength(Colors) = 1 Then
Begin
Result := Colors[0];
Exit;
End;
End;
End;

Change the 8 to 4 (or 6?) for normal door.

You don't need that RGB shizzling, - the color up to 255 is anyways "full of R", like the SCAR color 255 is 255, 0, 0…

JuKKa

2008-03-25 14:00:57

From: n3ss3s
Lol -


Function GetBarbarianDoorColor: Integer;

Var
Colors: TIntegerArray;
TPAA: T2DPointArray;
TPA: TPointArray;
I: Integer;
Begin
FindColorsPie(TPA, 239, 15, 0, 360, 5, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY);
TPAA := SplitTPA(TPA, 1);
For I := 0 To High(TPAA) Do
If GetArrayLength(TPAA[i]) = 8 Then
Begin
Colors := GetColors(TPAA[i]);
ClearSameIntegers(Colors);
If GetArrayLength(Colors) = 1 Then
Begin
Result := Colors[0];
Exit;
End;
End;
End;

Change the 8 to 4 (or 6?) for normal door.

You don't need that RGB shizzling, - the color up to 255 is anyways "full of R", like the SCAR color 255 is 255, 0, 0…


That doesent seem too relieable…

n3ss3s

2008-03-25 14:05:05

What's the problem? It's extremely reliable - you just don't see it.

a) The length of the tpa of the red color must be exactly 8.
b) All the colors must be the same.
c) As I already said, the length must be 8, and it also is it's own independent TPA, not a part of some weird gradient that isn't a gradient from minimap on fire.

So, it is reliable ;)