PDA

View Full Version : DTMs For Noobies - By R1ch



Rich
07-06-2009, 12:36 AM
http://h.imagehost.org/0859/DTMs_for.jpg (http://h.imagehost.org/download/0859/DTMs_for)

In this tutorial, I am going to teach you how to create, and use your own DTMs.

Now before we start, I would like to say: No matter how hard they look, and how other tutorials may make them look, DTMs are easy. I wouldn't lie to you. Also, if you do not know how to use a DTM, you are not a noobie :p

For my example, I am going to find bones in my inventory. I may do another example for the mini-map if I feel like it.


Step 1: Print-screen RS with bones visible in your inventory.

Step 2: Open up MS Paint, and then press Control-V.

Step 3: Trim the picture down, so all that is visible is the bones, with the black outline, like this: http://h.imagehost.org/0360/BonesBig.jpg (http://h.imagehost.org/download/0360/BonesBig)

I suggest zooming in 10x to do this. To zoom 10x, click a few pixels below where it says 8x. Trust me, it's there. DO NOT CLOSE MS PAINT!

Step 4: Open up SCAR 3.20d.

Step 5: Target the bones in MS Paint with the crosshair http://h.imagehost.org/0574/Crosshair.jpg (http://h.imagehost.org/download/0574/Crosshair)

Step 6: Click on Tools, then DTM Editor (see picture below).

http://h.imagehost.org/0984/Tools_to_editors.jpg (http://h.imagehost.org/download/0984/Tools_to_editors)

If you have done everything correctly so far, you should now see a window like this:

http://h.imagehost.org/0785/DTM_Editor.jpg (http://h.imagehost.org/download/0785/DTM_Editor)

For the three bullet points at the top, make sure the top one is ticked.

Step 7: Move your mouse over the white centre bit of the bones. You should see something like this:

http://h.imagehost.org/0939/CentreZoomed.jpg (http://h.imagehost.org/download/0939/CentreZoomed)

Make sure when making a DTM of an item in the inventory that the main point is near to the middle of the item.

Step 8: Click. You will now see a little yellow dot flashing where you clicked, like this:

http://h.imagehost.org/0883/BonesMainPoint.jpg (http://h.imagehost.org/download/0883/BonesMainPoint)

This is your mainpoint.

Step 9: Remember I told you to keep the black outline? Well it plays a vital part in using DTMs. The black outline around objects never changes colour, and we use it for our subpoints.

Click some of the points on the black outline, so now we have something that look likes this:

http://h.imagehost.org/0637/Points.jpg (http://h.imagehost.org/download/0637/Points)

Now we can see on the little picture that there are little red lines on it. These represent the subpoints that you chose by clicking on the black outline.

Also, notice on the right hand side the list of points and colours. If any of the colours (highlighted red) apart from the mainpoint (highlighted blue) do not have their colour as 65536, then delete that point by clicking on it, and pressing Delete (highlighted green). Then simply just choose another subpoint where the other one used to be.

Step 10: Set the tolerance! Around 15 is normally good.

Step 11: Press File, then Save (see picture below). Then save it where you want, and name it what you want.

http://h.imagehost.org/0858/Save.jpg (http://h.imagehost.org/download/0858/Save)

Step 12: Close the DTM Editor.

Step 13: Open the DTM Editor :p

Step 14: Press File, then Open, and open the DTM you just saved. Open up RS, and focus it with the crosshair.

Step 15: Press Test, then Find DTM... (see picture below).

http://h.imagehost.org/0883/FindDTM.jpg (http://h.imagehost.org/download/0883/FindDTM)

Step 16: Now open your saved DTM again.

Step 17: If you completed everything correctly, you should get something like:

http://h.imagehost.org/0512/Found.jpg (http://h.imagehost.org/download/0512/Found)

Press either No or Cancel. Then press File, then DTM to text. This will put a whole load of letters and number in your debug box.

Sometimes you will get this:

http://h.imagehost.org/0110/NotFound.jpg (http://h.imagehost.org/download/0110/NotFound)

Don't panic. Raising the tolerance may sort this out, so try that first. If it doesn't, just go through the tutorial again, and eventually, you will get a working DTM.

Step 18: Now assuming that you have a working DTM, go back to SCAR. Now we are going to start scripting. Of course, we include SRL. So now we have:
program New;
{.include SRL/SRL.scar}

