View Full Version : Complete pictionary guide to DTMs and DDTMs.

04-24-2008, 02:30 AM

I know what you're thinking: "Oh, here he goes again! Something else about what many people have talked about!" But have those guides contained FLAMETHROWERS or NINJAS? Well, don't get your hopes up, mine doesn't either. What it does have is one of the most comprehensive tutorials on D/DTM's available. So lets have a look, shall we?

TABLE OF CONTENTS - (ctrl + f to search for them)

1. What? - The explanation
2. D/DTM's - the scenario
3. DTM's - the creation
4. DTM's - the code
5. Interlude
6. DDTM's - the creation
7. DDTM's - the code
8. Closing

1. What? - the explaination

You've heard of searching for colors, if you haven't I don't know where you've been. You *may* have heard of searching for bitmaps, I don't think thats done too much anymore -- its still very effective -- but what dominates the scene today is D/DTM's. What theses are, if you do not know, are a collection of points with a known distance in between. You can try to match only crucial points, something you can't do with bitmaps, to speed up the search. They're very useful, so try to use them whenever you can. This DOES NOT mean you should use them all the time. Use them when appropriate, because sometimes even the lowly color finding statement can debase a whole setup of D/DTM's.

2. D/DTM's - the scenario

Well, when considering when to use a DTM, you must consider the following things:

• Area to search
• Type of search
• Colors around the search area
• Are there clashes (multiple finds) when using?

This is why: (1) If you've already narrowed the place to search to a 100x100 area, there may be no reason to use a DTM. You might do better with a color search or TPA search. (2) Are you searching for an object? A place on the map? Something in the bank? Sometimes these things can be found more effectively with a bitmap or TPA search. I'll include some of this stuff later. (3) Are there lots of repeat colors? If you, for example, run a test script which shows all the matches of a color in a TPA and you get way to many results for the main color of a DTM, think again. You might not be able to use it because the DTM may collide with other combinations in the scenery. (4) PLEASE PLEASE PLEASE test an area using a FindColorTPA first look at your results. If there seems to be too many, approach it much differently.

Thus, choose carefully.

3. DTM's - the creation

Creating DTM's is surprisingly simple. I'll show you a fairly quick way. This will be with the main screen, but you should get the idea.

1. Open up SCAR, be sure to have runescape selected with your crosshair.

2. Open up the DTM editor, make sure there is nothing covering runescape.

3. Determine what you will make it of, I am doing it of the World Select button.

4. There isn't really a way to describe this, you simply click where you want the point to be returned - if its on an item, do it near the center perhaps.

5. You then click around the area of the main point, try to get specific areas - if its an item, use the black out line. It always work. (Notice red spider web near the bottom)

6. Save your DTM!

7. To retrieve the code to put it to use, load it!

4. DTM's - the code

Now, I know, you want to know how to use it. Nothing is more simple! (I'm posting pictures so you must type it yourself, you can't copy and modify the code, you learn more by typing yourself.)

1. Load your DTM (I'll be using mine) and copy the code.

2. Make a variable declaration (var DTM: Integer;), and create an empty procedure. Fill it with the code from the debug box, changing the name if you want.

3. Noticing the increased Access Violations with the more complex scripts, here is how you can help reduce that. Change that new procedure to this!

4. Now, create another procedure. This will free the DTM's. SCAR is known to cause massive memory leaks because of the programmer! So clean up! (It won't need a try..except)

5. Interlude

To take a break, go play with what you've learned! I'd suggest exploring the interface of the DTM editor, make a few DTM's.

Some things you should know, however, is that to the right of the DTM "pointing" screen there are some selectable boxes. Say your doing an item. You'd click first in the center of the object, and then look over to the right. You'll see a few boxes...


RED: The area you should be looking at.
VIOLET: These are mainly used in DDTM's as these are auto-generated when you make a regular DTM.
BLUE: Change the tolerance of the color that the point is on.
GREEN: Mainly used in DDTM's, this is automatically set to the color of point you click on...

Look at the blue box. Now, because colors in runescape change quite a bit (except for the black outline) you should set this to 255 on the main point. Now you'd go and click on a few places on the outline of the object -- make sure its the black outline. You'd leave this tolerance at 5 or what is usually there, or you might possibly set it to zero.

And now... I will be adding to this section any other information I deem useful. Back to the other things, shall we?

6. DDTM's - the creation

Okay, I won't lie to you. This is the hardest thing in the world!

. . . Joking!

I don't understand why people think this is hard, its truly not. All you really need it the starting template -- the psuedo code -- to begin making DDTM's.

Well, the only thing I have in this section is a picture. Create a DTM as usual, but don't do anything else!


7. DDTM's - the code

The code is pretty simple: you have a Mainpoint, and a variety of Subpoints. These derived from the record TDTMPointDef.

1. Create all of the variables... Name them something that makes sense. Lines 5 & 6 are the ones you will set the variables on by hand, the lines 7 & 8 contain the two records that assemble the DTM.

2. Start defining the variables, I'll supply you with how to do that. You'll first create a procedure called something like the one below, then you'll fill it with your settings like those in the box. REMEMBER: The topmost is the MainPoint, those following it are not required to be in any specific order. The values marked on the MainPoint must be the value specified, but the subs can have a different values...

