SRL Archive - OSR Intermediate Scripting Tutorials

DTM Tutorial Basics


BobboHobbo

2008-01-26 03:54:50

DTM Tutorial - Basics


[RIGHT]Last Updated: Sunday 13th of May 2012.[/RIGHT]

First of all, What is a DTM?
[INDENT]A DTM is a Deformable Template Model, which is used to find objects and other static items in the Runescape Client, by recorded points of colours and size.[/INDENT]

Making a DTM.

[INDENT]Firstly, have the item you wish to make the DTM of ready, next go into Simba Tools > DTM Editor.
A window should show up with the Runescape screen on it. Ill be using a yew log for my example.
[/INDENT]

[INDENT]
Now click the centre of the item you are creating the DTM for (Yew Log for example) and a dot should appear, now go to the tolerance on the right and make it 30 (because items dont have static colours, except for the outline)[/INDENT]

[INDENT]Now click the edges of the Item your making the DTM like:[/INDENT]



[INDENT]No need for tolerance for the edges is needed.

NOTE* All outlines of ITEMS are constant, meaning you dont need tolerance, this will make your DTM alot more accurate.

Now go DTM > Print DTM to text. You will see letters and numbers in your debug, example:


DTM := DTMFromString('78DA636C6462609064644006C1F65C601A26C' +
'A580954A382AA06260B57D30354234F404D17508D2001350D4035' +
'FC04D49411A1A600A84602BF1A00FCF004DF');

Make a Integer of the name you want to call your DTM. I named mine YewLog.[/INDENT]

Using DTM's
[INDENT]

Program DTM;
{.include SRL/SRL.simba}
Var
Yewlog:integer; //The Name of the DTM
X,y:integer; // The X and the Y to store the cords for the DTM.

Procedure LoadDTM;
Begin
Yewlog := DTMFromString('78DA636C6462609064644006C1F65C601A26C' +
'A580954A382AA06260B57D30354234F404D17508D2001350D4035' +
'FC04D49411A1A600A84602BF1A00FCF004DF');
end;

Procedure FindItem;
Begin
if FindDTM(Yewlog, x, y, MIX1, MIY1, MIX2, MIY2) then // MI is the cords of the Invent
begin
MMouse(x,y,5,5); // Hovers over log
If Isuptext('Yew Log')then // If text up yew log it will click it
begin
mouse(x,y,5,5,true);
end else
Writeln('No DTM found'); // If cant find DTM it will say this.
end;
end;

Begin
SetupSRL; // MAIN LOOP
ActivateClient;
LoadDTM; // CALL the loading first
FindItem;
end.
[/INDENT]
Freeing DTM's
[INDENT]Why to free DTM's?
Without freeing your DTM's it will clog up your computer thus slowing its performance down, if you miss FreeDTM's the only way to restore your computer to full performance again is to restart your computer, but to prevent this just use FreeDTM after using the DTM and calling the DTM when you wish to use it again.

Heres an example of how to use it. (Just put the name of the DTM you wish to free, mine was Yewlog, so i would yewlog in between the ().
FreeDTM(DTMNAMEHERE);

Make sure you re-call the loadDTM; before you search a DTM again, or you could just have the DTM seperate before the function of finding and object using DTM.

There you have it.[/INDENT]

HayHay89

2008-01-26 04:30:16

awesome tut another thing closer to havin all requirments for srl member

Heavenzeyez1

2008-01-26 04:35:08

Isn't here in SRL-Forums 1 already?:)
Because i learned it already from here. But awsome and easy to learn TUT. ;)
Eerik.

anoobis

2008-01-27 18:32:02

I usually have my computer running in size 800 x 600. Does this mean that Scar wont be able to recognize DTMs taken at 1024 x 768, even if theyre the exact same items? If this is the case i would need to change my size to 1024 x 768.

Great Tutorial By the Way

I also found that when when the mouse is about to hightlight the item the Item name may lag, even for a mili second, causing the DTM not to be found. When i added wait(100) just before the If isuptext, it worked 100% of the time. Is this a good idea or a waste of time.

Thanks, Anoobis

BobboHobbo

2008-01-28 02:58:48

Guess its good, glad you like it.

Negaal

2008-01-28 04:54:23

Nice tutorial, very understandable, at least for me.
1 Note.
If you use mouse(x,y,5,5) then the area is(may be) like this
:::::::
:::ooo
:::ooo

if you do Mouse(x-5,y-5,10,10) or you make centrepoint to top-left corner then the area is like this
……..
:oooo:
:oooo:
''''''''''''''

