PDA

View Full Version : Object DTMs: A Comprehensive Set of Tutorials



euphemism
01-13-2012, 05:14 AM
A Comprehensive Set of Tutorials For
-Object DTMs-
-A walking and positioning system-



Introduction and Generation


The Object DTM Include is an include file developed to offer an easy and accurate way to walk and position your Runescape character.

Please direct yourself here (http://villavu.com/forum/showthread.php?p=847813) to read what it's all about, and how to get it installed before proceeding.
-----------------------------

First Post Contents:

What Is An Object DTM?
.
How to Setup Your Script With the Include
.
How to Generate an Object DTM
-How to Start the Generation Tool
-A quick overview of the buttons and tabs
.
How to Generate a Single Object DTM
-A few notes on creating Object DTMs
.
How to Generate a Multi-Object DTM
.
How to Generate a Path
-A few notes on Object DTMs for paths
.
How to Generate a Multi-Path



-What Is An Object DTM?-

An Object DTM is a set of sub-points anchored to a main-point, with an optional defined area polygon. The sub-points are objects found on the minimap, such as:


http://puu.sh/dSeo

Here is a screenshot showing an Object DTM being debugged on-screen:


http://puu.sh/deuZ

The green circles indicate sub-points. This particular Object DTM has two trees, and two ladders as sub-points. The red polygon is the defined area polygon that is a part of this particular Object DTM. If this Object DTM is found on the minimap, the position of the area polygon will be immediately known, relative to the Object DTM. This means that you can define an Object DTM for specific areas, and easily know if you are in the area.
-----------------------------


-How to Setup Your Script With the Include-

I am going to assume you have followed the link at the top of this post, and have gotten the updater extension installed, and have successfully downloaded the latest version of the include.

The first thing you need to do, is add an include statement to the top of your script. An example set of include statements would be:


program Script;
{$DEFINE SMART}
{$i SRL\SRL.simba}
{$i ObjectDTM\ObjDTMInclude.simba}



The Object DTM Include will automatically include the PaintSmart file, used to paint on the SMART canvas. If for some reason you want it included in your script anyway, your include statements will have to look like this:


program Script;
{$DEFINE SMART}
{$DEFINE PAINT}
{$i SRL\SRL.simba}
{$i SRL\SRL\Misc\PaintSmart.simba}
{$i ObjectDTM\ObjDTMInclude.simba}


Before any methods from the include are used, the setup procedure needs to be called. A good practice is calling it right after you call 'SetupSRL' in your script. A barebones script setup showing how to properly include and setup the Object DTM Include is:


program Script;
{$DEFINE SMART}
{$i SRL\SRL.simba}
{$i ObjectDTM\ObjDTMInclude.simba}

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Member := True;
Players[0].Active := True;
Players[0].Pin := '';
end;

begin

Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;

ClearDebug;

SetupSRL;
ObjDTM_Setup;

DeclarePlayers;

if (not LoggedIn) then
LoginPlayer;
end.


That is all there is to getting the include ready to use with a script.
-----------------------------


-How to Generate an Object DTM-



-How to Start the Generation Tool-

The first step is to open up the Object DTM Generation Tool:

http://puu.sh/dYcI

After clicking "Generation Tool" the tool's script file should automatically open and run.
At this point, you can stop it, and comment out {$DEFINE SMART} if you would rather not use the tool with SMART.

Once Runescape has finished loading, you need to enter your username and password and login. Run the tool's script after logging in, and you will be presented with this:

http://puu.sh/dXHo

A quick overview of the buttons and tabs:
------------------------
'Single' tab: This tab contains all the components of the tool that are needed to generate single Object DTMs.
------------
Contained within the tab:


The minimap area: This area is where the minimap is displayed, and where you interact to create your Object DTMs.

Instructions box: This field displays instructions relevant to the current open tab in order to assist the creation process.

Output box: Below the instruction box, this box is where printed Object DTM strings appear.

'Grab Minimap': This button grabs the current view of the minimap, and shows it on the minimap area.

'Clear Minimap': This button clears any paint off of the minimap area in case you need a better view.

'Delete ODTM': This button deletes the current Object DTM in memory if you want to start over.

'Print Object DTM': This button prints out the string form of the Object DTM in the output box, and in Simba's debug box.

'Print Record' check box: If checked, this prints the record form, along with the string form of the Object DTM, in Simba's debug box.

------------
Properties panel: This is the panel on the form with the tabs 'Sub-points', 'Main-point', and 'Area'. This panel contains all the tool components for editing and modifying an Object DTM.
------------


------------------------
'Sub-Points' tab: This tab contains a list of all viable minimap objects, and a button to gather them. You can only interact with sub-points on the minimap area when this tab is active.
------------
Contained within the tab:


Objects list: Scroll through the list, and click on an object type in preparation of gathering the selected object.

'Gather Object': When clicked, this button finds the selected object in the objects list on the minimap, and paints white circles around all found instances.

------------


------------------------
'Main-Point' tab: This tab contains the current coordinates of the main-point, and a button to reset the point to the center. You can only modify the main-point when this tab is active.
------------
Contained within the tab:


Main-point Coordinates: Displays current X and Y of the main-point.

'Reset Main-point': When clicked, this button resets the main-point to the center of the minimap.

------------


------------------------
'Area' tab: This tab contains the current view of the area polygon of the Object DTM, and buttons to delete the area, or remove the last added point.
------------
Contained within the tab:


'Delete Area': When clicked, this button completely removes the area polygon from the Object DTM in memory.

'Undo Last Point': When clicked, this button removes the last point of the area polygon.

------------------------


'Multi' tab: Nothing to see here!


------------------------
'Path' tab: This tab contains all the components of the tool that are needed to generate Object DTM paths.
------------
Contained within the tab:

Everything the 'Single' tab has, with the following additions:

'Add Path Node': This button, when clicked, adds the current Object DTM in memory to the stored path, closes the form, and walks to it. After walking, the form opens up again, grabs the new view of the minimap, and waits for input.

'Finish Path': This button, when clicked, closes the form, stops the tool, and prints out the stored path as a string array in Simba's debug box.

------------------------


'Multi-path' tab: Nothing to see here!


------------------------
-How to Generate a single Object DTM-

Now that you somewhat understand how the interface works, I will walk you through the generation of an Object DTM.

A few notes on creating Object DTMs:


It is preferable that you pick sub-points closer to the center of the minimap.
Try to choose sub-points that are far from symbols, as symbols can drift over the objects, making your Object DTM fail.
3-5 sub-points is usually enough, unless you are in an area with many of the same object. In these cases, if you have too few sub-points, or not enough variety in your chosen objects, there is a chance that false positives will be found, causing an incorrect point to be returned.


Clicking 'Grab Minimap' will grab the current view of the minimap and display it on the minimap area:

http://puu.sh/dY4e

You should click this button before you start making an Object DTM, but not during, as the minimap may shift, and you don't want that to happen while you are in the process of editing.
-
Select an object from the objects list, and click 'Gather Object'. In this example, I have chosen trees:

http://puu.sh/dY5U

Clicking within the circles will add that object as a sub-point and turn the circle green. Clicking again will remove the sub-point, and turn the circle red. I selected a few trees, then picked boulders from the objects list, clicked 'Gather Object' and selected one of them:

http://puu.sh/dY65

-
Moving over to the 'Main-point' tab, you can see that the main-point defaults to the center of the minimap:

http://puu.sh/dY6j

-
With the 'Main-point' tab active, mousing over the minimap area will cause yellow lines to be drawn to your mouse cursor:

http://puu.sh/dY6z

These lines connect the sub-points to your mouse, showing where the prospective main-point is.
-
Clicking will set the new main-point:

http://puu.sh/dY6S
-
Moving on to the 'Area' tab, this is where you can define an area polygon for the Object DTM. Clicking on the minimap area with this tab active will add points, and the polygon will be dynamically drawn as you do this:

http://puu.sh/dYwW

Clicking 'Delete Area' will completely remove the area, and clicking 'Undo Last Point' will remove the last vertex in the polygon, you can undo as many times as there are vertices.
-
The resulting Object DTM looks like this:

http://puu.sh/dY7z

Clicking 'Print Object DTM' prints it out into the output box, and Simba's debug box. The record form will also be printed in Simba's debug box if 'Print Record' is checked. Here is the resulting code:


Object DTM string converted to record form:

-------------------------------------------

with ObjectDTM do
begin

MainPoint.x := 33;
MainPoint.y := 71;

NumOfPoints := 6;
SetLength(SubPoints, NumOfPoints);

SubPoints[0].Base := MM_TREE;
SubPoints[0].Drift :=7;
SubPoints[0].Point.x := 108;
SubPoints[0].Point.y := 45;

SubPoints[1].Base := MM_TREE;
SubPoints[1].Drift :=7;
SubPoints[1].Point.x := 108;
SubPoints[1].Point.y := 75;

SubPoints[2].Base := MM_TREE;
SubPoints[2].Drift :=7;
SubPoints[2].Point.x := 61;
SubPoints[2].Point.y := 124;

SubPoints[3].Base := MM_TREE;
SubPoints[3].Drift :=7;
SubPoints[3].Point.x := 108;
SubPoints[3].Point.y := 113;

SubPoints[4].Base := MM_TREE;
SubPoints[4].Drift :=7;
SubPoints[4].Point.x := 57;
SubPoints[4].Point.y := 49;

SubPoints[5].Base := MM_BOULDER;
SubPoints[5].Drift :=7;
SubPoints[5].Point.x := 128;
SubPoints[5].Point.y := 49;

NumOfAreaPoints := 6;
SetLength(Area, NumOfAreaPoints);

Area[0].x := 82;
Area[0].y := 74;

Area[1].x := 82;
Area[1].y := 114;

Area[2].x := 70;
Area[2].y := 134;

Area[3].x := 41;
Area[3].y := 134;

Area[4].x := 41;
Area[4].y := 57;

Area[5].x := 68;
Area[5].y := 58;
end;

'33:71:6:1:7:108:45:1:7:108:75:1:7:61:124:1:7:108: 113:1:7:57:49:5:7:128:49:6:82:74:82:114:70:134:41: 134:41:57:68:58'

-----------------------------
-How to Generate a Multi-Object DTM-
Come back another time!
-----------------------------
-How to Generate a Path-

Generating a path is much like generating a single Object DTM. Please reference how to generate a single Object DTM before looking here.

A few notes on Object DTMs for paths:


It is preferable that you pick sub-points closer to the center of the minimap.
It is also preferable that your main-point be at least 10px away from the edge of the minimap.
3-5 sub-points is usually enough, unless you are in an area with many of the same object. In these cases, if you have too few sub-points, or not enough variety in your chosen objects, there is a chance that false positives will be found, causing your character to walk away from the intended destination.


If you stick to these three guidelines, your paths will be more stable than they may otherwise be.


Click over to the 'Path' tab to begin making a path. A path is made up of nodes, and each node is an Object DTM. So, for each node you walk to, you need an Object DTM.

Make the first node the same way you make an Object DTM. When you are done, click 'Add Path Node'.

The form will close, and your character will walk to the node. After walking, the form will open back up- ready for you to create the next node. When you are finished creating your path, click 'Finish Path'. That is really all there is to it.

http://puu.sh/dYBQ

The string array from the path above:


Object DTM Generation Tool: Generated path:

['64:17:5:1:7:91:53:1:7:109:47:1:7:128:72:1:7:123:9 3:1:7:44:116', '139:88:5:0:7:89:26:0:7:64:21:1:7:95:79:1:7:117:67 :1:7:92:63', '98:142:3:5:7:71:92:1:7:62:58:1:7:83:62', '27:58:2:5:7:80:105:0:7:27:70']

-----------------------------
-How to Generate a Multi-Path-
Come back another time!
-----------------------------

euphemism
01-13-2012, 05:15 AM
Finding and Walking

Please direct yourself here (http://villavu.com/forum/showthread.php?p=847813) to read what it's all about, and how to get it installed before proceeding.
-----------------------------

Second Post Contents:

Finding An Object DTM
.
Walking To An Object DTM
.
Walking a Path


-Finding An Object DTM-
-----------------------------
function ObjDTM_Find(DTMToFind: String; out cx, cy: Integer;
GroundLevel: Boolean): Boolean;
(************************************************* ******************************
function ObjDTM_Find(DTMToFind: String; var cx, cy: Integer;
GroundLevel: Boolean): Boolean;
By: euphemism
Last Edit: 26 Dec 2011 -- euphemism
Description: Finds the specified Object DTM, 'DTMToFind' on the minimap.
Results true if found, and the main point is passed via
reference through 'cx, and 'cy'.
************************************************** *****************************)

Pass your Object DTM through 'DTMToFind'. If your Object DTM is in record format, then pass ObjDTMToString(YourObjectDTM). 'cx' and 'cy' will return the main-point of the Object DTM if it is found. The parameter 'GroundLevel' is to help cut down false positives where the same objects exist on the ground floor of a building, and the next. A good rule of thumb for the 'GroundLevel' parameter is that if you see black on the minimap, set it to false. If found, the function will result true.
-----------------------------
-Walking To An Object DTM-
-----------------------------

function ObjDTM_Walk(ObjDTMToWalk: String; FlagDistance, PollRate,
Tries: Integer; GroundLevel: Boolean): Boolean;
(************************************************* ******************************
function ObjDTM_Walk(ObjDTMToWalk: String; FlagDistance, PollRate,
Tries: Integer; GroundLevel: Boolean): Boolean;
By: euphemism
Last Edit: 19 Dec 2011 -- euphemism
Description: Calls 'ObjDTM_Find' every x milliseconds specified by 'PollRate'
a maximum of x tries, specified by 'Tries' to find the
Object DTM 'ObjDTMToWalk'. If found, Waits for the flag to
be a distance x from the player, where x is 'FlagDistance'.
If the Object DTM is found, and the function has maxed out
the tries, but the main-point is off the minimap, the
function will click the closest available point. Returns true
if the Object DTM was found, and it clicked to walk.
************************************************** *****************************)


The parameters for this function seem to be giving some people problems. 'ObjDTMToWalk' is the Object DTM the function will attempt to walk to. As before, if it is in record format, pass it with ObjDTMToString(YourObjectDTM).

If the Object DTM is found, and is clicked, 'FlagDistance' is the distance in pixels from the flag the function should wait to be before exiting and returning true.

If the Object DTM is not found, 'PollRate' is how long to wait before trying to find the Object DTM again.

'Tries' is the maximum number of times the function will try to find the Object DTM before resulting false.

So, 'Tries' multiplied by 'PollRate' will give you the maximum amount of time in seconds the function will try to find the Object DTM. In my scripts, I use ObjDTM_Walk(Object DTM, 0, 100, 80). This is because a pollrate of 100 milliseconds is fast enough to not hiccup, but isn't overtly taxing. 80 * 100 is 8,000, meaning the function will try for a maximum of 8 seconds to find the Object DTM.

I chose this because if your character is walking, it takes just under eight seconds to get from the characters position to the furthest distance on the minimap.

See above at -Finding An Object DTM- to learn about 'GroundLevel'.
-----------------------------
-Walking a Path-
-----------------------------

function ObjDTM_WalkPath(Path: TStringArray; FlagDistance, PollRate,
Tries: Integer; CheckEndPoints, GroundLevel: Boolean): Boolean;
(************************************************* ******************************
function ObjDTM_WalkPath(Path: TStringArray; FlagDistance, PollRate,
Tries: Integer; CheckEndPoints, GroundLevel: Boolean): Boolean;
By: euphemism
Last Edit: 07 Dec 2011 -- euphemism
Description: Walks the TStringArray 'Path'. For each node, it will look for
it every x milliseconds specified by 'PollRate'
a maximum of x tries, specified by 'Tries' to find the
current node. If found, clicks, and waits for the flag to
be a distance x from the player, where x is 'FlagDistance'.
If the Object DTM is found, and the function has maxed out
the tries, but the main-point is off the minimap, the
function will click the closest available point. If
'CheckEndPoints' is set to true, the function will check
to see if the player is within the area polygon of the first node
before walking the path. If not, will result false and exit.
If the function walks the entire path, it will check to see if
the player is within the area polygon of the last node. If not,
the function will return false. Returns true if the
entire path is walked.
************************************************** *****************************)


'Path' is the array of Object DTM strings that make up a path. See above at -Walking To An Object DTM- to learn what 'FlagDistance', 'PollRate', and 'Tries', are; and See above at -Finding An Object DTM- to learn about the 'GroundLevel' parameter.

You must be at the beginning of the path to walk it.

The 'CheckEndPoints' parameter is there as an extra fail-safe if you want it. If set to true, the first and last nodes of your path must have defined area polygons. The function will check to make sure you are in the area of the first node before starting. If not, it will return false and exit. If you walk the path successfully, the function will check to see if you are in the area of the last node. If not, it will return false.
-----------------------------

euphemism
01-13-2012, 05:16 AM
Positioning, Location Checking, and Other Uses

Reserved, coming soon.

euphemism
01-13-2012, 05:17 AM
Frequently Asked Questions

Inception
01-13-2012, 08:32 PM
Great tutorial! I am going to try this out in my script now!

Is it better to have a larger polygon area?

tls
01-13-2012, 08:50 PM
I like that someone else besides me is using my new paint functions :)

Sabzi
01-13-2012, 08:51 PM
I have never actually looked into your include as I haven't scripted for rs, but now that I see what it looks like ...
I must have posted how impressed I am, it looks super professional, nice job!

So yeah, rep++.

Mark
01-13-2012, 08:52 PM
Great Work buddy

Kyle Undefined
01-13-2012, 08:54 PM
Rep++ AND I subscribed to this thread! :D Awesome work <3

tls
01-13-2012, 09:20 PM
I'm probably going to use this as a backup for radial walking in my script.

euphemism
01-13-2012, 10:29 PM
Great tutorial! I am going to try this out in my script now!

Is it better to have a larger polygon area?

Thank! Please do.
That depends on the situation. You need a polygon that does what you want. In most cases, a simple box will do. Will have more information for you when I sit down and think through the next part of the tutorial.


I like that someone else besides me is using my new paint functions :)