3. Now, you finish it with this. It will finish it up and allocate memory. You *might* want to add a try..catch, but it'll do. Remember to free it!

8. Closing

Whats important is you've learned something. You better have. Or else.

Now, if you've got any questions (Hope you don't, it means that I haven't explained something enough) please check the IRC channel #srl @ irc.freenode.net. Next you could PM me, or contact me at R030t1@gmail.com.

Gone Fishing
04-24-2008, 02:31 AM
Wow, I can't wait until this is finished, it looks really helpful so far :).

04-25-2008, 12:08 AM
Great! I got it finished. Should be up-to-date.

04-25-2008, 12:12 AM
Nice. "Tutorial for Beginners" IMO Beginners don't need to know DDTM's.. anyways, looks nice.

04-25-2008, 02:16 AM
ver nice tut well done and grats i think this should be intermediates too but gj :)

04-25-2008, 02:50 AM
hi good Tut

is this right?

procedure DropRocks;
DTM := DTMFromString('78DA637466626078C180028E171A8269462 89' +
'FD10FA8E60DAA1A0305055435C640354F18D00023AA1A77A0 9A1B' +
'04D4D803D57C2660972D50CD4D02E60401D53CC46F0E00483 F0AE' +
Result:= True;


this is my var you can ignore the x and y bit thats something else

var x, y, Tries: integer;
DTM: integer;

someone said i should use it for my power miner to drop the rocks.

if i want it to work on any ore i have in my inventory do i just make lots of these?

04-25-2008, 06:42 AM
nice guide
maybe tell them when making dtms.. they should take outlines = black color
and set the tolerance from teh mainpoint not higher than 25;)
very nice done:)
rep++ :cool:

04-26-2008, 01:43 AM
Ok, thanks. Well, for objects, its generally advisable to set it to 255 so it matches more often, but both work fine.

Oh, and sunny, select the outline and make it the DTM's anchorpoints. That usually works. You can often get better help than I can give you.

04-26-2008, 01:48 AM
Ok, thanks. Well, for objects, its generally advisable to set it to 255 so it matches more often, but both work fine.

Oh, and sunny, select the outline and make it the DTM's anchorpoints. That usually works. You can often get better help than I can give you.

ok what does it mean when you said "free DTMs"

04-26-2008, 10:56 PM
Well, when you create and initialize a DTM it takes up memory. The memory does not automatically get freed when SCAR closes, so you need to do it youself.

This is called Freeing the DTM.

04-27-2008, 06:38 AM
Well, when you create and initialize a DTM it takes up memory. The memory does not automatically get freed when SCAR closes, so you need to do it youself.

This is called Freeing the DTM.

oh ok so that goes in the main loop?

04-29-2008, 10:03 PM
Yes, at the very end when the script exits.

05-16-2008, 01:45 AM
I realized someone didn't put a freedtm((dtmnamehere)); in there script, if it leaks memory, does it go away after restarting your computer, like not take up that memory anymore? if not, how do you tell if it's taking up memory, and if it still is taking up that memory, how do you get it to stop?

05-16-2008, 01:58 AM
Yes, RAM only retains its data for a few milliseconds of no power. It will be free'ed. If you want to do it during runtime however (w/o restarting) you'd need to go-ask-google.

05-16-2008, 02:46 AM
oh, so restarting will work though?

05-16-2008, 03:10 AM
Isn't the default AreaSize on (D)DTMs 0?
Anyways, always like pictures :p. Nice.

EDIT: Max tolerance isn't 255. It's either 442 or 422 (I think 442) on CTS 1.

05-16-2008, 11:01 AM
Very good tutorial. And I love the font.

Good job. 10/10

PS Don't you need to declare an integer as the variable's name? I didn't see that in the first part.

05-23-2008, 03:16 AM
Eh yeah. I Might've forgotten it but they should infer it right?

05-23-2008, 11:05 AM
Well, this is a "beginner's tutorial" and most beginner's don't know that you have to declare the DTM name as an integer. They will most likely get an error and quit trying. The more advanced ones (who have dealt with bitmaps and such) will probably figure it out after they get an error.

It would require some work to update the tutorial seeing how it's made out of tutorials. It's really your choice and depends on whom you want to appeal to.

You could just mention it in the beginning. Either in a SCAR tag or through a picture, you could show them to declare DTM as a global integer and then go on to show them how to use it. This way you wouldn't really need to edit too much.

PS I do see that you included that in step two. I guess I missed it last time :p. I guess that discredits this whole post, but oh well. Once again, very good tutorial.

08-03-2008, 01:20 PM
Thanks for all of the screenshots, they helped explain a lot.

08-25-2008, 05:48 AM
Thanx for the excellent tut on DTMS. Been looking for a good explination for a while now :)

P.S. not sure if it's just on my PC, but I can't see any pictures.

key keeper55
10-16-2008, 06:49 PM
omg thank u for this tutorial
it helped me so much and the other tuts on DTMs didnt reall help me
thank you again

10-19-2008, 12:38 AM
Thanks helped me quite a bit Im going to start scripting after I read more tuts :D