# Thread: Yohojo's DTM Tut 1(Item finding with DTMs)

1. ## Yohojo's DTM Tut 1(Item finding with DTMs)

Update: Learn all of the below in a video I created found here:

*Well i love DTMs and decided to share my knowledge with all of the other scripters. In this tutorial i will show you how to make DTMs for locating items on Runescape and MapWalking*

Whats a DTM?

• DTM stands for: Deformable Template Model.

• A DTM i a special point on the screen that SCAR recognizes by how far it is from certain points and colors

Why use DTMs?

• DTMs are easy to make once you know how. They are also very precise and accurate

• DTMs are easier to make then bitmaps and DTM codes are a lot shorter than bitmap codes.

How to make a DTM to locate an item

• In this first have of the tutorial i will show you how to use DTMs to locate items on the runescape bank screen or inventory. DTMs can not be used to find items on the mainscreen because there are many camera angles ect...

Step1:
• The first thing you should do when making a DTM for an item is get a picture of that item.

• This can be done by logging into runescape and getting a picture of the item you want. Do this by putting the item in you inventory or bank account and pressing the key.

• BUT it you are a Ub3R /\/0ob and dont have the item you need just go to a runescape help site and find a picture of the item there.
After this open a paint document and paste the picture there.

Step2:
• Now you should open up a SCAR CDE and drag the corsshair to the paint screen making shure you can still see your picture.

• Then you should go back to your SCAR CDE and click Tools>DTM Editor:

• Congrats! You have just opened up the screen where all DTMs are made. Now the first thing you should do is click the middel of you item. After that your screen should look something like this:

• The info on the right tells the x and y coodianates and the color of the point you just clicked. Because this is the first point you clicked it is called the Parent. The parent is the point that SCAR refers to when you do anything with the DTM.

Step3:
• Now we must create some "links" to make the DTM unique. Jagex made making DTMs for items oh so easy for us by outlining all of their items.

*CONTINUED BELOW*
Last edited by YoHoJo; 11-19-2011 at 10:00 AM.

2. *CONTINUED FROM ABOVE*

•As you can see in the top left corner of the DTM editor there is a close up of a 9 pixel square. This helps us be more prcise on picking our points. And EVERY item in runescape is oulined with a onc pixel long black line. So now move your mouse arround your item and when you see some of the black outline in the center of the 9 pixel box click. After you click your first point it should look something like this:

• You have just created you first "link"! This liink shows the distance from your parent to the outline of your object. Now all you have to do is create a few more links arround the outline of the object like so:

NOTE: Try not to make a link at the top left corner otherise it wont work for stackable items or if you have multiple in your bank!
Step4: Making the DTM "Universal"
Runescape Updated, 131072 is now the black color. So make sure the color on your outline points is 131072
• Now we must make the DTM what i call "Universal" meaning it works for all items of the type. Example: All logs have the same outline so the back color is ok. BUT my parent has a unique color so it will only work work normal logs.

• So all you have to do to make your DTM universal is add some tolerance to the parent point. So now click the info about the parent and change the tolerance to 255(MAX):

Step5: Saving and Testing the DTM

•Now we must save the DTM:

•After this we must test it. So now exit out of the DTM editor and find/take a differnt picture of the same item. Then click DTM editor again so the picture will be displayed.

*CONTIUED BELOW*
Last edited by YoHoJo; 11-09-2009 at 11:25 PM.

3. *CONTINUED FROM ABOVE*

•Now we must test to see if your DTM works. So click:

• If it worked correctly you should see somthing like this:

Step6:: Useing your DTM in your script:

•Using a DTM in a script is similar to using a bitmap in a script. First you must convert you DTM to text. So open up the DTM editor and click File>Open>Where ever your DTM is saved and click

•Now exit out of the DTM editor and look in the SCAR report box you should see somthing like this:

Code:
DTM := DTMFromString('78DA63AC666460286740017509960CFF81345' + '086E13F1030B663AA81C8C248205D0B64D51050934F849A2A202B' + '8B809A26202B13BF1A0034E80BCD');

•See where it says "DTM" before the :=? That is where you name the DTM anything you want to!

•Now all we have to do it use it in a script like a bitmap. The FindDTM function goes as followed:
Code:
FindDTM(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Integer

•This is what all of they variables mean
DTM= Name of Your DTM
x,y= The x,y cords that the dtm is it. (Scar finds this)
x1,y1,x2,y2: The box in which SCAR tries to find the DTM in

•So here is an example of using this DTM in a script:

Code:
program New;
var Logs,x,y:integer;
begin
Logs := DTMFromString('78DA63AC666460286740017509960CFF81345' + '086E13F1030B663AA81C8C248205D0B64D51050934F849A2A202B' + '8B809A26202B13BF1A0034E80BCD');
if FindDTM(Logs,x, y,1, 1, 200, 200) then
writeln('Congratz! You have just found your first DTM!')
end.

And this concludes Yohojo's DTM Tutorial

4. nice tutorial :PXD

5. Neonknight77 Guest
Did Sdouble teach you this?

6. why do i see all the tutorial as huge wide blocks? like Sdcit's post is normal, and everything above is wider than normal

7. Jagex: Its because i got big ol pics

Neon: Yes, Sdouble toght me the concept of making DTMs like that

8. Lol, Yohojo you release this on every forum.

It's good.

9. Its good to learn =)
And thz to starblaster for recovering it from kaitnieks!

10. I rep'd you on kaitnieks for this. It's very good.

11. cmon guys anyone else wana learn DTMs?
they are usefel!=)