Oh, they are very useful indeed. I actually had them inside the include for the longest time because they were never added to SRL. So, people had duplicate identifier problems for a few hours after the SRL update (Probably should have renamed them.).


I have never actually looked into your include as I haven't scripted for rs, but now that I see what it looks like ...
I must have posted how impressed I am, it looks super professional, nice job!

So yeah, rep++.

Thank you very much.


Great Work buddy

Thanks, man!


Rep++ AND I subscribed to this thread! :D Awesome work <3

<3


I'm probably going to use this as a backup for radial walking in my script.

Great to hear. I hope some day you might be using radial walking as the backup.
--

I will try to get more of the tutorial written this evening, stay tuned.

Failedpure
01-14-2012, 12:58 AM
Looking forward to see how to use it to make paths

Silent
01-14-2012, 02:44 AM
Euphemism!

You finally started writing this. So Sexy, I love this include. Looking forward to seeing the other tutorials :)

<3++

euphemism
01-16-2012, 01:39 AM
Euphemism!

You finally started writing this. So Sexy, I love this include. Looking forward to seeing the other tutorials :)

<3++

Thanks!

Sorry everyone about not having the rest of the tutorials up. I am currently sidetracked by a new form-based generation tool. I think it will be worth the wait. :)

Infantry001
01-16-2012, 01:50 AM
This is SO SEXY.

