PDA

View Full Version : A Waddo style DTM tut



Waddo
07-11-2008, 01:04 PM
Hi recently ive been making a few tutorials one of which is my beginners handbook, I am writing this to supplement my beginners hand book.

DTM's are a brilliant way to find items and once you have made one you will find out how easy they really are.

It takes me about 30 seconds to make a DTM and here 99.99% accurate if done properly.

How are WE going to do this.

Simple.
http://www.tip.it/runescape/item2/Red_partyhat.png

We're going to make a phat DTM.


Here is one I made earlier.
program New;
Var
PHatDTM : Integer;
Begin
PHatDTM:=DTMFromString('78DA63BCC8C0C0B08A91011934 097331FC07D' +
'220D1FF40C0781EC85888AA06220B2381F47520B188809A7B 4062' +
'2501355780C416026A0E0389D5F8D500005F980E93');
end.

see that big long gobledegook forget about it scar will do that for you so don't get scared =].

Open scar

Use the cross hair to select the window in which the item is (we will be selecting SRL-forums).

Click Tools-->DTM Editor
and you will see a window with you client(thing you picked with cross-hair) in


What do we do

you set the PARENT point by clicking somewhere in the center of the PHat

on the options at the left set the tolerance to 255 (255 tol means this DTM will find all the party hats not just red if you want it to find just the red one set it at about 20 tol)

http://i13.photobucket.com/albums/a260/lumpy-custard/DTm1.jpg


What now

Well as Jagex are such idiots they made our life easy by putting a black outline around items so create about 5 sub points by clicking on the black outline.

it should now look something like this.

http://i13.photobucket.com/albums/a260/lumpy-custard/dtm2.jpg

now hit file-->DTM To Text

close the window.

In scars debug box you will have something like

DTM := DTMFromString('78DA63BCC8C0C0B08A91011934097331FC0 7D' +
'220D1FF40C0781EC85888AA06220B2381F47520B188809A7B 4062' +
'2501355780C416026A0E0389D5F8D500005F980E93');

There's you DTM its called DTM but we will rename it PHatDTM.

Declare your DTM as an integer like below
and paste your DTM into your program.

program New;
Var
PHatDTM : Integer;
Begin
PHatDTM:=DTMFromString('78DA63BCC8C0C0B08A91011934 097331FC07D' +
'220D1FF40C0781EC85888AA06220B2381F47520B188809A7B 4062' +
'2501355780C416026A0E0389D5F8D500005F980E93');
end.

Done.


Using a DTM

The 2 main uses are


1.Finding an item

To do this use the function
FindDTM(DTMName,x,y,x1,y1,x2,y2);

DTMName is PHatDTM

x,y is the co-ords where the PARENT point is found

x1,y1,x2,y2 is the location to search

so if we want to find a PHat in our inventory we would use

MIX1,MIY1,MIX2,MIY2 as these are the constants for the inventory co-ords.


So
FindDTM(PHatDTM,x,y,MIX1,MIY1,MIX2,MIY2)

WARNING IF YOU HAPPEN TO HAVE A PHAT IN YOUR INVENT THIS WILL DROP IT YOU HAVE BEEN WARNED

