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.