So, let me see if I have this idea correct - essentially, it's a great way to walk and locate yourself within a local area, but could also be used for long-distance walking if necessary?

Silent
01-16-2012, 08:43 AM
This is SO SEXY.

So, let me see if I have this idea correct - essentially, it's a great way to walk and locate yourself within a local area, but could also be used for long-distance walking if necessary?

Yeah, exactly. The path recorder that he has built is fantastic.

DemiseScythe
01-17-2012, 05:24 AM
Looks nice, I'll play with it once your tool is finished and I got more time, good luck and keep at it. =)

euphemism
01-17-2012, 09:45 AM
Looks nice, I'll play with it once your tool is finished and I got more time, good luck and keep at it. =)

'kay :)

Would just like everyone to know that version 9.5 is out, and brings along with it the form-based generation tool I mentioned previously. The 'Multi' and 'Multi-path' tabs aren't yet operational. Those are a surprise. ;) However, the tool supports the creation of single Object DTMs, and paths. Please give it a go, I need feedback!

Flight
01-17-2012, 10:25 AM
Looks simple enough even I could use it! :p Job well done, for sure.

Silent
01-17-2012, 01:54 PM
Would just like everyone to know that version 9.5 is out, and brings along with it the form-based generation tool I mentioned previously. The 'Multi' and 'Multi-path' tabs aren't yet operational. Those are a surprise. ;) However, the tool supports the creation of single Object DTMs, and paths. Please give it a go, I need feedback!

I'm so excited for the multi feature! :D

Once again great work man, glad you kept at this even though there have been some times where you treally didn't want to!

euphemism
01-18-2012, 02:35 AM
I'm so excited for the multi feature! :D

Once again great work man, glad you kept at this even though there have been some times where you treally didn't want to!

Yeah, hopefully that will be coming with version 100 (10.0, whatever). With version 9.6, the generation tool is now a part of the 'ODTM' menu in Simba's toolbar. Hopefully this makes it easier to access. Will try to rewrite first part of the tutorial tonight; incorporating the new method.

John
01-18-2012, 08:13 AM
could you pm me, your Skype or msn? i need help making a path for the first time..

PhaseCode
01-18-2012, 09:42 AM
Yeah, hopefully that will be coming with version 100 (10.0, whatever). With version 9.6, the generation tool is now a part of the 'ODTM' menu in Simba's toolbar. Hopefully this makes it easier to access. Will try to rewrite first part of the tutorial tonight; incorporating the new method.
Generation tool, is what separates the men from the boys. Keep up the good work. Also I would include this method :



function WalkPath(Points : TStringArray;
FlagDistance, PollRate, Tries: Integer;
GroundLevel: Boolean) : Boolean;
var
I : Integer;
begin
for I := 0 to (High(Points)) do
begin
WriteLn(i);
ObjDTM_Walk(Points[i], FlagDistance, PollRate, Tries, GroundLevel);
end;
if ObjDTM_InArea(Points[High(Points)], True) then
begin
writeln('we are the location');
result := True;
end else
result := False;
end;

jatex
01-18-2012, 08:50 PM
Great tut, can't wait for the finding and walking tutorial.

poopy2177
01-20-2012, 01:04 AM
Can't wait to read the tutorials for tomorow I bet the walking one will help me greatly

euphemism
01-20-2012, 07:41 AM
Alright, filled out the first two posts to the best of my ability tonight. I will see about getting the third part finished tomorrow. Sorry, too tired.

Inception
01-20-2012, 07:43 AM
Great addition to this already awesome tutorial! I am loving this thread!!

poopy2177
01-20-2012, 07:39 PM
Yay got OBJDTMS in my script now for walking works BEAUTIFULLY!
Thanks for the tut!

honeyhoney
01-21-2012, 10:46 AM
This is really impressive.

It isn't as fluid as walking with normal DTMs but that's probably because I have it searching for points towards the edge of my minimap.

I've got the concept down, time to neaten up my paths now.

Great tutorial. :smile:

Sin
01-21-2012, 02:01 PM
[Error] C:\Simba\Includes\ObjectDTM\ObjDTMInclude.simba(10 80:12): Duplicate identifier 'DebugTPA' at line 1079

