NKN
2012-04-22 21:15:23
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?
2012-04-22 21:15:23
2012-04-22 22:37:37
2012-04-22 23:05:22
2012-04-23 00:00:21
2012-04-23 00:33:53
From: Brotein
This link might have some info about those ODTMs that could help you,
http://villavu.com/forum/showthread.php?p=891218
From: euphemism
Positioning, Location Checking, and Other Uses
Reserved, coming soon.
2012-04-23 03:06:01
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');2012-04-23 04:05:49
2012-04-23 06:39:05
2012-04-23 10:51:04
From: beginner5
Easier is to use SPS ,but it's low accuracy. Also you can use ODTM ,something like this:
-snip
or use TPAs to find borders of area (for example fence).
From: NKN
So no objects are needed to be clicked to make the polygon?
2012-04-23 15:57:31
2012-04-23 19:34:55
From: beginner5
Easier is to use SPS ,but it's low accuracy. Also you can use ODTM ,something like this: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).
(*******************************************************************************
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.
*******************************************************************************) 2012-04-23 19:40:43
2012-04-23 23:56:34
See how the area goes around the bank?ObjDTM_InArea(DTMToCheck: String; GroundLevel: Boolean): Boolean;How to use it?if not IsAtBank then
WalktoBank;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://-- 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;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.