SRL Archive - OSR Help

Checking Location


King

2013-03-14 18:43:57

I want to check if I am at the bank, what is the best way to check I am within a reasonable distance of a bank? 07Scape btw.

Can I filter the FindSymbol function from the MiniMap Main Points and the set it to return true if it is within a certain distance? If so, how do I do this?

rj

2013-03-14 18:44:42

Do you mean find the nearest booth?

King

2013-03-14 18:56:44

From: RJJ95
Do you mean find the nearest booth?


No, just check that I am within a certain distance of the bank symbol before trying to bank.

rj

2013-03-14 18:58:23

From: SRLKing
No, just check that I am within a certain distance of the bank symbol before trying to bank.

Oh I guess you could use the distance formula to get the distance between your white square (always (643, 83)) and the dtm of the bank


Then only bank if you are within that certain area

So find the distance between 643,83 and find the bank DTM and store in 2 variables and use


EDIT:

@SRL King

I came up with this:

{$i srl/srl.simba}
Var
MSX,MSY,X1,X2,Y1,Y2,Dist_To_Symbol:Integer;
DTM_Bank,X,Y:Integer;
Procedure FreeMem;
Begin
FreeDTM(DTM_Bank);
End;
Procedure LoadDTM;
Begin
DTM_Bank := DTMFromString('mQwAAAHicY2ZgYEhgYmBIAeJwIE4D8jOBOBmI31xMYGBmFAVjfiAfhhmRMBAAANchBNY=');
End;
Procedure GetMMDistance;
Begin
X1 := X
Y1 := Y
X2 := 643
Y2 := 83
//Dist_To_Symbol := Sqr((((X2)-(X1))*((X2)-(X1))) + (((Y2)-(Y1))*((Y2)-(Y1))));
Dist_To_Symbol := Distance(X1,Y1,X2,Y2);
ClearDebug;
Writeln('Current Distance from symbol:' + ToStr(Dist_To_Symbol))
Wait(300);
End;
Procedure GetDTM;
Begin
if FindDTM(DTM_Bank, x, y, 524, 3, 762, 168) Then
Begin
Writeln('Got Bank DTM')
End;
End;


Begin
Repeat
LoadDTM;
GetDTM;
GetMMDistance;
Until False;
AddOnTerminate('FreeMem');
End.

Edit it out to use built in distance works great

Olly

2013-03-14 19:21:03

function closeTobank: boolean;
begin
p := findSymbol('bank');
result := distance(mmcx, mmcy, p.x, p.y) < 20;
end;

something like that?

Element17

2013-03-14 19:25:51

From: RJJ95
Oh I guess you could use the distance formula to get the distance between your white square (always (643, 83)) and the dtm of the bank


Then only bank if you are within that certain area

So find the distance between 643,83 and find the bank DTM and store in 2 variables and use


EDIT:

@SRL King

I came up with this:

{$i srl/srl.simba}
Var
MSX,MSY,X1,X2,Y1,Y2,Dist_To_Symbol:Integer;
DTM_Bank,X,Y:Integer;
Procedure FreeMem;
Begin
FreeDTM(DTM_Bank);
End;
Procedure LoadDTM;
Begin
DTM_Bank := DTMFromString('mQwAAAHicY2ZgYEhgYmBIAeJwIE4D8jOBOBmI31xMYGBmFAVjfiAfhhmRMBAAANchBNY=');
End;
Procedure GetMMDistance;
Begin
X1 := X
Y1 := Y
X2 := 643
Y2 := 83
//Dist_To_Symbol := Sqr((((X2)-(X1))*((X2)-(X1))) + (((Y2)-(Y1))*((Y2)-(Y1))));
Dist_To_Symbol := Distance(X1,Y1,X2,Y2);
ClearDebug;
Writeln('Current Distance from symbol:' + ToStr(Dist_To_Symbol))
Wait(300);
End;
Procedure GetDTM;
Begin
if FindDTM(DTM_Bank, x, y, 524, 3, 762, 168) Then
Begin
Writeln('Got Bank DTM')
End;
End;


Begin
Repeat
LoadDTM;
GetDTM;
GetMMDistance;
Until False;
AddOnTerminate('FreeMem');
End.

Edit it out to use built in distance works great



I like that! Mind if I play around with it? Will credit of course if used.

rj

2013-03-14 19:30:26

From: Element17
I like that! Mind if I play around with it? Will credit of course if used.


Sure I guess so i'm having fun with it myself might consider it for walking maybe

Could use something like If Distance_To_Symbol >= 20 Then
blah blah blah

Element17

2013-03-14 19:31:18

Kinda what I was thinking! Haha.

King

2013-03-14 22:13:40

I like them both, Rjj, work on that! It looks really cool! and olly that is exactly what I was looking for<3