BobboHobbo

2008-01-28 09:04:33

From: Negaal
Nice tutorial, very understandable, at least for me.
1 Note.
If you use mouse(x,y,5,5) then the area is(may be) like this

if you do Mouse(x-5,y-5,10,10) or you make centrepoint to top-left corner then the area is like this


Yup, i added randomness forgot about it -.-

The Intern

2008-01-31 04:50:05

Ty.. this was well needed, gona use this very soon :)

Edit: rep ++ :)

Jezzie Frizzle

2008-03-18 09:40:02

Is it essential that you always make your start point the middle? What would happen if you made all the outside points go towards the same direction? The reason I say this is because Ive tried making DTMs and have been successful with finding them in the inventory but not on the minimap. Actually I managed to get one on the minimap but that was by luck. Im using the rotate DTM function also just for the record. Anyway great job. :)

BobboHobbo

2008-03-24 08:15:12

Shouldnt use DTM's on main screen anyway really unreliable.

AzulDrake

2008-08-25 01:50:27

Thanx for the tut, help fill in the gaps I still had about DTMs

wired357

2008-11-28 23:31:31

Shouldnt use DTM's on main screen anyway really unreliable.


What should be used to locate things on the main screen? I only ask here because I haven't found it elsewhere yet and I am trying to figure out if my script idea is workable or not.

Huckleberry

2009-03-04 11:03:59

Great Tut! One of the best. keep it up.

BobboHobbo

2012-05-13 02:03:22

Updated to be a little nicer :).

Leyser

2012-05-15 13:15:35

Very helpful guide,
Thanks a bunch!

:D

BadKarma

2012-11-18 19:00:10

Easy read and easy to understand. Thank you very much for the help.

elmostreet

2012-11-20 20:03:49

If MIX1, MIY1, MIX2, MIY2 is used for inventory and MIS1, MIS1, MIS2, MIS2 for the main screen. How about the mini-map portion?

thanks.

riwu

2012-11-20 20:10:27

From: elmostreet
if mix1, miy1, mix2, miy2 is used for inventory and mis1, mis1, mis2, mis2 for the main screen. How about the mini-map portion?

Thanks.

mmx1, mmy1,….

euphemism

2012-11-20 20:11:12

From: elmostreet
If MIX1, MIY1, MIX2, MIY2 is used for inventory and MIS1, MIS1, MIS2, MIS2 for the main screen. How about the mini-map portion?

thanks.


Main Screen: MSX1, MSY1, MSX2, MSY2

Inventory: MIX1, MIY1, MIX2, MIY2

Minimap: MMX1, MMY1, MMX2, MMY2

Chatbox: MCX1, MCY1, MCX2, MCY2

elmostreet

2012-11-20 21:02:22

Thanks for the quick response. I copied your script and compiled it but it brings this error out. 'Duplicate identifier 'FINDITEM' at line 14 Compiling failed.'

riwu

2012-11-20 21:07:02

From: elmostreet
Thanks for the quick response. I copied your script and compiled it but it brings this error out. 'Duplicate identifier 'FINDITEM' at line 14 Compiling failed.'

Rename it to something else, FindItem2 or anything that doesn't already exist in the include.

elmostreet

2012-11-20 21:21:57

Thanks it worked. ;)

rj

2012-11-23 11:02:48

err what if your simba does not have a dtm editer? mine is up to date

danny2010

2012-11-23 18:42:10

You need to enable the extension for the dtm editor to show ( View-> Extensions->dtm_editor ) click it and select enable then you will find the dtm editor it in the tools menu

mounty

2012-11-27 07:13:26

Nice tut. I love DTMs, they are so easy to make and use (and in my case overuse).

chongc

2012-12-09 18:38:58

just a question about dtms in general, why do some dtms appear as long sequences but others are like xxx+yy+zzz with a few sequences?

GetHyper

2013-03-06 04:53:09

Thank you for this, im still getting my head around it all but it helps :)

JYG

2013-04-09 02:28:41

Thanks for this tutorial!

However, I am unable to see the picture describing:

From: BobboHobbo
[INDENT]Now click the edges of the Item your making the DTM like:[/INDENT]



[INDENT]No need for tolerance for the edges is needed.

[/INDENT]


Anyone that has an alternate picture describing the process or can explain it in words.

Thanks

Sjoe

2013-04-09 03:41:01

From: JYG
Thanks for this tutorial!

However, I am unable to see the picture describing:



Anyone that has an alternate picture describing the process or can explain it in words.

Thanks


Check Yohojo's video on DTM's