Getting that error when i try to run my script.(Haven't started making the paths yet)

Edit -
Nvm, got it figured out, changed all the variables to something else.

euphemism
01-21-2012, 04:51 PM
[Error] C:\Simba\Includes\ObjectDTM\ObjDTMInclude.simba(10 80:12): Duplicate identifier 'DebugTPA' at line 1079

Getting that error when i try to run my script.(Haven't started making the paths yet)

Edit -
Nvm, got it figured out, changed all the variables to something else.

You need to download the extension from the project post, and update from there.

chemicstry
01-25-2012, 01:23 PM
I get errors:

Did not find path node 0.
Did not find path node 0.
Did not find path node 0.
Did not find path node 0.

Tried different dtms, functions but no luck. What could be the cause of this?

dweg
01-30-2012, 12:57 AM
Works 50% of the time now, especially w/ cacti.

euphemism
01-30-2012, 02:26 AM
I get errors:


Tried different dtms, functions but no luck. What could be the cause of this?

There's not much I can glean from that, other than that it isn't finding that particular Object DTM. Try to make sure the Object DTM is visible on the minimap and test to see if it finds it. Also make sure you have the 'GroundLevel' parameter set correctly.


Works 50% of the time now, especially w/ cacti.

Not the correct thread to post this on. Can you explain in a little more detail? Like, are your Object DTMs failing? Ones using cacti failing more than others?

Tickyy
02-05-2012, 04:12 PM
doesn't seem like images are working update them please :).

fre
02-05-2012, 04:49 PM
Tutorials is what makes this community so awesome rep+
EDIT: images on MM can change when you logout and login again.

euphemism
02-05-2012, 06:36 PM
doesn't seem like images are working update them please :).

They're working for me?


Tutorials is what makes this community so awesome rep+
EDIT: images on MM can change when you logout and login again.

fre, I am well aware that the images change, the code is written to handle that. You can stop telling me this over and over now. :unsure:

Home
02-05-2012, 06:38 PM
They're working for me?



fre, I am well aware that the images change, the code is written to handle that. You can stop telling me this over and over now. :unsure:

:O I didn't know that they change..

Euph. They really change!?

~Home :P

euphemism
02-05-2012, 07:48 PM
:O I didn't know that they change..

Euph. They really change!?

~Home :P

Home, yer, the objects will deform some on the minimap, like, they'll shrink, or grow, or get cut in half on rare occasions. It's really not cool. :p

putonajonny
02-06-2012, 04:27 PM
You need to check for out of range errors with this line (incase it is the first node):
if (ObjDTM_Walk(Path[i - 1], 0, 100, 10, GroundLevel) and (not Reset)) then
begin
Reset := True;
Result := True;
Dec(I);
end;


And this line incase it is the last node:
if (ObjDTM_Walk(Path[i + 1], 0, 100, 10, GroundLevel) and (not Reset)) then
begin

Reset := True;
Result := True;
Inc(I);
end;

I would recomend also swapping the order of things in that if statement, like this:

if ((i <> 0) and (not Reset) and ObjDTM_Walk(Path[i - 1], 0, 100, 10, GroundLevel)) then

if ((i <> high(Path)) and (not Reset) and ObjDTM_Walk(Path[i + 1], 0, 100, 10, GroundLevel)) then

also could you add something like:
ObjDTM_DebugText := False;
where doing this would stop it adding loads of text to the debug box

euphemism
02-06-2012, 07:30 PM
You need to check for out of range errors with this line (incase it is the first node):
if (ObjDTM_Walk(Path[i - 1], 0, 100, 10, GroundLevel) and (not Reset)) then
begin
Reset := True;
Result := True;
Dec(I);
end;


And this line incase it is the last node:
if (ObjDTM_Walk(Path[i + 1], 0, 100, 10, GroundLevel) and (not Reset)) then
begin

Reset := True;
Result := True;
Inc(I);
end;

I would recomend also swapping the order of things in that if statement, like this:

if ((i <> 0) and (not Reset) and ObjDTM_Walk(Path[i - 1], 0, 100, 10, GroundLevel)) then

if ((i <> high(Path)) and (not Reset) and ObjDTM_Walk(Path[i + 1], 0, 100, 10, GroundLevel)) then

also could you add something like:
ObjDTM_DebugText := False;
where doing this would stop it adding loads of text to the debug box

I am aware of the bug in the path walking, and if you will look a few posts up, I have already planned for an option to turn text debug on/off.

Nsight
02-08-2012, 08:01 PM
I'm pretty stoked to say that i've got this down pat pretty well, and i'm trying to work it into my Clay miner and banker I am releasing soon. Thank you so much for an awsome tutorial and the time you took to put it together!

drawboy11
02-12-2012, 12:36 AM
Helped me immensely! Love the tut, Ive made several scripts using this method, thankyou(:

fre
03-02-2012, 08:10 PM
Very nice walking system.
Could you add a random for x, y to the clicking on the MM?
I can add it myself, but everytime the include updates i need to re-add it :p

Good Job !

greencheese
03-04-2012, 05:27 AM
need help please im not sure what to do when adding stuff to scrips, after i added this:
program Script;
{$DEFINE SMART}
{$i SRL\SRL.simba}
{$i ObjectDTM\ObjDTMInclude.simba}

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Member := True;
Players[0].Active := True;
Players[0].Pin := '';
end;

begin

Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;

ClearDebug;

SetupSRL;
ObjDTM_Setup;

DeclarePlayers;

if (not LoggedIn) then
LoginPlayer;
end.

it told me this in my logfile when trying to RUN:
Exception in Script: Too many nested include files while processing 'SRL/SRL/core/simba.simba' from 'C:\Simba\Includes\SRL\SRL.simba'

EDIT: i also added this after SetupSRL like recommended

RE EDIT: well i took off the codes now so could someone tell me what is needed to do after i have downloaded the objectDTM and added the include statement to top of script, those are the 2 things i have done so far

Silent
03-04-2012, 08:31 AM
need help please im not sure what to do when adding stuff to scrips, after i added this:

Snipped'

EDIT: i also added this after SetupSRL like recommended

RE EDIT: well i took off the codes now so could someone tell me what is needed to do after i have downloaded the objectDTM and added the include statement to top of script, those are the 2 things i have done so far

What exactly are you trying to do?

greencheese
03-04-2012, 01:28 PM
What exactly are you trying to do?

sorry nevermind i got it to work, i was trying to get the Generation tools to work, but they work and the only problem i got now is the Silent Spinner wont work, i have added the Ladder and the npc(bank) but now i dont know what to do, do i have to have the generating tools and the Silent Spinner open ?

Silent
03-04-2012, 09:09 PM
sorry nevermind i got it to work, i was trying to get the Generation tools to work, but they work and the only problem i got now is the Silent Spinner wont work, i have added the Ladder and the npc(bank) but now i dont know what to do, do i have to have the generating tools and the Silent Spinner open ?

No, they are completely separate. The spinner already has the walking dtms generated.

Le Jingle
03-05-2012, 06:09 AM
1. should you free DTM's in the main loop too, not just right after they're used?

2. can the act of "not freeing DTM's" cause more memory usage?

Silent
03-05-2012, 08:49 AM
1. should you free DTM's in the main loop too, not just right after they're used?

2. can the act of "not freeing DTM's" cause more memory usage?

These aren't typical DTMs. You don't have to free them.

Yes, normal DTMs being not freed causes memory usage to rise significantly.

Le Jingle
03-06-2012, 12:38 AM
These aren't typical DTMs. You don't have to free them.

Yes, normal DTMs being not freed causes memory usage to rise significantly.

Ah okay, so if I had this code snippet:

If FindDTM(NameHere, X, Y, MIX1, MIY1, MIX2, MIY2) Then
begin
Mouse (x, y, 7, 7, true);
FreeDTM(NameHere);
end;

(granted this snippet is within a procedure)
... So this would be correct I assume, in terms on not causing memory usage to rise significantly?

Silent
03-06-2012, 07:46 AM
Ah okay, so if I had this code snippet:

If FindDTM(NameHere, X, Y, MIX1, MIY1, MIX2, MIY2) Then
begin
Mouse (x, y, 7, 7, true);
FreeDTM(NameHere);
end;

(granted this snippet is within a procedure)
... So this would be correct I assume, in terms on not causing memory usage to rise significantly?

No, wrong kind of DTM :). These aren't your typical kind haha, it's sort of hard to explain. For an object DTM you would use ObjDTM_Find instead of FindDTM. The parameters are also quite different, but I don't remember what they are right now.

Le Jingle
03-06-2012, 08:52 AM
Ah, I think I have to read up then. I'm still getting the hang of which is what, thanks for helping me with the earlier questions though, as well as the object/find DTM. +rep :D !

Silent
03-06-2012, 03:00 PM
Ah, I think I have to read up then. I'm still getting the hang of which is what, thanks for helping me with the earlier questions though, as well as the object/find DTM. +rep :D !

No problem. When euphemism first came out with object DTM's they confused me too, so don't worry too much about it. I had the same thoughts you did initially. :)

Abu
03-09-2012, 04:55 PM
When I try to run my script it stops and takes me to the ObjDTM Include script and gives me this error in my debug box:

Error: Out Of Range at line 845
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]


These are lines 844 and 845 in the ObjDTM Include:
Result.Area[i - 1].x := ExIntArray[AB - 1];
Result.Area[i - 1].y := ExIntArray[AB];


Any help? And yes everything is updated....

elmotheskaat
03-10-2012, 05:36 PM
When I try to run my script it stops and takes me to the ObjDTM Include script and gives me this error in my debug box:

Error: Out Of Range at line 845
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]


Any help? And yes everything is updated....

uh huh, this worked for me
http://villavu.com/forum/showthread.php?p=848708

Abu
03-11-2012, 12:01 AM
Nah its got nothing to do with lag. The script doesn't even start... that error just comes up when I press run script, but it compiles successfully :S

elmotheskaat
03-11-2012, 12:35 AM
Nah its got nothing to do with lag. The script doesn't even start... that error just comes up when I press run script, but it compiles successfully :S

GRMBL, just follow it. It's a really short post, and there's even a tl;dr....
Download java from the link, there's your problem. You have different symptoms, but the same solution nontheless

ssshhhaaa
03-12-2012, 09:59 AM
Ok, so i created a DTM path, and after i had finished making it with the DTM tool, it gave me a load of numbers/points; my question is how to i include this into my script so it walks the path.
I cant find anything in these tutorials that explains how you put the DTM walking into your script.

Silent
03-12-2012, 04:16 PM
Ok, so i created a DTM path, and after i had finished making it with the DTM tool, it gave me a load of numbers/points; my question is how to i include this into my script so it walks the path.
I cant find anything in these tutorials that explains how you put the DTM walking into your script.

Does the path tool give back the numbers in an array? If so you could implement it like this:


for i:= 0 to LengthOfPathArray(set it manually or use a function) do
ObjDTM_Walk([i], 1, 1000, 30, true);


Or something similar to that. If they are just single paths/walking points, just use the ObjDTM_Walk like this
ObjDTM_Walk('71:43:3:0:7:40:83:0:7:64:41:0:7:63:12 6', 1, 100, 40, true)

