Alright, for my next script, I need an area, and if it strays from that area, to return to it. Could I use SPS to accomplish this or what?
Alright, for my next script, I need an area, and if it strays from that area, to return to it. Could I use SPS to accomplish this or what?
ODTM would be your best bet for this since you can set a polygon area and use ObjDTM_InArea to remain in it abu_jwka has a nice tut on it
Current Project: Retired
^^ That and I think you can use a DTM as well think its called an anchor or something like that.
This link might have some info about those ODTMs that could help you,
http://villavu.com/forum/showthread.php?p=891218
Simply a GOD beast...
My Tutorials
Easier is to use SPS ,but it's low accuracy. Also you can use ODTM ,something like this:
Simba Code:if not(ObjDTM_find(ODTM,x,y,True)) then
begin
writeln('Cannot find position');
end else
if ((x>MMCX-30)and(x<MMCX+30)and(y>MMCY-30)and(y<MMCX+30)) then
writeln('You are in area')
else
writeln('You are not in area');
or use TPAs to find borders of area (for example fence).
http://villavu.com/forum/showthread.php?t=78905
If you read through Abu's tutorial on Object DTMs near the end he talks about areas. I think that would be the easiest. I almost always use object dtm areas as part of my fail safes when walking.
So no objects are needed to be clicked to make the polygon?
You can define an area for an Object DTM that exactly matches the contours of a fence and call 'ObjDTM_InArea' to check if your character is within it.
You need objects to make the Object DTM, but the vertices of the area polygon do not need to be objects. I will attempt to fill out the third section of my tutorial in the next few days.
[10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts
So in order to have it check for in area, I have to have objects. Hrmmm.....
Or just use
Simba Code:(*******************************************************************************
function ObjDTM_InArea(DTMToCheck: String; GroundLevel: Boolean): Boolean;
By: euphemism
Last Edit: 19 Dec 2011 -- euphemism
Description: Calls 'ObjDTM_InAreaEx', uses the area of 'DTMToCheck' to
see if the player is within the area. Because the area is
specified by a concave/convex polygon, it can be tailored to
fit a very specific area. Returns true if the player is
within the area.
*******************************************************************************)
![]()
Testing ObjDTM_InArea right now.
Taken from my tutorial and edited:
Defining Locations
You're probably wondering what I mean by this. Basically - it's marking out a location - such as a Bank, Altar or a Shop. To define a location you simply make an ObjectDTM as normal - but give it a much larger area which goes around your location. For example, here is how you would make an ObjectDTM to define the location of the Varrock West Bank:
See how the area goes around the bank?
To define a location, there is only one function you need to know:
How to use it?Simba Code:ObjDTM_InArea(DTMToCheck: String; GroundLevel: Boolean): Boolean;
- ObjDTM_InArea: Simply put in your ObjectDTM followed by True if it is a Ground Level of False if it isn't.
What use is defining locations? Well simple, I could name the area of the bank 'IsAtBank' and then use it as a failsafe such as:
You could also put this location at the end of paths as the result, thus chaning the paths from procedures into functions. Here is a smaller example from a really old version of script of mine on how this works:Simba Code:if not IsAtBank then
WalktoBank;
I could also place it at the start of a function. So if I wanted to walk from the bank to somewhere else, I could put: if not IsAtBank then Exit; that way if the player isn't at the bank to start the path, it will exit the function.Simba Code://-- Bank Location --\\
function IsAtBank: Boolean;
begin
Result := ObjDTM_InArea('80:80:7:10:7:58:75:10:7:101:55:10:7:101:47:10:7:58:59:10:7:58:51:10:7:58:67:10:7:101:63:4:58:25:60:99:104:98:101:25', True);
end;
//-- WalkToBank --\\
function WalkToBank: Boolean;
begin
Antiban;
ObjDTM_Walk('57:112:6:10:7:39:75:10:7:39:66:10:7:39:57:10:7:88:53:10:7:88:44:10:7:39:97:4:40:104:42:119:95:118:95:104', 0, 100, 80, True);
ObjDTM_Walk('37:95:5:10:7:54:70:10:7:54:58:1:7:34:76:10:7:98:32:10:7:99:24:5:43:78:11:78:15:105:56:104:66:80', 0, 100, 80, True);
ObjDTM_Walk('34:103:5:1:7:78:63:1:7:47:102:10:7:97:59:10:7:97:47:10:7:97:40:4:18:90:23:124:57:108:57:78', 0, 100, 80, True);
ObjDTM_Walk('26:107:4:1:7:70:99:1:7:94:82:1:7:58:111:1:7:106:103:5:13:91:19:122:47:122:54:106:43:80', 0, 100, 80, True);
ObjDTM_Walk('40:116:5:1:7:66:63:1:7:46:67:1:7:42:99:1:7:114:83:5:7:57:46:5:24:100:27:132:56:132:64:99:50:81', 0, 100, 80, True);
ObjDTM_Walk('80:80:2:1:7:91:103:3:7:101:83:4:74:77:73:98:92:97:91:77', 0, 100, 80, True);
Result := IsAtBank; //here's where I've used it!!!
end;
Simply a GOD beast...
My Tutorials
There are currently 1 users browsing this thread. (0 members and 1 guests)