begin
SetupSRL;
end.

Step 19: Let's add all of our variables in. This time, they are all integers. You will see why we have BoneDTM later on. If you don't know what X and Y are for, then I suggest you read some more beginners tutorials. Now we have:
program New;
{.include SRL/SRL.scar}

var
X, Y, BoneDTM : Integer;

begin
SetupSRL;
end.

Step 20: Let's actually do something with this DTM. Let's load it, and then make a FindBone function, and then a ClickBone procedure. Now we have program New;
{.include SRL/SRL.scar}

var
X, Y, BoneDTM : Integer;

procedure LoadDTM;
begin
end;

function FindBone : Boolean;
begin
end;

procedure BuryBone;
begin
end;

begin
SetupSRL;
end.
So put the whole load of letters and numbers in the debug box into the LoadDTM procedure to make it like this:
procedure LoadDTM;
begin
DTM := DTMFromString('78DA63E4636060E061400115F9F9609A11C A6' +
'7140512AC0C688011558D1490E025A0861F48F01350C34D84 39EC' +
'40828B0835EC04D480FCCD8C5F0D00F819022D');
end;
But remember when we named our variables, we had BoneDTM? That was the new name of our DTM, and all the letters and numbers are our DTM. So we need to change
DTM:= DTMFromString('
to
BoneDTM:= DTMFromString('

Now let's do something with that FindBone function. First off, why is it a function? It's a function so it can return true of false, depending on whether it finds our DTM or not.
function FindBone : Boolean;
begin
Result:= FindDTM(BoneDTM, X, Y, MIX1, MIY1, MIX2, MIY2);
end;
What this means is that it will return true if it finds BoneDTM, at X, Y in the inventory. MIX1, MIY1 etc. are the inventory coordinates.

The penultimate part, and that's clicking the bone.
procedure BuryBone;
begin
if FindBone then
Mouse(X, Y, 7, 7, True);
end;
If FindBone returns true, then it will move the mouse to where it found the DTM with X and 7 Y randomness.

Now to sort our main loop. Currently, it's like this:
begin
SetupSRL;
end.
But after a bit of typing, we turn it into this:
begin
SetupSRL;
LoadDTM;
BuryBone;
FreeDTM(BoneDTM);
end.
We don't need to call FindBone, because it's called in BuryBone. And that the...Hang on! What's FreeDTM?! FreeDTM is a function which releases our DTM into the atmosphere to reduce lag on our PCs. It should always be used with DTMs.

Well, that's it for this tutorial. I hope you have learned something from it. If you need any help or advice, keep it to yourself. Nah, just kidding...Post it if you need to, and I'll get back to ASAP.

Richard.

Dynamite
07-06-2009, 12:38 AM
Looks good, and detailed.
I guess you have looked at this then:
http://villavu.com/forum/showthread.php?t=31021&highlight=Dtms
;)

T~M

ShowerThoughts
07-06-2009, 12:40 AM
Nice, One question though:
If you create the dtm from a picture and you test the dtm on that dtm it will always find it... so tell them to focus rs... right?

Rich
07-06-2009, 12:43 AM
Looks good, and detailed.
I guess you have looked at this then:
http://villavu.com/forum/showthread.php?t=31021&highlight=Dtms
;)

T~M

I knew that Dusk had a TPA tut, that's where I got the idea for the banner, but I didn't know he had a DTM tut.


Nice, One question though:
If you create the dtm from a picture and you test the dtm on that dtm it will always find it... so tell them to focus rs... right?

Will edit in a second.

Thanks for the feedback guys. My fingers have gradually being getting shorter from all the tut writing I've been doing recently :p

Richard

EDIT: Hermen's point added.

ZaSz
07-06-2009, 03:40 AM
Very Nice guide.

Rich
07-06-2009, 04:23 AM
Thanks ZaSz. Are there any ways, in your opinion, that I could improve it?

Thanks,
Richard

Naum
07-06-2009, 04:42 AM
You might want to change your title..
Good tut btw, I'm doing a tut on all three.

Rich
07-06-2009, 04:54 AM
Ok then. I'll change it to DTMs for Noobies.

All three what?

EDIT: Thanks to whoever changed the title.

Neehosoft
08-02-2009, 03:43 PM
nice tutorial
lol'd at the dummies book thing

Yush Dragon
08-13-2009, 02:35 AM
:/
My mouse is not clicking it:/