Of course replace the path with yours, and change the last boolean if it isn't ground level.

Abu
03-14-2012, 05:21 PM
I have a question.

If I use the function ObjDTM_InArea, then does the ObjDTM I want to check for only have to be the Area Polygon, or do I have to add objects to find with it as well as the area polygon?

EDIT: Nevermind, figured it out :)

Joe
04-12-2012, 03:25 PM
Much better than SPS! I stayed up til 11 playing around with this
Rep+

spin3x
05-30-2012, 04:40 PM
Edit.

Creath
06-06-2012, 11:09 PM
Great tutorial! Took a little bit of experimentation for me to fully understand the concept, but I think I know how to apply this to my script now!

One question I had though; can you add randomization? Easily, that is.

From what I understand it walks directly towards the main point and this could be a little suspicious if you're doing it over and over. Is there any way to a little variation to where the flag is placed?

Silent
06-07-2012, 01:26 AM
Great tutorial! Took a little bit of experimentation for me to fully understand the concept, but I think I know how to apply this to my script now!

One question I had though; can you add randomization? Easily, that is.

From what I understand it walks directly towards the main point and this could be a little suspicious if you're doing it over and over. Is there any way to a little variation to where the flag is placed?

If I remember correctly there is tolerance built into ObjDTM. In fact from use with my Spinner I know it doesn't click the exact same spot every time.

Creath
06-07-2012, 01:35 AM
If I remember correctly there is tolerance built into ObjDTM. In fact from use with my Spinner I know it doesn't click the exact same spot every time.

I should've known ^_^ it seems like every pre-created function here is perfectly executed.

Thanks!

Silent
06-07-2012, 01:51 AM
I should've known ^_^ it seems like every pre-created function here is perfectly executed.

Thanks!

No problem, glad I could help. euphemism put a lot of work into this system, it's actually quite easy to use once you get the hang of it. :)

euphemism
06-07-2012, 02:31 AM
I should've known ^_^ it seems like every pre-created function here is perfectly executed.

Thanks!

d'aww


No problem, glad I could help. euphemism put a lot of work into this system, it's actually quite easy to use once you get the hang of it. :)

D'awwwwwww. I have a lot of things to fix and improve. In its current state, the system is a bit run-down and has quite a handful of problems.

Silent
06-07-2012, 03:25 AM
d'aww



D'awwwwwww. I have a lot of things to fix and improve. In its current state, the system is a bit run-down and has quite a handful of problems.

Then get your butt active and fix it! haha, <3

Footy
07-18-2012, 02:30 PM
Im not sure If im doing something wrong, but it keeps saying im not logged in. I've tried logging in in the browser then running, doesent work, Ive tried just pressing play, then logging in, still dosent work. Am I doing something wrong?

Silent
07-18-2012, 04:35 PM
Im not sure If im doing something wrong, but it keeps saying im not logged in. I've tried logging in in the browser then running, doesent work, Ive tried just pressing play, then logging in, still dosent work. Am I doing something wrong?

Its probably not going to work until Simba updates. Its broken like most everything else.

Footy
07-18-2012, 06:16 PM
:/ No srl include makes scripting so tough.

Silent
07-24-2012, 02:20 AM
:/ No srl include makes scripting so tough.

Yeah it's amazing how much help the built in functions actually are. If the Simba update news is to be believed we'll have an updated within two days.

lyo596
01-30-2013, 05:37 AM
Still can't download the updated Object DTM simba files. I only have the sex file installed, and whenever it is trying to access the updated files on silentscripts.net, it says it does not exist. Could someone host me their updated v10.3 files, pretty please? I'm trying to work on a script with DTM finding, but cannot until I can use the generation tool, etc.

target42k12
02-04-2013, 12:58 AM
Still can't download the updated Object DTM simba files. I only have the sex file installed, and whenever it is trying to access the updated files on silentscripts.net, it says it does not exist. Could someone host me their updated v10.3 files, pretty please? I'm trying to work on a script with DTM finding, but cannot until I can use the generation tool, etc.
Same here, looks like his domain expired.

euphemism
02-04-2013, 04:56 AM
Still can't download the updated Object DTM simba files. I only have the sex file installed, and whenever it is trying to access the updated files on silentscripts.net, it says it does not exist. Could someone host me their updated v10.3 files, pretty please? I'm trying to work on a script with DTM finding, but cannot until I can use the generation tool, etc.


Same here, looks like his domain expired.

Both of you: This is the wrong thread for these sorts of posts. Please post in the project's thread, not this tutorial. If either of you had taken a look there you would have seen that I resolved this issue yesterday. Please click the link in my signature and view the latest post.

target42k12
02-06-2013, 01:19 AM
Both of you: This is the wrong thread for these sorts of posts. Please post in the project's thread, not this tutorial. If either of you had taken a look there you would have seen that I resolved this issue yesterday. Please click the link in my signature and view the latest post.

My apologizes. Post was made after a 12 hour shift, patience was not one of my virtues after that day. Thank you for all your hard work towards this project. :duh:

digitalninja
02-09-2013, 07:41 PM
Hi ... I am working on a script and am playing around with various walk options. After trying a few symbol and color walks (not the best option) I stumbled across the DTM walking which I think is EXACTLY what will work. I cant seem to get it to work though ... I get the following error:

Exception in Script: Unable to find file 'ObjectDTM\ObjDTMInclude.simba' used from 'C:\Simba\Scripts\AwesomeBalls.simba'

I have added the {$i ObjectDTM\ObjDTMInclude.simba} at the top of the script and included the ObjDTM_Setup; right after SetUpSRL; but for some reason I cant get the Generation Tool to work?

Any ideas what I am doing wrong?

sureshot12345
03-01-2013, 05:23 PM
[QUOTE=digitalninja;1170239]Hi ... I am working on a script and am playing around with various walk options. After trying a few symbol and color walks (not the best option) I stumbled across the DTM walking which I think is EXACTLY what will work. I cant seem to get it to work though ... I get the following error:

Exception in Script: Unable to find file 'ObjectDTM\ObjDTMInclude.simba' used from 'C:\Simba\Scripts\AwesomeBalls.simba'

I have added the {$i ObjectDTM\ObjDTMInclude.simba} at the top of the script and included the ObjDTM_Setup; right after SetUpSRL; but for some reason I cant get the Generation Tool to work?