program New;
{.include srl/srl.scar}
Var
PHatDTM, x, y: Integer;
Begin
setupsrl;
PHatDTM:=DTMFromString('78DA63BCC8C0C0B08A91011934 097331FC07D' +
'220D1FF40C0781EC85888AA06220B2381F47520B188809A7B 4062' +
'2501355780C416026A0E0389D5F8D500005F980E93');
If FindDTM(PHatDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
Begin
Mouse(x,y,0,0,False);
ChooseOption('Drop');
end;
end.
{.include srl/srl.scar} is needed to use the invent co-ords as these are part of srl.
if you use SRL you must use SetupSRL;
That will right click and drop your PHat.

Done.


2. Counting items in your inv

CountItems(DTMName,Type,Tolerance);
DTMName is PHatDTM.
Count items can be used for Bitmap's or DTM's where using DTM's so Type is 'DTM' (as a string)
the tolerance is only used in bitmaps so we want to do [0,0]

So
CountItems(PHatDTM,'DTM',[0,0]);


program New;
Var
PHatDTM : Integer;
Begin
PHatDTM:=DTMFromString('78DA63BCC8C0C0B08A91011934 097331FC07D' +
'220D1FF40C0781EC85888AA06220B2381F47520B188809A7B 4062' +
'2501355780C416026A0E0389D5F8D500005F980E93');
Writeln(IntToStr(CountItems(PHatDTM,'DTM',[0,0]));
end.

This will Writeln how many PHats are in you invent.

Done.

Now one last thing

at the end of you script put

FreeDTM(DTMName);
Eg.FreeDTM(PHatDTM);

Do it for al you DTM's
if you don't you will get memory leaks which will slow down you pc


Excercise

Make a script that will find and click on a sapphire but not on any other gem.
Hint:Tolerance of PARENT point.

Answer (http://www.srl-forums.com/forum/showthread.php?t=35301&garpg=4)

randy marsh
07-11-2008, 01:20 PM
nice tut im using it now for my first script!

Waddo
07-11-2008, 01:49 PM
Good luck

Scripting made easy. (http://www.villavu.com/forum/showthread.php?t=32568?p=429910#post429910)

Shady?
07-11-2008, 04:19 PM
noooooooooo
it dropped my white phat!!!!
lol jk

nice tut waddo, it has everything needed i think. going to check The Beginners HandBook =)

Rubix
07-13-2008, 06:48 PM
excellent tut, still think you should get a godly uber rank for your tolerence with my noobiness :P

randy marsh
07-13-2008, 08:54 PM
nice tut!

nething
07-23-2008, 05:46 AM
Awesome Tut and Tyvm. I was having troubles with my DTMs working after I reloaded RS (cuz colors changing) no matter what I set the Tolerance to. But Now I got them down and they still work after I reload RS. This has helped me a lot and I'm going to use this tut while writing my first script (fletching script about 50% done).

Waddo
07-23-2008, 02:02 PM
Good luck I hope you do well.

Magiic
08-05-2008, 09:25 PM
i don't get this...i've set the tolerance to 20 and everything yet when i set it up to click the dtm it doesn't find it and i have chosen all five subpoints on the black edge of the item and the mainpoint in the center

Waddo
08-05-2008, 11:24 PM
Paste what you are using atm and i will see if i can figure out why

Mariuswbz
08-15-2008, 07:59 AM
Thanks Waddo.

This thread learnt me about DTM's
Rep ++ :)

ConneX
10-09-2008, 08:51 AM
I try use dtm and:
Line 8: [Error] (8:18): Unknown identifier 'CountItemsDTM' in script

program New;
Var
OreDTM : Integer;
Begin
OreDTM:=DTMFromString('78DA63F4666260906164400653F CE41944803' +
'448F43F1030FA62AA3992AE095703028CC1986A40B2286A40 E6C8' +
'A3AA399689668E3F508D30AA9AB9C18A286A00E7980B46');
Writeln(IntToStr(CountItemsDTM('Inv',OreDTM)));
end.

Xanith
06-12-2009, 07:22 AM
Nice tut.
I tried to figure out DTMs by myself and failed, horribly.. =[
But with this tut, I figured them out.

Going to make a log burner now ^.^ or attempt to.

Feroc1ty
07-08-2009, 03:27 PM
I try use dtm and:
Line 8: [Error] (8:18): Unknown identifier 'CountItemsDTM' in script

program New;
Var
OreDTM : Integer;
Begin
OreDTM:=DTMFromString('78DA63F4666260906164400653F CE41944803' +
'448F43F1030FA62AA3992AE095703028CC1986A40B2286A40 E6C8' +
'A3AA399689668E3F508D30AA9AB9C18A286A00E7980B46');
Writeln(IntToStr(CountItemsDTM('Inv',OreDTM)));
end.


That's because the function doesn't exist.

function CountDTMs(dtm:integer):integer;
var i, x, y : Integer;
item : TBox;
Begin
Result := 0;
gametab(4);
For i := 1 to 28 do
Begin
Item := InvBox(i);
If FindDTM(DTM, x, y, Item.x1-5, Item.y1-5, Item.x2+5, Item.y2+5) then
Result := Result + 1;
end;
end;

Waddo
07-11-2009, 11:33 PM
This tut is outdated countDTM's was an old function I will adjust accordingly.