SRL Archive - OSR Help

SPS location checking


P1ng

2012-08-20 04:41:33

How do you check if you are within a certain area using SPS?

Say my character my move too far in any one direction and then get stuck, how can you check if they are in that area so you can then move them back to where they should be?

riwu

2012-08-20 04:51:44

Call SPS_GatherMinimap then SPS_FindMapInMap.
Then you can walk back by SPS_BlindWalk etc.

P1ng

2012-08-20 05:58:31

There is no SPS_FindMapInMap?

riwu

2012-08-20 06:08:17

From: P1ng
There is no SPS_FindMapInMap?

?
Make sure u have the latest SPS.

CephaXz

2012-08-20 06:09:12


Function InsideArea(x1, y1, x2, y2: Integer): Boolean;
var
P: TPoint;
Box: TBox;
begin
P := SPS_GetMyPos;
Box := IntToBox(x1, y1, x2, y2);
if PointInBox(P, Box) then
begin
Result := True;
end;
end;

If not InsideArea(x1, y1, x2, y2) then
Failsafewalk;

Something like that? Or maybe if you wanna make it safer, let it to check whether SPS_GetMyPos is -1, -1. Sometimes it couldn't locate your position.

EDIT:

From: riwu
?
Make sure u have the latest SPS.


Gotta check that out, cool function :O

P1ng

2012-08-20 06:12:26

No SPS update available.

No idea why it's not coming up.. Oh well, will give CephaXz's suggestion a go :)

CephaXz

2012-08-20 06:15:38

No new update for me too. Is it a newer version of simba?

Home

2012-08-20 06:33:52

From: CephaXz
No new update for me too. Is it a newer version of simba?


Try overriding the update.


~Home

P1ng

2012-08-20 06:37:26

Trying CephaXz's method and it seems to be working but SPS is gathering my location drastically wrong. Custom map only way to avoid this?

Joe

2012-08-20 08:58:03

You could use ODTM to confirm your location and then use SPS.

P1ng

2012-08-20 09:21:16

In the mining guild so there is just an insane number of rocks and that's it. :(

Footy

2012-08-20 09:39:54

Try ODTMs, I've used them in forest like areas, and they are still surprisingly accurate. If that doesent work, maybe a custom SPS map.

P1ng

2012-08-20 09:44:45

WriteLn(SPS_GetMyPos); returns with this…

(347, 543)
(275, 527)
(87, 763)
(83, 631)
(83, 631)
(79, 631)
(75, 647)
(79, 631)
(227, 539)
(243, 531)
(243, 539)

It's completely all over the place and has no idea where I actually am…

shstiger2009

2012-08-20 11:00:45

From: P1ng
WriteLn(SPS_GetMyPos); returns with this…

(347, 543)
(275, 527)
(87, 763)
(83, 631)
(83, 631)
(79, 631)
(75, 647)
(79, 631)
(227, 539)
(243, 531)
(243, 539)

It's completely all over the place and has no idea where I actually am…


Make a custom map then and see what happens. It will probably me much more accurate! :)

Joe

2012-08-20 11:01:57

From: P1ng
In the mining guild so there is just an insane number of rocks and that's it. :(


So then do some henges too… and having a lot of rocks ODTMd would be pretty accurate, no? I wouldn't doubt the power of ODTM :p

John

2012-08-20 19:38:10

I'll Make you a custom map and I'll send you my Procedure of how I use SPS to Find what area I'm In. Just as soon as school finishes :P