Any ideas what I am doing wrong?[/QUOTE

i am getting this error also, im thinking it needs an update but im also a nooby atm

euphemism
03-01-2013, 05:54 PM
Please read the first post of the thread that deals with installing the Object DTM Include.

juunhoad
03-01-2013, 09:18 PM
The tool doesn't come up, and I get some kind of virus detected?

strdatmage
03-10-2013, 03:17 PM
Any video guide?

BigRedJapan
03-12-2013, 03:10 AM
Its out of date no one uses it! If it gets updated this will be a hit tool!

Olly
03-12-2013, 05:01 AM
Its out of date no one uses it! If it gets updated this will be a hit tool!

Whats outdated..? for what it does it works fine.

BigRedJapan
03-12-2013, 10:26 PM
Whats outdated..? for what it does it works fine.

Its not man! Iv tried to make it load multiple times and still nothing pops up even though its compiles and it runs! I left it on for half hour still nothing pops up but the SMART!

rj
03-13-2013, 02:44 AM
Its not man! Iv tried to make it load multiple times and still nothing pops up even though its compiles and it runs! I left it on for half hour still nothing pops up but the SMART!

Lol you gotta edit some stuff out:

Program ObjectDTMGenerationTool;
//{$DEFINE SMART} //Comment this line out if you don't want to use the tool with SMART
{$i SRL\SRL.simba}
{$i ObjectDTM\ObjDTMInclude.simba}

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
CurrentPlayer := 0;
SetLength(Players, HowManyPlayers);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Member := False;
Players[0].Active := True;
end;

var
CleanMap, CurrentMap, CurrentNode, I, X, Y: Integer;
ForcePage: Integer;
ToolForm: TForm;

SubPoints: TPointArray;
Objects: MMObjArray;
ObjectDTM: ObjDTM;
SinglePath: TStringArray;
Done, PathFinish: Boolean;

TabPageControl: TPageControl;
TabSheet: Array [0..3] of TTabSheet;

PropertiesControl: TPageControl;
PropertySheet: Array [0..2] of TTabSheet;
PropertyPanel: TPanel;
AreaSetPanel: TPanel;

MMap: TImage;
ObjectsList: TListBox;
Instructions: TMemo;
Output: TMemo;
PrintFull: TCheckBox;

MainPointResetButton: TButton;
MouseCoords: TLabel;
MainPointTabLabels: Array [0..1] of TLabel;
SinglePathButtons: Array [0..1] of TButton;
SingleTabButtons: Array [0..3] of TButton;
SubPointButtons: Array [0..3] of TButton;
AreaButtons: Array [0..1] of TButton;

procedure DrawDotsEx(pixels: TPointArray; color: Integer);
{:: Author: Sir R. Magician ::}
var
i : integer;
begin

MMap.Canvas.Pen.Color := color;

for i:= 0 to high(pixels) do
begin

MMap.canvas.moveto(pixels[i].x,pixels[i].y);
MMap.canvas.LineTo(pixels[i].x+1,pixels[i].y);
end;
end;

procedure DrawLine(TP1, TP2: TPoint; Color: TColor);
{:: Author: mormonman ::}
begin

MMap.canvas.Pen.Color := Color;

MMap.canvas.moveto(TP1.x,TP1.y);
MMap.canvas.LineTo(TP2.x,TP2.y);
end;

procedure DrawCircle(Center: TPoint; Radius: Integer; Fill: Boolean; Color: TColor);
{:: Author: mormonman ::}
var
TPA: TPointArray;
begin
TPA := TPAFromBox(IntToBox(Center.X - Radius, Center.Y - Radius, Center.X + Radius, Center.Y + Radius));
FilterPointsPie(TPA, 0, 360, -1, Radius, Center.X, Center.Y);

if (not Fill) then
FilterPointsDist(TPA, Radius-1, Radius, Center.X, Center.Y);

if (Length(TPA) >= 1) then
DrawDotsEx(TPA, Color);
end;

procedure DrawPolygons(Polygons: T2DPointArray; color: TColor);
{:: Author: mormonman ::}
var
i, h, Hi: Integer;
begin

if (Length(Polygons) < 1) then
Exit;

for h := 0 to High(Polygons) do
begin
Hi := High(Polygons[h]);
if (Hi < 2) then Exit;

for i := 0 to Hi - 1 do
DrawLine(Polygons[h][i], Polygons[h][i+1], color);

DrawLine(Polygons[h][Hi], Polygons[h][0], color);
end;
end;

procedure GatherMiniMap;
var
TIA: TIntegerArray;
TPA: TPointArray;
begin

UnFreeze;
Freeze;

TPA := TPAFromBox(IntToBox(MMX1 - 3, MMY1 - 3, MMX2 + 3, MMY2 + 3));
FilterPointsPie(TPA, 0, 360, 0, 80, MMCX, MMCY);

TIA := GetColors(TPA);
OffsetTPA(TPA, IntToPoint(-(MMX1 - 3), -(MMY1 - 3)));

FastSetPixels(CleanMap, TPA, TIA);
FastSetPixels(CurrentMap, TPA, TIA);
end;

procedure DrawMiniMap;
begin

DrawBitmap(CleanMap, MMap.Canvas, 0, 0);

end;

procedure DrawObjectDTM(Level: Integer);
begin

if (Level < 1) then
Exit;

if (Level > 0) then
for I := High(SubPoints) downto 0 do
DrawCircle(SubPoints[i], 7, False, clLime);

if (Level > 2) then
begin

if (Length(ObjectDTM.Area) > 0) then
begin

DrawCircle(ObjectDTM.Area[0], 2, True, clRed);
DrawCircle(ObjectDTM.Area[0], 4, False, clRed);
end;

if (Length(ObjectDTM.Area) > 1) then
begin

DrawLine(ObjectDTM.Area[0], ObjectDTM.Area[1], clRed);

for I := 0 to (High(ObjectDTM.Area) - 1) do
DrawLine(ObjectDTM.Area[i], ObjectDTM.Area[i + 1], clRed);

if (Length(ObjectDTM.Area) > 2) then
DrawLine(ObjectDTM.Area[0], ObjectDTM.Area[ObjectDTM.NumOfAreaPoints - 1], clRed);
end;
end;

if (Level > 1) then
for I := High(SubPoints) downto 0 do
DrawLine(ObjectDTM.MainPoint, SubPoints[i], clWhite);
end;

procedure GatherObject;
var
I: Integer;
ObjectsTPA: TPointArray;
begin

if (ObjectsList.ItemIndex = -1) then
begin

WriteLn('You have passed an invalid index to the finding function, please select an object first.');
Exit;
end;

ObjectsTPA := FindMiniMapObj(MMObjRecords[ObjectsList.ItemIndex]);

SetLength(Objects, Length(ObjectsTPA));
OffsetTPA(ObjectsTPA, IntToPoint(-(MMX1 - 3), -(MMY1 - 3)));

DrawMiniMap;

for I := 0 to (Length(ObjectsTPA) - 1) do
begin

DrawCircle(ObjectsTPA[i], 7, False, clWhite);

Objects[i].Center := ObjectsTPA[i];
Objects[i].ObjType := ObjectsList.ItemIndex;
end;

DrawObjectDTM(1);
end;

procedure SubPointManager;
begin

for I := 0 to High(Objects) do
begin

if InCircle(X, Y, Objects[i].Center.x, Objects[i].Center.y, 7) then
begin

if (not PointInTPA(Objects[i].Center, SubPoints)) then
begin

Inc(ObjectDTM.NumOfPoints);

SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(SubPoints, ObjectDTM.NumOfPoints);

ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Base := Objects[i].ObjType;
ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Point := Objects[i].Center;
ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Drift := 7;

SubPoints[(ObjectDTM.NumOfPoints) - 1] := Objects[i].Center;

DrawCircle(SubPoints[(ObjectDTM.NumOfPoints) - 1], 7, False, clLime);
Exit;
end else
Continue;
end;
end;

for I := 0 to (ObjectDTM.NumOfPoints - 1) do
begin

if (not InCircle(X, Y, SubPoints[i].x, SubPoints[i].y, 7)) then
Continue;

DrawCircle(SubPoints[i], 7, False, clRed);

ObjectDTM.SubPoints[i].Base := ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Base;
ObjectDTM.SubPoints[i].Point := ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Point;
ObjectDTM.SubPoints[i].Drift := ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Drift;

SubPoints[i] := SubPoints[(ObjectDTM.NumOfPoints) - 1];

Dec(ObjectDTM.NumOfPoints);
SetLength(SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);

Exit;
end;
end;

procedure AreaManager;
begin

DrawMiniMap;
DrawObjectDTM(3);

if (not PointInTPA(IntToPoint(X, Y), ObjectDTM.Area)) then
begin

Inc(ObjectDTM.NumOfAreaPoints);

SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);

ObjectDTM.Area[(ObjectDTM.NumOfAreaPoints) - 1] := IntToPoint(X, Y);
end;

DrawMiniMap;
DrawObjectDTM(3);
end;

procedure MainPointManager(Click: Boolean);
begin

DrawBitmap(CleanMap, MMap.Canvas, 0, 0);

if Click then
begin

ObjectDTM.MainPoint := IntToPoint(X, Y);
MainPointTabLabels[0].Caption := IntToStr(ObjectDTM.MainPoint.x) + ', ' + IntToStr(ObjectDTM.MainPoint.y);
end;

for I := 0 to High(SubPoints) do
begin

DrawCircle(SubPoints[i], 7, False, clLime);
DrawLine(ObjectDTM.MainPoint, SubPoints[i], clWhite);
end;

for I := 0 to High(SubPoints) do
DrawLine(IntToPoint(X, Y), SubPoints[i], clYellow);
end;

procedure PrintManager;
var
ObjectDTMString: String;
begin

ObjectDTMString := ObjDTMToString(ObjectDTM);


