PDA

View Full Version : DDTMs and their uses



Raskolnikov
03-05-2008, 04:37 AM
DDTMS
Their Uses

DDTMs can be used for map walking (walkpath, or finddtmrotated)
They can also be used for finding objects that change colors often.

How to Use them

Now, how do you use them? First off, a ddtm is basically a dtm that can be changed during runtime. So, how to make them? I personally use the method of taking a color point. Here's an example (my script):

function LoadShrimp: integer;
var
fishMP: TDTMPointDef;
fishSP: array of TDTMPointDef;
fishDDTM: TDTM;
begin
SetArrayLength(fishSP, 3);

fishMP.x := 557;
fishMP.y := 301;
fishMP.areasize := 1;
fishMP.areashape := 0;
fishMP.color := 6982976;
fishMP.tolerance := 9;

fishSP[0].x := 606;
fishSP[0].y := 296;
fishSP[0].areasize := 1;
fishSP[0].areashape := 0;
fishSP[0].color := 65536;
fishSP[0].tolerance := 0;

fishSP[1].x := 619;
fishSP[1].y := 313;
fishSP[1].areasize := 1;
fishSP[1].areashape := 0;
fishSP[1].color := 65536;
fishSP[1].tolerance := 0;

fishSP[2].x := 632;
fishSP[2].y := 293;
fishSP[2].areasize := 1;
fishSP[2].areashape := 0;
fishSP[2].color := 65536;
fishSP[2].tolerance := 0;

fishDDTM.MainPoint := fishMP;
fishDDTM.SubPoints := fishSP;
result := AddDTM(fishDDTM);
end;

Okay, let me walk you through this.

SetArrayLength(fishSP, 3);

is used to set the array length of how many sub points your DDTM will have.

fishMP.x := 557;
fishMP.y := 301;

These are the coordinates for your main point.

fishMP.areasize := 1;
fishMP.areashape := 0;

These two lines aren't to be worried about, not even on the subpoints.

fishMP.color := 6982976;

This is the color of your main point

fishMP.tolerance := 9;

This is the tolerance of your main point.

Now onto the subpoints. Many of the concepts are the same when declaring the subpoints, but some are still different.

fishSP[0].x := 606;
fishSP[0].y := 296;

These are the coordinates of your subpoint.

fishSP[0].color := 65536;

This is the color of your sub point. It is usually this when you are dealing with items, but it is different when map walking.

fishSP[0].tolerance := 0;

This is usually the tolerance for items, if your using the black line, but if you are map walking, use this to suit you.

Now, onto how to make it into something usable!

fishDDTM.MainPoint := fishMP;
fishDDTM.SubPoints := fishSP;
result := AddDTM(fishDDTM);

Okay, the first line is declaring the DDTM's main point.
The second is declaring the sub points.
The final one turns the ddtm into an integer where you can use it!
Now you can use your DDTM like this:

if FindDTM(LoadShrimp, blah blah) then
DoSomething;

Edit:

You might ask, what if I want the same shape, but different colors? Do I have to make a whole new ddtm for each type of object?

Answer: No, you can make a case statement:

case BarType of
'iron': TheColor := 2107921
'steel' //ect...

Then, in your ddtm main point color put this:

BarThing.color := TheColor;

Thanks for reading my tutorial, and I hope you learned how to use DDTMs!

Cut em2 it

Lee Lok Hin
03-05-2008, 08:09 AM
Wow! Thanks. Finally know how to use a DDTM. Still minorly confused about RadialWalk though, they never work for me. Still, thanks, and rep+

Pure1993
03-06-2008, 07:18 PM
ahhh man, about two weeks too late, would have made it a lot easier...
Ah well, guess I can't re-gain lost time, so I'll just say: Awesome tut! :)
EDIT: btw, I would suggest you add a section on how to use it in a case, increasing tol and area. :)

Raskolnikov
03-06-2008, 10:48 PM
I will do that later ;)

Torrent of Flame
03-10-2008, 05:20 PM
Mwuha, I have a DDTM now :]

Thanks man. I can use this in my script to up my chances of SRL acceptance.

Rep++