12. i learned DTMs from this!. very useful

13. thank you for creating this guide, i am going to follow it closely and tell you how i do, thx alot

wow works great, and it makes me understand and use dtms pretty well, mad props for the guide, and thanks again, this is code i came up with
and this code only searchs your inventory for the logs, im gonna try and make it so it stores all in bank, so ill have to learn how to search for rs2 text so i can store in inventory

SCAR Code:
program New;var Logs,x,y:integer;beginlogs := DTMFromString('78DA639466606010674001BE969C0CFF81342' +       '310FF07024611208397010D302291405A8A08359A404292801A45' +       '202147400D3711E608030945FC6A008B9706F2');       if FindDtm(logs, x, y, 550, 200, 740, 470) then       writeln('congratz! You have just found your first DTM!')end.

14. This will bank all logs after you open the bank:

program New;
var Logs,x,y:integer;

begin
logs := DTMFromString('78DA639466606010674001BE969C0CFF813 42' +
'310FF07024611208397010D302291405A8A08359A40429280 1A45' +
'202147400D3711E608030945FC6A008B9706F2');
if FindDtm(logs, x, y, 550, 200, 740, 470) then
Begin
Mouse(x,y,5,5,false)
Wait(200+Random(1000))
PopUp('Deposit All')
end;
end.

15. SRL Junior Member
Join Date
Oct 2006
Posts
35
Mentioned
0 Post(s)
Quoted
0 Post(s)
Hey there people, just got back from being away, now that this hunter skill has been introduced, now, the thing is, im not sure if im really getting this right, can someone(not me, ffs) tell me where i might be going wrong, its compiling successfully, but the writeln is not tellin me 'congrats'

SCAR Code:
program New;var barbtail,x,y:integer;begin barbtail := DTMFromString('78DA63F4676260D060644006D19EC60CFF813' +       '448F43F103082D4A8A0AA81C8C24820ED0254638C5B0D187B00D5' +       '68E356C304A2FD80A40E0135A140520DB71A16101D0954A340404' +       'D30508D3C7E35004D5D09C7');       if FindDTM(barbtail,x,y,1,1,200,200) then       writeln('congrats')end.

16. If its not saying crongrats its not working
either the DTM you made doesnt Follow the rules i made ^ OR
the DTM isnt within the cords (1,1,200,200)

Also iv noticed that the outline of Hunter still isnt 65536 like all other skills and items
maybey jagex messed up =p

try again, if it doesn work ill help you out

17. SRL Junior Member
Join Date
Oct 2006
Posts
35
Mentioned
0 Post(s)
Quoted
0 Post(s)
weird, when testing the dtm, it can find it, but when i try run, it just wont say the congrats bit

18. well remember like i said
make it properly
remember to put 255 on your center point
and then click border (black) outline of it
Also like i said the outline is kinda weird so add a tolerance of about 20 to the outline points

and also, it should always work when you test it..
if you make a DTM with a pic, and test it on the same pic its always going to fin it
to test it better, exit out of the DTM Editor, and enter it again and then test

Make it just like you would for an item even though your are doing it for a Skill Picture

Here try this

SCAR Code:
DTM := DTMFromString('78DA63BCC0C8C0E001C448C0C1C28EE13F900' +        '689FE0702C6D340961DAA1A5111110639A81A1060BC4A849A3340' +        '962F01355708AB0100F8530CA0');

19. SRL Junior Member
Join Date
Oct 2006
Posts
35
Mentioned
0 Post(s)
Quoted
0 Post(s)
ahh sweet, got it now dude, thanks man, looks like ive just stuffed up making the DTM, its a tricky one tho that barbtail poon, need a still hand lol

20. lol i just tried making some and i cant get it
tell me if yours works all the time
i just tried making 5 and none worked!
ill get one eventually
happy yours worked good job

21. SRL Junior Member
Join Date
Oct 2006
Posts
35
Mentioned
0 Post(s)
Quoted
0 Post(s)
crap, im probably waaay ahead of myself here but:

SCAR Code:
program fisher;var barbtail, x, y: Integer;procedure findbarbtail;begin barbtail := DTMFromString('78DA63BCC0C8C0E001C448C0C1C28EE13F900' +       '689FE0702C6D340961DAA1A5111110639A81A1060BC4A849A3340' +       '962F01355708AB0100F8530CA0');       if FindDTM(barbtail,x,y,1,1,200,200) then       writeln('found barbtail');end;procedure equipbarb;begin function ClickMSDTM(DTM: Integer): true;end;beginfindbarbtail;equipbarb;end.

result:
Failed when compiling
Line 15: [Error] (15:1): Identifier expected in script

why?

22. ROFL
replace
function ClickMSDTM(DTM: Integer): true;

with
ClickMSDTM(barbtail)

23. SRL Member
Join Date
Apr 2006
Posts
207
Mentioned
0 Post(s)
Quoted
0 Post(s)
One quick question about dtms, what is the area size and shape? Is it like the tolerance of where the point can be or is it the actual area of the point or something else?

24. I think with DTMs where their is more instances of the color than just the parent you will have to add to the area field for the parent. TY for help on MSN yohojo.

25. The Area Size is like a position tolerance. So, if the point moves around like something on the minimap would, you will still pick it up as long as that point falls within the area you specify. I've had the best luck with the normal square area shape and increasing area sizes as necessary.

This is NOT needed for items in inventory, since they do not change size or shape. Also, do NOT increase the area size for the original parent pixel. That will just make it lag as it searches every point multiple times, and it won't find things any better. Only change the area sizes for surrounding pixels.