OutPut.LINES.Clear;
OutPut.LINES.Add(#39 + ObjectDTMString + #39);

if PrintFull.Checked then
begin

ObjDTM_PrintToRec(ObjectDTMString);
Writeln('');
end;

WriteLn(#39 + ObjectDTMString + #39);
end;

procedure MoveComponents(WhatTab: Integer);
begin

if ((WhatTab = 1) or (WhatTab = 3)) then
Exit;

AreaSetPanel.Parent := TabSheet[WhatTab];
PropertyPanel.Parent := TabSheet[WhatTab];

for I := 0 to 3 do
SingleTabButtons[i].Parent := TabSheet[WhatTab];

Instructions.Parent := TabSheet[WhatTab];
OutPut.Parent := TabSheet[WhatTab];

if (WhatTab = 2) then
for I := 0 to 1 do
SinglePathButtons[i].Show
else
for I := 0 to 1 do
SinglePathButtons[i].Hide;
end;

procedure InstructionsHandler;
begin

Instructions.Lines.Clear;

case TabPageControl.ActivePageIndex of

0:
begin

case PropertiesControl.ActivePageIndex of

0:
begin

Instructions.Lines.Add('Instructions: Select an object from the list and click ' + #39 + 'gather object' + #39 + ' to display all instances of that object on the minimap. ' + 'Click within circles to add or remove sub-points.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(1);
end;

1:
begin

Instructions.Lines.Add('Instructions: Displays current main-point of the Object DTM. ' + 'Mouse over a position and click to change the main-point. ' + 'Click ' + #39 + 'Reset main-point' + #39 + ' to set the main-point to center.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(2);
end;

2:
begin

Instructions.Lines.Add('Instructions: Displays current area polygon of the Object DTM. ' + 'Mouse over a point to add a vertex. ' + 'Click ' + #39 + 'Delete Area' + #39 + ' to remove the polygon. ' + 'Click ' + #39 + 'Undo Last Point' + #39 + ' to remove last set vertex.');
Instructions.SelStart := 1;

MainPointTabLabels[0].Caption := IntToStr(ObjectDTM.MainPoint.x) + ', ' + IntToStr(ObjectDTM.MainPoint.y);
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;

1:
begin

case PropertiesControl.ActivePageIndex of

0:
begin
end;

1:
begin
end;

2:
begin
end;
end;
end;

2:
begin

case PropertiesControl.ActivePageIndex of

0:
begin

Instructions.Lines.Add('Instructions: Path Recorder: Follow instructions to complete the node. When finished creating node, click ' + #39 + 'Add Path Node' + #39 + '. The form will close, the code will walk to the node, and the form will open back up. Continue until path is complete. When finished, click ' + #39 + 'Finish Path' + #39 + '. This will stop the tool, and print the path in Simba' + #39 + 's debug box. Select an object from the list and click ' + #39 + 'gather object' + #39 + ' to display all instances of that object on the minimap. ' + 'Click within circles to add or remove sub-points.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(1);
end;

1:
begin

Instructions.Lines.Add('Instructions: Displays current main-point of the Object DTM. ' + 'Mouse over a position and click to change the main-point. ' + 'Click ' + #39 + 'Reset main-point' + #39 + ' to set the main-point to center.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(2);
end;

2:
begin

Instructions.Lines.Add('Instructions: Displays current area polygon of the Object DTM. ' + 'Mouse over a point to add a vertex. ' + 'Click ' + #39 + 'Delete Area' + #39 + ' to remove the polygon. ' + 'Click ' + #39 + 'Undo Last Point' + #39 + ' to remove last set vertex.');
Instructions.SelStart := 1;

MainPointTabLabels[0].Caption := IntToStr(ObjectDTM.MainPoint.x) + ', ' + IntToStr(ObjectDTM.MainPoint.y);
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;

3:
begin

case PropertiesControl.ActivePageIndex of

0:
begin
end;

1:
begin
end;

2:
begin
end;
end;
end;
end;
end;

procedure MouseMove(Sender: TObject; S: TShiftState; mX, mY: Integer);
begin

X := mX;
Y := mY;
MouseCoords.Caption := IntToStr(X) + '. ' + IntToStr(Y);

case Sender of

AreaSetPanel:
begin

case PropertiesControl.ActivePageIndex of

1:
begin

DrawMiniMap;
DrawObjectDTM(2);
end;
2:
begin

DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;

MMap:
begin

if (PropertiesControl.ActivePageIndex = 1) then
MainPointManager(False);

if (PropertiesControl.ActivePageIndex = 2) then
begin

if (Length(ObjectDTM.Area) = 0) then
Exit;

DrawMinimap;
DrawObjectDTM(2);

if (Length(ObjectDTM.Area) > 0) then
begin

DrawCircle(ObjectDTM.Area[0], 2, True, clRed);
DrawCircle(ObjectDTM.Area[0], 4, False, clRed);
end;

if (Length(ObjectDTM.Area) = 1) then
begin

DrawLine(ObjectDTM.Area[0], IntToPoint(X, Y), clRed);
Exit;
end;

if (Length(ObjectDTM.Area) > 1) then
begin

DrawLine(ObjectDTM.Area[0], IntToPoint(X, Y), clRed);

DrawLine(ObjectDTM.Area[ObjectDTM.NumOfAreaPoints - 1], IntToPoint(X, Y), clRed);

for I := 0 to (High(ObjectDTM.Area) - 1) do
DrawLine(ObjectDTM.Area[i], ObjectDTM.Area[i + 1], clRed);
end;
end;
end;
end;
end;

procedure MouseClick(Sender: TObject);
begin

case Sender of

TabPageControl:
begin

MoveComponents(TabPageControl.ActivePageIndex);
InstructionsHandler;
end;

MMap:
begin

case PropertiesControl.ActivePageIndex of

0: SubPointManager;
1: MainPointManager(True);
2: AreaManager;
end;
end;

SingleTabButtons[0]:
begin

GatherMiniMap;
DrawMiniMap;
DrawObjectDTM(1);
end;

SingleTabButtons[1]: DrawMiniMap;

SingleTabButtons[2]:
begin

ObjectDTM.MainPoint := IntToPoint(80, 80);
ObjectDTM.NumOfPoints := 0;
ObjectDTM.NumOfAreaPoints := 0;

SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);

SetLength(SubPoints, ObjectDTM.NumOfAreaPoints);
DrawMiniMap;
end;

SingleTabButtons[3]: PrintManager;

SubPointButtons[0]: GatherObject;

SinglePathButtons[0]:
begin

Done := False;
ForcePage := 2;
Inc(CurrentNode);

SetLength(SinglePath, CurrentNode);
SinglePath[CurrentNode - 1] := ObjDTMToString(ObjectDTM);

PrintManager;

ObjectDTM.MainPoint := IntToPoint(80, 80);
ObjectDTM.NumOfPoints := 0;
ObjectDTM.NumOfAreaPoints := 0;

SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);

ToolForm.Close;
end;

SinglePathButtons[1]:
begin

Done := True;
PathFinish := True;
ToolForm.Close;
end;

PropertiesControl:
begin

InstructionsHandler;
end;

MainPointResetButton:
begin

ObjectDTM.MainPoint := IntToPoint(80, 80);
MainPointTabLabels[0].Caption := '80, 80';
DrawMiniMap;
DrawObjectDTM(2);
end;

AreaButtons[0]:
begin

ObjectDTM.NumOfAreaPoints := 0;
SetLength(ObjectDTM.Area, 0);
DrawMiniMap;
DrawObjectDTM(3);
end;

AreaButtons[1]:
begin

Dec(ObjectDTM.NumOfAreaPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;

procedure ToolForm_Init;
begin

Done := True;

ToolForm := TForm.Create(nil);

TabPageControl := TPageControl.Create(ToolForm);
TabPageControl.Parent := ToolForm;
TabPageControl.Width := 510;
TabPageControl.Height := 330;
TabPageControl.Caption := 'TabPageControl';

TabPageControl.OnPageChanged := @MouseClick;

PrintFull := TCheckBox.Create(ToolForm);
ObjectsList := TListBox.Create(ToolForm);
Instructions := TMemo.Create(ToolForm);
Output := TMemo.Create(ToolForm);
PropertyPanel := TPanel.Create(ToolForm);
MMap := TImage.Create(ToolForm);

PropertiesControl := TPageControl.Create(ToolForm);
PropertiesControl.Parent := PropertyPanel;
PropertiesControl.Width := 210;
PropertiesControl.Height := 160;
PropertiesControl.Caption := 'PropertyPageControl';
PropertiesControl.OnPageChanged := @MouseClick;

for I := 0 to 3 do
begin

TabSheet[I] := TTabSheet.Create(ToolForm);
TabSheet[I].Parent := TabPageControl;
TabSheet[I].PageControl := TabPageControl;
end;

TabSheet[0].Caption := 'Single';
TabSheet[1].Caption := 'Multi';
TabSheet[2].Caption := 'Path';
TabSheet[3].Caption := 'Multi-path';

AreaSetPanel := TPanel.Create(ToolForm);
AreaSetPanel.Parent := TabSheet[0];
AreaSetPanel.OnMouseMove := @MouseMove;
AreaSetPanel.Width := 510;
AreaSetPanel.Height := 330;
AreaSetPanel.Top := 0;
AreaSetPanel.Left := 0;
AreaSetPanel.Color := 16777215;

for I := 0 to 2 do
begin

PropertySheet[I] := TTabSheet.Create(ToolForm);
PropertySheet[I].Parent := PropertyPanel;
PropertySheet[I].PageControl := PropertiesControl;
end;

PropertySheet[0].Caption := 'Sub-points';
PropertySheet[1].Caption := 'Main-point';
PropertySheet[2].Caption := 'Area';

with PropertyPanel do
begin
Parent := TabSheet[0];
Left := 282;
Top := 10;
Caption := 'Object DTM Generation Tool - by euphemism';
Width := 210;
Height := 160;
end;

for I := 0 to 1 do
begin

SingleTabButtons[i] := TButton.Create(ToolForm);
SingleTabButtons[i].Parent := TabSheet[0];
SingleTabButtons[i].Width := 100;
SingleTabButtons[i].Height := 20;
SingleTabButtons[i].Top := 35 + (i * 20);
SingleTabButtons[i].Left := 176;
end;

for I := 2 to 3 do
begin

SingleTabButtons[i] := TButton.Create(ToolForm);
SingleTabButtons[i].Parent := TabSheet[0];
SingleTabButtons[i].Width := 100;
SingleTabButtons[i].Height := 20;
SingleTabButtons[i].Top := 35 + (i * 20);
SingleTabButtons[i].Left := 176;
end;

with SingleTabButtons[0] do
begin

Caption := 'Grab Minimap';
OnClick := @MouseClick;
end;

with SingleTabButtons[1] do
begin

Caption := 'Clear Minimap';
OnClick := @MouseClick;
end;

with SingleTabButtons[2] do
begin

Caption := 'Delete ODTM';
OnClick := @MouseClick;
end;

with SingleTabButtons[3] do
begin

Caption := 'Print Object DTM';
OnClick := @MouseClick;
end;

with PrintFull do
begin
Parent := AreaSetPanel;
Left := 184;
Top := 155;
Width := 8;
Height := 11;
Caption := 'Print Record';
end;

with SubPointButtons[0] do
begin

SubPointButtons[0] := TButton.Create(ToolForm);
Parent := PropertySheet[0];
Left := 102;
Top := 4;
Height := 30;
Width := 100;

Caption := 'Gather Object';
OnClick := @MouseClick;
end;

for I := 0 to 1 do
begin

MainPointTabLabels[i] := TLabel.Create(ToolForm);
MainPointTabLabels[i].Parent := PropertySheet[1];
MainPointTabLabels[i].Width := 20;
MainPointTabLabels[i].Height := 30;
MainPointTabLabels[i].Left := 15;
end;

MainPointTabLabels[0].Top := 17;
MainPointTabLabels[0].Caption := '80, 80';
MainPointTabLabels[1].Top := 5;
MainPointTabLabels[1].Caption := 'Main-point:';

MouseCoords := TLabel.Create(ToolForm);
MouseCoords.Parent := AreaSetPanel;
MouseCoords.Width := 20;
MouseCoords.Height := 30;
MouseCoords.Top := 290;
MouseCoords.Left := 10;
MouseCoords.Caption := '0. 0';

with MainPointResetButton do
begin

MainPointResetButton := TButton.Create(ToolForm);
Parent := PropertySheet[1];
Left := 102;
Top := 4;
Height := 30;
Width := 100;

Caption := 'Reset Main-point'
OnClick := @MouseClick;
end;

for I := 0 to 1 do
begin

AreaButtons[i] := TButton.Create(ToolForm);
AreaButtons[i].Parent := PropertySheet[2];
AreaButtons[i].Left := 102;
AreaButtons[i].Top := 4 + (i * 30);
AreaButtons[i].Height := 30;
AreaButtons[i].Width := 100;
end;

AreaButtons[0].Caption := 'Delete Area'
AreaButtons[0].OnClick := @MouseClick;

AreaButtons[1].Caption := 'Undo Last Point'
AreaButtons[1].OnClick := @MouseClick;

for I := 0 to 1 do
begin

SinglePathButtons[i] := TButton.Create(ToolForm);
SinglePathButtons[i].Parent := AreaSetPanel;
SinglePathButtons[i].Width := 100;
SinglePathButtons[i].Height := 20;
SinglePathButtons[i].Top := 115 + (i * 20);
SinglePathButtons[i].Left := 176;
SinglePathButtons[i].Hide;
end;

SinglePathButtons[0].Caption := 'Add Path Node';
SinglePathButtons[1].Caption := 'Finish Path';
SinglePathButtons[0].OnClick := @MouseClick;
SinglePathButtons[1].OnClick := @MouseClick;

with ToolForm do
begin
Left := 430;
Top := 174;
Caption := 'Object DTM Generation Tool - by euphemism';
ClientWidth := 510;
ClientHeight := 330;
Color := 15984606;
end;

with MMap do
begin
Parent := AreaSetPanel;
Left := 5;
Top := 10;
Width := 160;
Height := 160;
OnClick := @MouseClick;
OnMouseMove := @MouseMove;
end;

with ObjectsList do
begin
Parent := PropertySheet[0];
Left := 0;
Top := 4;
Width := 100;
Height := 127;
ItemHeight := 13;
Items.Add('Ladders');
Items.Add('Trees');
Items.Add('Dead Trees');
Items.Add('Plants');
Items.Add('Flax');
Items.Add('Boulders');
Items.Add('Henges');
Items.Add('Cacti');
Items.Add('Maple Trees');
Items.Add('Rocks');
Items.Add('NPC Dots');
end;

with Instructions do
begin
Parent := TabSheet[0];
Left := 10;
Top := 180;
Width := 480;
Height := 50;
ReadOnly := True;
ScrollBars := ssVertical;
Instructions.Lines.Add('Instructions: Select an object from the list and click ' + #39 + 'gather object' + #39 + ' to display all instances of that object on the minimap. ' + 'Click within circles to add or remove sub-points.');
SelStart := 1;
end;

with Output do
begin
Parent := TabSheet[0];
Color := 16777215;
Left := 10;
Top := 235;
Width := 480;
Height := 55;
end;

CleanMap := BitmapFromString(160, 160, '');
CurrentMap := BitmapFromString(160, 160, '');

FloodFillBitmap(CleanMap, IntToPoint(0, 0), 0, 16777215);
FloodFillBitmap(CurrentMap, IntToPoint(0, 0), 0, 16777215);

SetBitmapName(CleanMap, 'Clean');
SetBitmapName(CurrentMap, 'Current');

DrawBitmap(CleanMap, MMap.Canvas, 0, 0);

SubPoints := LoadTextTPA('Click ' + #39 + 'Grab Minimap' + #39, 'SmallChars', I);
OffSetTPA(SubPoints, IntToPoint(28, 62));
DrawDotsEx(SubPoints, 000000001);

SubPoints := LoadTextTPA('to get client image', 'SmallChars', I);
OffSetTPA(SubPoints, IntToPoint(31, 79));
DrawDotsEx(SubPoints, 000000001);

SetLength(SubPoints, 0);

Freeze;

TabPageControl.Pages[ForcePage].Show;

if (ForcePage = 2) then
begin

GatherMiniMap;
DrawMiniMap;
end;

ToolForm.SHOWMODAL;

TabPageControl.Free;
ToolForm.Free;
end;

procedure ToolForm_SafeInit;
var
v: TVariantArray;
begin
SetLength(v, 0);
ThreadSafeCall('ToolForm_Init', v);
end;

procedure FormLoad;
begin

ToolForm_SafeInit;
Unfreeze;
FreeBitmap(CleanMap);
FreeBitmap(CurrentMap);
end;

begin

{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
SMART_Server := 10;
SMART_Members := True;
SMART_Signed := True;
{$ELSE}
SMART_FixSpeed := True;
{$ENDIF}
{$ENDIF}

CurrentNode := 0;
ForcePage := 0;

SetupSRL;
ObjDTM_Setup;

ObjectDTM.MainPoint := IntToPoint(80, 80);
ObjectDTM.NumOfPoints := 0;
ObjectDTM.NumOfAreaPoints := 0;

SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
SetLength(SinglePath, 0);

// if (not LoggedIn) then
// begin

// if (LobbyScreen) then
// begin

// MouseBox(270, 500, 490, 520, mouse_left);

// while (not LoggedIn) do
// Wait(500);
// end else
// begin

// WriteLn('');
// WriteLn('Object DTM Generation Tool: WARNING! You are not logged in. Please login your character and run the tool again.');
// WriteLn('');

// TerminateScript;
// end;
//end;

ObjDTM_Debug := True;

ClickNorth(SRL_ANGLE_NONE);

Wait(400);

repeat

FormLoad;

if PathFinish then
begin

WriteLn('');
WriteLn('Object DTM Generation Tool: Generated path:');
WriteLn('');
WriteLn(SinglePath);
Exit;
end;

if (ForcePage = 2) then
begin

ObjDTM_Walk(SinglePath[CurrentNode - 1], 0, 100, 80, GroundLevelCheck);

while IsMoving do
Wait(100);
end;
until Done;
end.

BigRedJapan
03-13-2013, 02:52 AM
Ill try it out!

dzpliu
03-30-2013, 12:25 PM
the images of the tutorial are no longer available.

Twinki
05-03-2013, 02:28 AM
Would this work on a RSPS?

If not can anyone link me to something like this that also works with an RSPS (If there is one)