HellBoyz
03-17-2008, 04:02 AM
Nice Shot mate, Bookmark ... lol

skilld u
03-24-2008, 02:13 AM
This is the first tut that I've read that I could understand. All the other DDTM tuts are way too confusing. Thanks so much.

faster789
03-25-2008, 05:26 AM
this mite be stupd...but u know the "blah blah" part in ur tut?...maybe you xplain wat goes thr???

but awsum TUT luv it...
++REP

EDIT: Well why do we need this kind of function when we have DTMFromString('therandom numbersandletters');

and if both work which ones better? and wats the difference?
and another question...you know the DTM editor? when we printscrn the runescape screen to paint, do we then delete everything and only leave the item (in this case a picture of an iron ore)? then wen we open DTM editor we press edit paste rite??... and im not shurr why but wen i keep tryin this script out it never seems to find the ironore.... this is the script sum1 plezzz help and THANKs!:
program Dtmtest;
{.include SRL/SRL.scar}
function Loadiron: Integer;
var
ironMP: TDTMPointDef;
ironSP: array of TDTMPointDef;
ironDDTM: TDTM;

begin
SetArrayLength(ironSP, 5);

ironMP.x := 20;
ironMP.y := 17;
ironMP.areasize := 1;
ironMP.areashape := 0;
ironMP.color := 2305870;
ironMP.tolerance := 9;

ironSP[0].x := 6;
ironSP[0].y := 23;
ironSP[0].areasize := 1;
ironSP[0].areashape := 0;
ironSP[0].color := 65536;
ironSP[0].tolerance := 0;

ironSP[1].x := 13;
ironSP[1].y := 7;
ironSP[1].areasize := 1;
ironSP[1].areashape := 0;
ironSP[1].color := 65536;
ironSP[1].tolerance := 0;

ironSP[2].x := 24;
ironSP[2].y := 8;
ironSP[2].areasize := 1;
ironSP[2].areashape := 0;
ironSP[2].color := 65536;
ironSP[2].tolerance := 0;

ironSP[3].x := 30;
ironSP[3].y := 15;
ironSP[3].areasize := 1;
ironSP[3].areashape := 0;
ironSP[3].color := 65536;
ironSP[3].tolerance := 0;

ironSP[4].x := 18;
ironSP[4].y := 26;
ironSP[4].areasize := 1;
ironSP[4].areashape := 0;
ironSP[4].color := 65536;
ironSP[4].tolerance := 0;

ironDDTM.MainPoint := ironMP;
ironDDTM.SubPoints := ironSP;
result := AddDTM(ironDDTM);


end;
var x,y: integer;
begin
SetupSrl;
ActivateClient;
Loadiron;
if FindDTM(Loadiron,x,y,1,1,200,200) then
writeln('braaapp');
if not FindDTM(Loadiron,x,y,1,1,200,200) then
writeln('crappp');
end.

Raskolnikov
03-31-2008, 12:13 AM
This is better because you can add tolerance to the dtm. I am going to make the case part now ;)

Cut em2 it

faster789
04-06-2008, 12:35 AM
so if i were using DDTMS....rather than using if Dtmrotated i use if DDTMrotated or does it just stay if DTMrotated

Cazax
04-06-2008, 12:37 AM
so if i were using DDTMS....rather than using if FindDTM i use if FindDDTM or does it just stay if FindDTM

Use DTMRotated, or FindDTMRotated, FindDTM is static.

faster789
04-08-2008, 02:14 AM
hmmm so how would you use this in a map walking procedure,, every1 advises me to use the path thing but how can i use it after looking at this?
What is the main point and wats the sub points?

Raskolnikov
04-16-2008, 12:24 AM
Path is a ddtm. It is a ddtm without the colors. You use these ddtms for better item finding, and map walking. You can use finddtmrotated for more accuracy. I feel more comfortable using ddtms for map walking than path.

The sub points, are, the end points of the ddtm, there is a main point that defines the middle of the dtm, then other points extend outside the main point.

Cut em2 it

PvH
04-16-2008, 01:57 PM
very nice tut man,
i'll try to make ddtms now ^^
very usefull tut:)
rep++;)