Log in

View Full Version : Making sure you are in the correct area



Footy
08-06-2012, 09:35 PM
Is there a way to make sure you are in the correct area, e.g. an area of tree's, and if you arent, move back to the correct area?
Footy

Le Jingle
08-06-2012, 09:41 PM
You could use objDTM's, as well as custom TPA's func's. +DDTMs

Etrnl Fear
08-06-2012, 09:42 PM
Most people use Object DTMs to check if they are in a specified area. A thread on installing it can be found here (http://villavu.com/forum/showthread.php?t=68112&highlight=dtm+guide).

Alternatively, you could make a simple DTM of a portion on the minimap that will be visible at the location and have it check to see if the rotated DTM exists. Rotated, because likely, the compass won't be set to a perfect north at all times, especially after a 'movecompass' antiban.

riwu
08-06-2012, 09:52 PM
Easiest way would be to use SPS_GetMyPos, and it's much easier to walk back with SPS too.

NKN
08-06-2012, 10:21 PM
Get a box using SPS Points, if SPS_GetMyPos isn't in that box, walk back

Nebula
08-06-2012, 10:27 PM
Yes SPS_GetMyPos + PointInBox would work nice. But there might be a "better" way, post a screenshot of it.

CephaXz
08-06-2012, 10:44 PM
I made and used this in my wildy agi script.


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;

Footy
08-06-2012, 10:59 PM
Thanks for all the replies guys! Im probably going to try this SPS method. Gonna play around with it for a bit, and Ill let you guys know how it goes.

Etrnl Fear
08-06-2012, 11:02 PM
Best of luck. :)

Just something to add; I find lodestones to be very useful when walking back to an area. Especially in a case where a failed random event has teleported you away. Of course, this would be irrelevent if the account has not unlocked the specified lodestone.

Footy
08-06-2012, 11:06 PM
Something to add, lets say My character finds himself out the top left section of this area I need him to be in. What if the first SPS point I need him to walk to isnt visable, what will he do? I could do a ring tele, as that would be most relevent in this situation, but It would seem kind of botty if everytime i wander out of the area, I use my ring.

Nebula
08-06-2012, 11:08 PM
post a screenshot of it.

SPS will not work properly from time to time depending on the circumstances (eg. minimap flooded with players + monsters etc). And when that happens, your script will literally die. SPS will return point (-1, -1). Your script will say "oh, we are not in the box!" so your clever failsafe will try walking back. But you are already there; so SPS will return (-1, -1) over and over again every single time you call your procedure.

E: Just tell us the circumstances. What are you trying to script? +screenshot.

Footy
08-06-2012, 11:12 PM
I assume you mean the area I will be in? its the area around daemonheim containing maple trees in f2p. My account is fletching atm, i can post a screeny of minimap and world map in a few minutes

Etrnl Fear
08-06-2012, 11:16 PM
Something to add, lets say My character finds himself out the top left section of this area I need him to be in. What if the first SPS point I need him to walk to isnt visable, what will he do? I could do a ring tele, as that would be most relevent in this situation, but It would seem kind of botty if everytime i wander out of the area, I use my ring.

I would say use something along the lines of a simple radial or linear walk, if the distance of SPS_GetMyPos is less than 50 x and y from the first point until it sees that point.

I haven't looked much into SPS, but a good alternative would be to add a few fail safes to make sure the script doesn't make you wonder too far off track.

putonajonny
08-06-2012, 11:25 PM
If you use SPS_BlindWalk you can walk to points not visable on the minimap (it will click multiple times)

Footy
08-06-2012, 11:26 PM
Yeah, ill just have to get it to check if its nearing the edge of the area, and If so, move closer to the centre. Im testing out some SPS stuff, never used it before. Im trying to get simba to output my SPS position, thats all, just to see what the format of it is, but I keep getting errors, 3 different errors so far. Can someone tell me why this wont work?
program SPSTesting;
{$i srl/srl.simba}
{$i sps/sps.simba}
begin
SetupSRL
sps_getmypos;
end.

E:

If you use SPS_BlindWalk you can walk to points not visable on the minimap (it will click multiple times)
This could be helpful!

Nebula
08-06-2012, 11:29 PM
You need to call SPS_Setup and writeln(SPS_GetMyPos). Check out mat's SPS tutorial.

Post the screenshots......

Footy
08-06-2012, 11:36 PM
I would post the screenies, but I dont have a sufficient dung. level to get into the resorce dungeon... Ill look up mats SPS guide, thanks!

CephaXz
08-07-2012, 04:47 AM
procedure getmyposition;
var
P: TPoint;
begin
P := SPS_GetMyPos;
writeln('Point'+ToStr(P));
end;


I used this to check my position, and repeat it in the main loop. Of course you will need to setup SPS first before repeating the loop. And just need to disable and enable SMART to walk to another point. You would just need to copy and paste the TPoints from the debug since it has 'Point' in front of the coordinates already.

Footy
08-07-2012, 03:13 PM
procedure getmyposition;
var
P: TPoint;
begin
P := SPS_GetMyPos;
writeln('Point'+ToStr(P));
end;


I used this to check my position, and repeat it in the main loop. Of course you will need to setup SPS first before repeating the loop. And just need to disable and enable SMART to walk to another point. You would just need to copy and paste the TPoints from the debug since it has 'Point' in front of the coordinates already.

This is useful! Thanks for the help guys! I think i figured it all out, everything seems to be working!

litoris
08-07-2012, 05:30 PM
My miner uses DTM's on the minimap to determine if it is at a designated area. Works better than ODTM when there are lots of signs moving around(2 mining icons in my case)