Abu
04-02-2012, 05:56 PM
Hello and Welcome to my guide on using ObjectDTM's to walk in Runescape. No doubt euphenism has done a great job with his tutorial - yet for some reason I find users do not still grasp the concept of how to use ObjectDTM's properly and most importantly how to use them in scripts.
Before you continue with this tutorial, please make sure you understand how ObjectDTM's work and how to get the extension onto Simba: http://villavu.com/forum/showthread.php?p=847813
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Contents --
Getting it to Work
Creating an ObjectDTM
Walking to a single point
Walking a path
Defining Locations
Getting it to work
This will be the shortest section in this tutorial. To get ObjectDTM's to work simply put this at the start of your script(after you Define SMART and SRL):
{$i ObjectDTM\ObjDTMInclude.simba}
And then put this is your Mainloop(after you SetUpSRL):
ObjDTM_Setup
Simple enough.. I hope :p
Creating an ObjectDTM
Creating an ObjectDTM is really easy - in fact so easy you can make your own in under 10 seconds - literally. To make an Object DTM there are three things you have to do:
- Pick Minimap Objects
- Create a Main Point
- Make an Area
Ok so the first thing you want to do is open up the Object DTM Generation Tool. To do this, you must go to View -> Extensions Menu
Now you should get an ODTM drop-down menu. Click on it and select Generation Tool.
When this loads, you will be asked to Log In, also, you can comment out (//) SMART if you do not want to use it. Now, when the Form Opens, you can start to create your ObjectDTM :)
The first thing you want to do when the form loads is Grab the Minimap - all this does is get the current Minimap:
http://img269.imageshack.us/img269/5593/toolq.png
Once this is done, what you want to do is look at your Minimap and see what objects you can find. In my case - I can see Trees and NPC's. So what you want to do is scroll down the list and take a look at all the objects that you can select with the Tool, so because I can see Trees, I am going to select Trees. Then I am going to click on Gather Object which shows me which Trees the Tool can find. So lets do that:
http://img545.imageshack.us/img545/3730/gatherobject.png
So as you can see, the Trees that the Tool could find are highlighted with white circles. However, what you want to do now is pick which objects you want to use when creating your ObjectDTM, generally you only need 3 or 4. To select them, you simply click them and they will turn grean. To deselect them, you click on them again and they will turn red. After picking some objects, here's what your Minimap should now look like:
http://img69.imageshack.us/img69/4417/pickobjects.png
You are now done picking objects. The next thing you want to do is select where you want your player to walk - this is called the Main Point. By default, the point is where your player currently is, to change this, simply click where you want to move, like so:
http://img42.imageshack.us/img42/5682/mainpoint.png
And now you're done with that you select the area in which it will walk. Generally you want to keep this at a fairly small size. To make the area, you simply click the points where you want it to be and it will be drawn for you - you'll understand this better when you actually do it. Anyway, it should be something like this:
http://img823.imageshack.us/img823/8447/areani.png
So you're finally done! You're finished ObjectDTM should look something like this:
http://img27.imageshack.us/img27/6210/finishedone.png
Now press 'Print Object DTM' and you will get some code in the debug box which looks like this:
http://img259.imageshack.us/img259/6407/codeef.png
That there in the debug box is your Object DTM!! Read on to learn how you can use this little piece of code in scripts!
Walking to a single point
Ok so, if you want to walk to a single point then there are two function you will need:
function ObjDTM_Find(DTMToFind: String; out cx, cy: Integer; GroundLevel: Boolean): Boolean;
function ObjDTM_Walk(ObjDTMToWalk: String; FlagDistance, PollRate, Tries: Integer; GroundLevel: Boolean): Boolean;
What do they do?
- ObjDTM_Find: This finds you Object DTM. To fill it in you put in your ObjectDTM(the code from the debug box) followed by cx and cy. The GroundLevel means is the player at Ground Level. If yes then you write in True, if not then you write in false. So when filled in correctly, it should look like this:
ObjDTM_Find('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', cx, cy, True);
- ObjDTM_Walk: This walks to the ObjectDTM. To fill it in you put in your ObjectDTM followed by the distance you want your player to be from the flag before it results true. For PollRate put in the number of milliseconds you want it to wait before trying to walk it again(if it fails) and for Tries put in the number of times you want the function to try and walk to the ObjDTM. Finally, for GroundLevel, put in True if your player is at Ground Level and False if he isn't. If filled in correctly, it should look something like this:
ObjDTM_Walk('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', 2, 100, 5, True);
So the above function will try to walk to the Object DTM, if it fails, it will try again in 100 milliseconds for a maximum of five times. Once it reaches within 2 pixels from the flag, it will result true.
So, now you want to put this into one nice procedure.
procedure LetsWalk;
var
cx, cy: Integer;
begin
if ObjDTM_Find('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', cx, cy, True) then
begin
Writeln('We found it, now lets walk it!');
ObjDTM_Walk('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', 2, 100, 5, True);
end else
Writeln('We could not walk here, what a shame');
end;
Walking a path
Let's face it. There really aren't many scripts which require you to walk to a single point - what you really want to do is walk a long path. :stirthepot:
There are two ways of doing this:
- Creating a path with the tool [Not Recommended]
- Repeatedly using ObjDTM_Walk [Recommended]
The reason I do not recommend making paths with the tool is because they are usually very buggy and if you want to change a single Object DTM within a path - you have to reamke the whole path. However, if you make points close together in your full path - then it shouldn't really fail :)
Here's how to make a full path:
Open the Object DTM Generation Tool and select the Path menu, like so:
http://img841.imageshack.us/img841/6871/pathv.png
When this opens, you want to create your ObjectDTM as normal. However, instead of pressing Print Object DTM, select Add Path Node:
http://img109.imageshack.us/img109/2391/pathnode.png
Once you have done this, the form will close and the Tool will walk to the point for you and then like magic the form will open again! You can then make your next ObjectDTM and select Add Path Node. Again, it will close the form for you and walk to the point. Repeat this until you reach your destination, then simply press Finish Path. The tool will then close and you will get something like this in your Simba Debug Box:
Object DTM Generation Tool: Generated path:
['83:117:3:1:7:51:99:1:7:51:79:10:7:78:75:4:70:103: 71:127:94:125:100:101', '90:102:3:1:7:47:64:1:7:48:46:1:7:52:129:4:71:94:7 5:113:103:113:101:95', '88:132:3:1:7:43:112:10:7:64:123:10:7:60:115:4:77: 124:75:142:97:140:96:114']
Congratulations! You have just created a path. However, it's useless unless you now how to put it in your script. Fortunately, there is only one function you need to know to walk this long path:
function ObjDTM_WalkPath(Path: TStringArray; FlagDistance, PollRate, Tries: Integer; CheckEndPoints, GroundLevel: Boolean): Boolean;
Here's how to use it:
- ObjDTM_WalkPath: This walks the ObjectDTM Path. To fill it in you put in your ObjectDTM Path you just got in your Simba Debug Box followed by the distance you want your player to be from the flag before it results true. For PollRate put in the number of milliseconds you want it to wait before trying to walk it again(if it fails) and for Tries put in the number of times you want the function to try and walk to the ObjDTM. Then, for CheckEndPoints, put in True if you want it to check whether it is or isn't in the Area you wanted it to finish in. Finally, for GroundLevel, put in True if your player is at Ground Level and False if he isn't. If filled in correctly, your whole procedure should then look something like this:
procedure WalkPath;
begin
ObjDTM_WalkPath(['78:83:14:1:7:45:95:10:7:66:91:10:7:65:71:10:7:65: 79:10:7:65:63:10:7:65:54:10:7:65:46:10:7:109:41:10 :7:109:58:10:7:109:49:10:7:110:66:10:7:110:74:10:7 :110:82:0:7:79:39'
,'32:121:3:1:7:49:95:10:7:69:91:1:7:33:50',
'48:121:5:1:7:98:55:1:7:66:94:1:7:78:115:1:7:57:13 0:1:7:41:111',
'13:72:8:1:7:90:86:1:7:74:91:1:7:74:107:1:7:90:111 :1:7:106:108:1:7:102:120:1:7:62:79:1:7:74:67',
'37:107:7:1:7:82:71:1:7:62:75:1:7:46:71:1:7:42:91: 1:7:58:107:1:7:46:115:1:7:58:127',
'59:108:8:1:7:82:91:1:7:98:90:1:7:110:102:1:7:110: 118:1:7:35:75:1:7:40:126:1:7:79:133:1:7:94:67'], 0, 100, 5, True, True);
end;
The alternative method is very simple, for each ObjectDTM you make, put it in a ObjDTM_Walk function. If you choose this method, then the path should look something like this:
procedure WalkPath;
begin
ObjDTM_Walk('57:112:6:10:7:39:75:10:7:39:66:10:7:3 9: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);
Wait(500);
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:1 04:66:80', 0, 100, 80, True);
Wait(500);
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);
Wait(500);
ObjDTM_Walk('26:107:4:1:7:70:99:1:7:94:82:1:7:58:1 11:1:7:106:103:5:13:91:19:122:47:122:54:106:43:80' , 0, 100, 80, True);
Wait(500);
ObjDTM_Walk('40:116:5:1:7:66:63:1:7:46:67:1:7:42:9 9:1:7:114:83:5:7:57:46:5:24:100:27:132:56:132:64:9 9:50:81', 0, 100, 80, True);
Wait(500);
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);
end;
The advantages of this method is simple - if one ObjectDTM fails - you can easily change it without having to remake the entire path. You can also then add back-up walking methods (such as RadialWalk) for each Path. That way the chances of the path failing is virtually nil.
Disadvantages? Well, it looks ugly doesn't it...
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:
http://img189.imageshack.us/img189/1036/areadefine.png
See how the area goes around the bank?
To define a location, there is only one function you need to know:
ObjDTM_InArea(DTMToCheck: String; GroundLevel: Boolean): Boolean;
How to use it?
- 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:
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:3 9: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);
Wait(500);
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:1 04:66:80', 0, 100, 80, True);
Wait(500);
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);
Wait(500);
ObjDTM_Walk('26:107:4:1:7:70:99:1:7:94:82:1:7:58:1 11:1:7:106:103:5:13:91:19:122:47:122:54:106:43:80' , 0, 100, 80, True);
Wait(500);
ObjDTM_Walk('40:116:5:1:7:66:63:1:7:46:67:1:7:42:9 9:1:7:114:83:5:7:57:46:5:24:100:27:132:56:132:64:9 9:50:81', 0, 100, 80, True);
Wait(500);
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.
So boys and girls, that is how you use ObjectDTM's for walking. I hope you enjoyed reading this guide and if you have any issues or problems, please let me know! :)
Special Thanks To:
euphenism - for making Object DTM's of course silly!
Before you continue with this tutorial, please make sure you understand how ObjectDTM's work and how to get the extension onto Simba: http://villavu.com/forum/showthread.php?p=847813
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- Contents --
Getting it to Work
Creating an ObjectDTM
Walking to a single point
Walking a path
Defining Locations
Getting it to work
This will be the shortest section in this tutorial. To get ObjectDTM's to work simply put this at the start of your script(after you Define SMART and SRL):
{$i ObjectDTM\ObjDTMInclude.simba}
And then put this is your Mainloop(after you SetUpSRL):
ObjDTM_Setup
Simple enough.. I hope :p
Creating an ObjectDTM
Creating an ObjectDTM is really easy - in fact so easy you can make your own in under 10 seconds - literally. To make an Object DTM there are three things you have to do:
- Pick Minimap Objects
- Create a Main Point
- Make an Area
Ok so the first thing you want to do is open up the Object DTM Generation Tool. To do this, you must go to View -> Extensions Menu
Now you should get an ODTM drop-down menu. Click on it and select Generation Tool.
When this loads, you will be asked to Log In, also, you can comment out (//) SMART if you do not want to use it. Now, when the Form Opens, you can start to create your ObjectDTM :)
The first thing you want to do when the form loads is Grab the Minimap - all this does is get the current Minimap:
http://img269.imageshack.us/img269/5593/toolq.png
Once this is done, what you want to do is look at your Minimap and see what objects you can find. In my case - I can see Trees and NPC's. So what you want to do is scroll down the list and take a look at all the objects that you can select with the Tool, so because I can see Trees, I am going to select Trees. Then I am going to click on Gather Object which shows me which Trees the Tool can find. So lets do that:
http://img545.imageshack.us/img545/3730/gatherobject.png
So as you can see, the Trees that the Tool could find are highlighted with white circles. However, what you want to do now is pick which objects you want to use when creating your ObjectDTM, generally you only need 3 or 4. To select them, you simply click them and they will turn grean. To deselect them, you click on them again and they will turn red. After picking some objects, here's what your Minimap should now look like:
http://img69.imageshack.us/img69/4417/pickobjects.png
You are now done picking objects. The next thing you want to do is select where you want your player to walk - this is called the Main Point. By default, the point is where your player currently is, to change this, simply click where you want to move, like so:
http://img42.imageshack.us/img42/5682/mainpoint.png
And now you're done with that you select the area in which it will walk. Generally you want to keep this at a fairly small size. To make the area, you simply click the points where you want it to be and it will be drawn for you - you'll understand this better when you actually do it. Anyway, it should be something like this:
http://img823.imageshack.us/img823/8447/areani.png
So you're finally done! You're finished ObjectDTM should look something like this:
http://img27.imageshack.us/img27/6210/finishedone.png
Now press 'Print Object DTM' and you will get some code in the debug box which looks like this:
http://img259.imageshack.us/img259/6407/codeef.png
That there in the debug box is your Object DTM!! Read on to learn how you can use this little piece of code in scripts!
Walking to a single point
Ok so, if you want to walk to a single point then there are two function you will need:
function ObjDTM_Find(DTMToFind: String; out cx, cy: Integer; GroundLevel: Boolean): Boolean;
function ObjDTM_Walk(ObjDTMToWalk: String; FlagDistance, PollRate, Tries: Integer; GroundLevel: Boolean): Boolean;
What do they do?
- ObjDTM_Find: This finds you Object DTM. To fill it in you put in your ObjectDTM(the code from the debug box) followed by cx and cy. The GroundLevel means is the player at Ground Level. If yes then you write in True, if not then you write in false. So when filled in correctly, it should look like this:
ObjDTM_Find('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', cx, cy, True);
- ObjDTM_Walk: This walks to the ObjectDTM. To fill it in you put in your ObjectDTM followed by the distance you want your player to be from the flag before it results true. For PollRate put in the number of milliseconds you want it to wait before trying to walk it again(if it fails) and for Tries put in the number of times you want the function to try and walk to the ObjDTM. Finally, for GroundLevel, put in True if your player is at Ground Level and False if he isn't. If filled in correctly, it should look something like this:
ObjDTM_Walk('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', 2, 100, 5, True);
So the above function will try to walk to the Object DTM, if it fails, it will try again in 100 milliseconds for a maximum of five times. Once it reaches within 2 pixels from the flag, it will result true.
So, now you want to put this into one nice procedure.
procedure LetsWalk;
var
cx, cy: Integer;
begin
if ObjDTM_Find('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', cx, cy, True) then
begin
Writeln('We found it, now lets walk it!');
ObjDTM_Walk('86:106:3:1:7:50:80:1:7:50:98:1:7:59:5 2:4:67:88:66:114:99:119:100:82', 2, 100, 5, True);
end else
Writeln('We could not walk here, what a shame');
end;
Walking a path
Let's face it. There really aren't many scripts which require you to walk to a single point - what you really want to do is walk a long path. :stirthepot:
There are two ways of doing this:
- Creating a path with the tool [Not Recommended]
- Repeatedly using ObjDTM_Walk [Recommended]
The reason I do not recommend making paths with the tool is because they are usually very buggy and if you want to change a single Object DTM within a path - you have to reamke the whole path. However, if you make points close together in your full path - then it shouldn't really fail :)
Here's how to make a full path:
Open the Object DTM Generation Tool and select the Path menu, like so:
http://img841.imageshack.us/img841/6871/pathv.png
When this opens, you want to create your ObjectDTM as normal. However, instead of pressing Print Object DTM, select Add Path Node:
http://img109.imageshack.us/img109/2391/pathnode.png
Once you have done this, the form will close and the Tool will walk to the point for you and then like magic the form will open again! You can then make your next ObjectDTM and select Add Path Node. Again, it will close the form for you and walk to the point. Repeat this until you reach your destination, then simply press Finish Path. The tool will then close and you will get something like this in your Simba Debug Box:
Object DTM Generation Tool: Generated path:
['83:117:3:1:7:51:99:1:7:51:79:10:7:78:75:4:70:103: 71:127:94:125:100:101', '90:102:3:1:7:47:64:1:7:48:46:1:7:52:129:4:71:94:7 5:113:103:113:101:95', '88:132:3:1:7:43:112:10:7:64:123:10:7:60:115:4:77: 124:75:142:97:140:96:114']
Congratulations! You have just created a path. However, it's useless unless you now how to put it in your script. Fortunately, there is only one function you need to know to walk this long path:
function ObjDTM_WalkPath(Path: TStringArray; FlagDistance, PollRate, Tries: Integer; CheckEndPoints, GroundLevel: Boolean): Boolean;
Here's how to use it:
- ObjDTM_WalkPath: This walks the ObjectDTM Path. To fill it in you put in your ObjectDTM Path you just got in your Simba Debug Box followed by the distance you want your player to be from the flag before it results true. For PollRate put in the number of milliseconds you want it to wait before trying to walk it again(if it fails) and for Tries put in the number of times you want the function to try and walk to the ObjDTM. Then, for CheckEndPoints, put in True if you want it to check whether it is or isn't in the Area you wanted it to finish in. Finally, for GroundLevel, put in True if your player is at Ground Level and False if he isn't. If filled in correctly, your whole procedure should then look something like this:
procedure WalkPath;
begin
ObjDTM_WalkPath(['78:83:14:1:7:45:95:10:7:66:91:10:7:65:71:10:7:65: 79:10:7:65:63:10:7:65:54:10:7:65:46:10:7:109:41:10 :7:109:58:10:7:109:49:10:7:110:66:10:7:110:74:10:7 :110:82:0:7:79:39'
,'32:121:3:1:7:49:95:10:7:69:91:1:7:33:50',
'48:121:5:1:7:98:55:1:7:66:94:1:7:78:115:1:7:57:13 0:1:7:41:111',
'13:72:8:1:7:90:86:1:7:74:91:1:7:74:107:1:7:90:111 :1:7:106:108:1:7:102:120:1:7:62:79:1:7:74:67',
'37:107:7:1:7:82:71:1:7:62:75:1:7:46:71:1:7:42:91: 1:7:58:107:1:7:46:115:1:7:58:127',
'59:108:8:1:7:82:91:1:7:98:90:1:7:110:102:1:7:110: 118:1:7:35:75:1:7:40:126:1:7:79:133:1:7:94:67'], 0, 100, 5, True, True);
end;
The alternative method is very simple, for each ObjectDTM you make, put it in a ObjDTM_Walk function. If you choose this method, then the path should look something like this:
procedure WalkPath;
begin
ObjDTM_Walk('57:112:6:10:7:39:75:10:7:39:66:10:7:3 9: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);
Wait(500);
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:1 04:66:80', 0, 100, 80, True);
Wait(500);
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);
Wait(500);
ObjDTM_Walk('26:107:4:1:7:70:99:1:7:94:82:1:7:58:1 11:1:7:106:103:5:13:91:19:122:47:122:54:106:43:80' , 0, 100, 80, True);
Wait(500);
ObjDTM_Walk('40:116:5:1:7:66:63:1:7:46:67:1:7:42:9 9:1:7:114:83:5:7:57:46:5:24:100:27:132:56:132:64:9 9:50:81', 0, 100, 80, True);
Wait(500);
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);
end;
The advantages of this method is simple - if one ObjectDTM fails - you can easily change it without having to remake the entire path. You can also then add back-up walking methods (such as RadialWalk) for each Path. That way the chances of the path failing is virtually nil.
Disadvantages? Well, it looks ugly doesn't it...
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:
http://img189.imageshack.us/img189/1036/areadefine.png
See how the area goes around the bank?
To define a location, there is only one function you need to know:
ObjDTM_InArea(DTMToCheck: String; GroundLevel: Boolean): Boolean;
How to use it?
- 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:
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:3 9: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);
Wait(500);
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:1 04:66:80', 0, 100, 80, True);
Wait(500);
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);
Wait(500);
ObjDTM_Walk('26:107:4:1:7:70:99:1:7:94:82:1:7:58:1 11:1:7:106:103:5:13:91:19:122:47:122:54:106:43:80' , 0, 100, 80, True);
Wait(500);
ObjDTM_Walk('40:116:5:1:7:66:63:1:7:46:67:1:7:42:9 9:1:7:114:83:5:7:57:46:5:24:100:27:132:56:132:64:9 9:50:81', 0, 100, 80, True);
Wait(500);
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.
So boys and girls, that is how you use ObjectDTM's for walking. I hope you enjoyed reading this guide and if you have any issues or problems, please let me know! :)
Special Thanks To:
euphenism - for making Object DTM's of course silly!