SRL Archive - Test corner

Idea for symbols


Cazax

2009-02-03 11:06:38

I have been thinking about an idea for better symbol finding, which consists on replace the bitmaps for color finding and counting lengths. Here it is an example(to find a bank):
Function FindBankMM(Var TP : TPoint): Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
Box : TBox;
I, H, Len : Integer;
X : Extended;
Begin
FindColorsTolerance(TPA, 2083034, MMX1, MMY1, MMX2, MMY2, 15);
If Length(TPA) = 0 Then
Exit;
ATPA := TPAtoATPA(TPA, 10);
SortATPAfrom(ATPA, Point(MMCX, MMCY));
H := High(ATPA);
For I := 0 To H Do
Begin
Box := GetTPABounds(ATPA[I]);
Len := CountColorTolerance(2083034, Box.X1, Box.Y1, Box.X2, Box.Y2, 15);
X := Len Div 17;
If SymbolAccuracy <= X Then
Begin
Try
TP := TPA[0];
Except
Exit;
End;
Result := True;
End;
End;
End;
It is very effective and fast, while FindSymbol takes between 150-200 ms finding a symbol this function takes between 0-15 milliseconds.

Sir R. M8gic1an

2009-02-03 11:26:39

looks nice. Would need to make it more general, meaning you'll need a couple of extra vars and a case in there.

also, no use for this:

TP := TPA[Low(TPA)];

TPA is dynamic, and therefore Low(TPA) will always be 0. might as well save some time ;)

does it ever get confused with bankers / other NPCs on minimap?

does anyone know of anything yellow in RS which might make this functon fail?

~RM

Cazax

2009-02-03 11:44:19

From: Rasta Magician
looks nice. Would need to make it more general, meaning you'll need a couple of extra vars and a case in there.

also, no use for this:

TP := TPA[Low(TPA)];

TPA is dynamic, and therefore Low(TPA) will always be 0. might as well save some time ;)

does it ever get confused with bankers / other NPCs on minimap?

does anyone know of anything yellow in RS which might make this functon fail?

~RM

Ok I will change the Low(TPA) for 0, and I have tested it using DebugTPA and it hasn't confused with anything yet.

Home

2009-02-03 15:05:08

Great idea, i use symbols very much for walking =) And sometimes it really is annoying when it takes a little bit more time than it should =)


~Home

Nava2

2009-02-04 17:08:04

Tolerances.

Biggest thing.