PDA

View Full Version : Correctly Creating/Using a DDTM



Blumblebee
05-14-2009, 01:02 PM
Alright, so I've noticed an incredible amount of DDTM's created with static colors or tolerances, and frankly they are a waste of space and memory. So this tutorial will teach you how to correctly use a DDTM.

Table of Contents
I. - Introduction to DDTM's
II. - Autocoloring DDTM's
III. - Changing the Tolerance
IV. - Side notes
V. - End Credits

I. Introduction to DDTM's

So, if your reading this your interested in using a ddtm (correctly). The easiest way to create a ddtm is by using nielsie95's DDTM editor. You can find it in includes>SRL>Scripting Tools, or simply download it here (http://www.villavu.com/forum/showthread.php?t=25312). Now lets start with a DDTM of the varrock road. We will use create our bitmap using PrintScreen, found on the upper right of your keyboard. After we capture the image we should input it into the DDTM editor by going Image>PasteImage.

Now lets actually make the DDTM by creating one mainpoint with the areasize of 1, tolerance of 0, and 3-4 subpoints. All of the points must be on the road, else the DDTM will not work! The end result will look something like this.

http://i40.tinypic.com/idhtvb.jpg

alright so lets go File > DDTM to Text to get our output and copy and paste that into scar. The code will look similiar to this.

function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 918;
dtmMainPoint.y := 375;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 8028292;
dtmMainPoint.Tolerance := 0;

dtmSubPoints[0].x := 918;
dtmSubPoints[0].y := 375;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 8028292;
dtmSubPoints[0].Tolerance := 0;

dtmSubPoints[1].x := 904;
dtmSubPoints[1].y := 372;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 8028292;
dtmSubPoints[1].Tolerance := 0;

dtmSubPoints[2].x := 933;
dtmSubPoints[2].y := 373;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 8028292;
dtmSubPoints[2].Tolerance := 0;

dtmSubPoints[3].x := 928;
dtmSubPoints[3].y := 377;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 8028292;
dtmSubPoints[3].Tolerance := 0;

dtmSubPoints[4].x := 913;
dtmSubPoints[4].y := 378;
dtmSubPoints[4].AreaSize := 1;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := 8028292;
dtmSubPoints[4].Tolerance := 0;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
Alright the first thing I want you to note, the first subpoint and the mainpoint are the exact same. This is not a problem really, just a small bug with nielsie95's DDTM editor, you can leave it, or what i usually do is remove it (you will then have to fix the array aswell).

Congratulations you have just made your first DDTM, although right now its nothing more than a DTM that takes up 10x the amount of lines.

II. Dynamic: Autocoloring Your DDTM

Alright, so lets get to the beef of the tutorial. This is what separates the DDTM's from the DTM's. you will notice in the code, that the mainpoint and all the subpoints have a color that looks like:

dtmSubPoints[4].Color := 8028292;

This is where we must add our autocolor. For this we will need to add a variable at the top of the function. Name it ACvar, and make it an integer.
var ACvar: Integer
Now we must set that to an autocolor, so before any of the DDTM is declare we must make ACvar := FindVarrockRoadColor; // Remember that this autocolor is for Varrock, substitute the autocolor you need here
But we still arent done. We must now change all the dtmSubPoints[4].Color := 8028292; to dtmSubPoints[4].Color := ACvar;
Making the overall Script look something like:
function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
ACvar: integer;
begin
ACvar := FindVarrockRoadColor;
dtmMainPoint.x := 918;
dtmMainPoint.y := 375;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := ACvar;
dtmMainPoint.Tolerance := 0;

dtmSubPoints[0].x := 918;
dtmSubPoints[0].y := 375;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := ACvar;
dtmSubPoints[0].Tolerance := 0;

dtmSubPoints[1].x := 904;
dtmSubPoints[1].y := 372;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := ACvar;
dtmSubPoints[1].Tolerance := 0;

dtmSubPoints[2].x := 933;
dtmSubPoints[2].y := 373;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := ACvar;
dtmSubPoints[2].Tolerance := 0;

dtmSubPoints[3].x := 928;
dtmSubPoints[3].y := 377;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := ACvar;
dtmSubPoints[3].Tolerance := 0;

dtmSubPoints[4].x := 913;
dtmSubPoints[4].y := 378;
dtmSubPoints[4].AreaSize := 1;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := ACvar;
dtmSubPoints[4].Tolerance := 0;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
Congratulations, you have now just autocolored your first DDTM, which now makes it a proper DDTM!

III. Dynamic: Tolerance Changing

Alright, another method for creating a proper DDTM is dynamic tolerance. For this section, we are going to include DDTM finding, aswell as declaration. So lets go back to the original model of our DDTM. we are going to add a Global variable first (This means a variable outside the Function/Procedure usually at the top of the script). So lets call our Global Variable ddtmTolerance, and we will make it an integer. So under
{.include SRL/SRL.scar}
Add:
var ddtmTolerance: integer;
Now lets head back to our DDTM and this time we will change all the Tolerances for the mainpoint and subpoints to this:
dtmMainPoint.Tolerance := ddtmTolerance;
In the end our script will now look like below:
function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
begin
ACvar := FindVarrockRoadColor;
dtmMainPoint.x := 918;
dtmMainPoint.y := 375;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 8028292;
dtmMainPoint.Tolerance := ddtmTolerance;

dtmSubPoints[0].x := 918;
dtmSubPoints[0].y := 375;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 8028292;
dtmSubPoints[0].Tolerance := ddtmTolerance;

dtmSubPoints[1].x := 904;
dtmSubPoints[1].y := 372;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 8028292;
dtmSubPoints[1].Tolerance := ddtmTolerance;

dtmSubPoints[2].x := 933;
dtmSubPoints[2].y := 373;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 8028292;
dtmSubPoints[2].Tolerance := ddtmTolerance;

dtmSubPoints[3].x := 928;
dtmSubPoints[3].y := 377;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 8028292;
dtmSubPoints[3].Tolerance := ddtmTolerance;

dtmSubPoints[4].x := 913;
dtmSubPoints[4].y := 378;
dtmSubPoints[4].AreaSize := 1;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := 8028292;
dtmSubPoints[4].Tolerance := ddtmTolerance;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;

Alright so now have that declared. So now we have a variable to change the tolerance, but it doesnt do anything yet. So lets make a DDTM finding procedure, we'll make it as so:
Function FindDDTMonMM: Boolean;
var x,y, theddtm: Integer;
begin
ddtmTolerance := 5;
theddtm := SetDDTM;
repeat
if not DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2) then
begin
IncEx(ddtmTolerance, 5)
FreeDTM(theddtm);
theddtm := SetDDTM;
end else
begin
Result := True;
Break;
end;
until (ddtmTolerance >= 50);
ddtmTolerance := 5;
FreeDtm(theddtm);
end;
Looks confusing, but really its not. Lets break it down step by step.
ddtmTolerance := 5; Pretty much self explainitory, we set the initial ddtmTolerance to 5.
theddtm := SetDDTM;we declare the ddtm so that it doesnt get constantly declared as the function repeats, this saves time and memory.
if not DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2) then this is just a basic way of finding a ddtm. Used mostly for finding ddtms on the Minimap.
IncEx(ddtmTolerance, 5) else
begin
Result := True;
Break;
end; ok so IncEx(the variable you want to increase, how much you want to increase the variable by). the "else" is used because we use an if then loop. so the script tries to find the ddtm if it doesn't (if not) then it increases the tolerance and continues through the loop. If it does find the DDTM then it makes the result true and then breaks out of the loop. We dont exit because we want to free the DDTM to save memory.
until (ddtmTolerance >= 50); Pretty much this is just a failsafe, if it continually cannot find the ddtm and the tolerance reaches a point of being 50 or higher, it breaks from the loop.
ddtmTolerance := 5;
FreeDtm(theddtm); the first line just resets the tolerance, just incase you use it in another procedure, you wouldnt want it to be 45 tolerance, so we reset it to 5 to be safe. The second line simply free's the DDTM.

Alright awesome, so you've sucessfully made your first ddtm with a dynamic tolerance! Congratulations.[/quote]

IV. Extra Notes

Here I will add all the extra stuff about DDTM's I can think of really that is somewhat helpful.

Ok, so this will be very brief as I'm tired. Declaring Multiple DDTM's is a very common mistake with many people. Some people think it takes numerous amounts of lines and procedures, when in reality its takes a very small amount. Here is an example of how I load numerous DDTM's.

var Rdcl: Integer;
Function SetWalkDtm(Number:Integer): Integer;
var MainPoint: TDTMPointDef; dtmSubPoints: Array [0..3] of TDTMPointDef; TempTDTM: TDTM; i: Integer;
begin
RdCl := FindVarrockRoadColor;
case Number of
0:
begin
with MainPoint do
begin
x := 934;
y := 378;
AreaSize := 1;
AreaShape := 0;
Color := RdCl;
Tolerance := 5;
end;
dtmSubPoints[0].x := 934;
dtmSubPoints[0].y := 378;
dtmSubPoints[1].x := 922;
dtmSubPoints[1].y := 375;
dtmSubPoints[2].x := 942;
dtmSubPoints[2].y := 375;
dtmSubPoints[3].x := 939;
dtmSubPoints[3].y := 381;
end;
1:
begin
with MainPoint do
begin
x := 915;
y := 375;
AreaSize := 1;
AreaShape := 0;
Color := Rdcl;
Tolerance := 5;
end;
dtmSubPoints[0].x := 907;
dtmSubPoints[0].y := 371;
dtmSubPoints[1].x := 921;
dtmSubPoints[1].y := 372;
dtmSubPoints[2].x := 908;
dtmSubPoints[2].y := 377;
dtmSubPoints[3].x := 920;
dtmSubPoints[3].y := 377;
end;
2:
begin
with MainPoint do
begin
x := 880;
y := 408;
AreaSize := 1;
AreaShape := 0;
Color := Rdcl;
Tolerance := 5;
end;
dtmSubPoints[0].x := 880;
dtmSubPoints[0].y := 408;
dtmSubPoints[1].x := 880;
dtmSubPoints[1].y := 400;
dtmSubPoints[2].x := 883;
dtmSubPoints[2].y := 416;
dtmSubPoints[3].x := 883;
dtmSubPoints[3].y := 412;
end;
end;
for i := 0 to High(dtmSubPoints) do
begin
dtmSubPoints[i].AreaSize := 1;
dtmSubPoints[i].AreaShape := 0;
dtmSubPoints[i].Color := RdCl;
dtmSubPoints[i].Tolerance := 5;
end;
TempTDTM.MainPoint := MainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;

ok so your probably like Wtf? So I'll walk you through it as best I can.

RdCl := FindVarrockRoadColor; this is exactly what Part II is about in the tutorial, its an autocolor for all the ddtm points. now, for the function, all I do is declare the DDTM mainpoints and subpoints through an index which is called in the function (so say I want the first ddtm, its simply SetWalkddtm(0); ) After all of these are declared, I call the static parts of each of the ddtm's subpoints such as areasize, areashape ect. I use High() so that I can have any number of subpoints I so choose. This is a little confusing I know, I'm just tired and dont want to type anymore, so later I may elaborate.

Alright Ready for part 2? So ever noticed that your ddtm could be found in different locations on the mm? And the script messes up becauseit finds the ddtm somewhere else? Well here comes your answer.

Ok so, the first thing you will notice when you call upon a ddtm would look something like this...
DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2)
Now the first thing you should note is that the DDTM searches the entire Minimap. Now how do we combat that? Well the easiest thing you can do is change the Minimap coords to fit your needs. so something like DtmRotated(theddtm, X, Y, MMcx, MMcy, MMX2, MMY2) that would look in the bottom right (third quadrant of the Minimap). Again you can substitue the coords there for flat out numerals for a more exact search. This is a point that many people forget to do when finding DDTM's. Here's the function I like to use when I call for DDTM's in walking,
Function DtmLocate(q, w, e, r, Dtm: Integer): Boolean;
var x, y, thedtm: Integer;
begin
thedtm := dtm;
Result := DTMRotated(thedtm, x, y, q, w, e, r);
end;

V. End Credits

Not many real credits, but some good reads if your still interested in DDTM's.
adding the (D) in (D)DTM's (http://www.villavu.com/forum/showthread.php?t=36278&highlight=ddtm)
Complete DDTM Walking Tutorial (http://www.villavu.com/forum/showthread.php?t=32608) (My personal Fav)
DDTM's and their uses (http://www.villavu.com/forum/showthread.php?t=26968)

So thanks for reading, and I hope you learnt something. :)

EvilChicken!
05-14-2009, 01:29 PM
Nice guide!

Though, I don't see the point of the very first image showing the RS client.
Just tell people to press PrintScreen and go into the DDTM editor and press "Paste Image".

And, by the way -- the DDTM editor is found in the "Scripting Tools" folder inside the SRL folder.
.. which again is in the includes folder. :rolleyes:

Blumblebee
05-14-2009, 11:34 PM
Nice guide!

Though, I don't see the point of the very first image showing the RS client.
Just tell people to press PrintScreen and go into the DDTM editor and press "Paste Image".

And, by the way -- the DDTM editor is found in the "Scripting Tools" folder inside the SRL folder.
.. which again is in the includes folder. :rolleyes:

didnt know that haha, I'll add. And yeah the first picture is kinda pointless so ill clean that part up. Thanks for the help :)

grimey
05-15-2009, 12:29 AM
thanks a ton blumblebee.
really helped me out a lot.

footballjds
05-15-2009, 12:31 AM
cool tut, ;) more DDTM's need to be used!!!!!!!!!

[offtopic]get addblockplus for FF
;)
and get rid of Yahoo!!! im about to puke!!!!![offtopic]

Torrent of Flame
05-15-2009, 12:48 AM
This helped me, but VarrockRoadColor fails, + the coordinates hardly ever work :P

footballjds
05-15-2009, 12:58 AM
lol, u need a varrock road colorer??
;)

i made one a while ago that works still ;)
ill post!
function Biggest(n1, n2 : Integer) : integer;
begin
if n1 > n2 then Result := n1 else Result := n2;
end;
function VrkRdClr : integer;
var
Points : TPointArray;
colors, UniqueColors, howmany : TIntegerArray;
i, a, timeTook, uniqLength, ColorLength : integer;
newColor : boolean;
Mostest : array[0..1] of integer;
begin
Result := FindVarrockRoadColor;
if not(Result = 0) then EXIT;
MarkTime(timeTook);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 8291463, MMX1, MMY1, MMX2, MMY2, 15);
colors := GetColors(Points);
ColorLength := Length(Colors) -1;
for i := 0 to ColorLength do
begin
NewColor := True;
for a := 0 to GetArrayLength(UniqueColors) - 1 do
begin
if(UniqueColors[a] = Colors[i])then
begin
NewColor := False;
Break;
end;
end;
if(NewColor)then
begin
SetArrayLength(UniqueColors, GetArrayLength(UniqueColors) + 1);
UniqueColors[GetArrayLength(UniqueColors) - 1] := Colors[i];
end;
end;
SetArrayLength(howmany, GetArrayLength(UniqueColors));
uniqLength := GetArrayLength(UniqueColors) - 1;
for I := 0 to uniqLength do
begin
for A := 0 to GetArrayLength(colors) - 1 do
begin
if UniqueColors[i] = colors[a] then Inc(howmany[i]);
end;
end;
for I := 0 to uniqLength do
begin
Mostest[0] := Biggest(HowMany[i], Mostest[0]);
Mostest[1] := i;
end;
for I :=0 to uniqLength do
begin
if Mostest[0] = HowMany[i] then break;
end;
if Mostest[0] < 400 then EXIT;
Result := UniqueColors[i];
Writeln('Took: ' + IntToStr(TimeFromMark(timeTook)));
Writeln('Road color is: ' + IntToStr(Result));
end;
function RdClr : integer;
var
clrs : TPointArray;
begin
FindColorsTolerance(clrs, RoadColor, MMX1, MMY1, MMX2, MMY2, 0);
if not (High(clrs) > 670) or (roadColor = 0) then
RoadColor := VrkRdClr;
Result := RoadColor;
end;


just call rdclr; ;) cause u don't want to get the clr unless it changed :D
works flawlessly :D

Blumblebee
05-15-2009, 06:13 AM
updated it a tad, I'm glad you guys like the guide :)

Sir R. M8gic1an
05-26-2009, 04:36 AM
it was brought to my attention on msn that you have an error on this tutorial :p


Function FindDDTMonMM: Boolean;
var x,y, theddtm: Integer;
begin
ddtmTolerance := 5;
theddtm := SetDDTM;
repeat
if not DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2) then
IncEx(ddtmTolerance, 5) else
begin
Result := True;
Break;
end;
until (ddtmTolerance >= 50);
ddtmTolerance := 5;
FreeDtm(theddtm);
end;


after increasing the tolerance, you don't Re-Load the DDTM.


Function FindDDTMonMM: Boolean;
var x,y, theddtm: Integer;
begin
ddtmTolerance := 5;
theddtm := SetDDTM;
repeat
if not DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2) then
begin
IncEx(ddtmTolerance, 5)
theddtm := SetDDTM;
end else begin
Result := True;
Break;
end;
until (ddtmTolerance >= 50);
ddtmTolerance := 5;
FreeDtm(theddtm);
end;


~RM

noidea
05-26-2009, 04:44 AM
it was brought to my attention on msn that you have an error on this tutorial :p


Function FindDDTMonMM: Boolean;
var x,y, theddtm: Integer;
begin
ddtmTolerance := 5;
theddtm := SetDDTM;
repeat
if not DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2) then
begin
IncEx(ddtmTolerance, 5)
theddtm := SetDDTM;
end else begin
Result := True;
Break;
end;
until (ddtmTolerance >= 50);
ddtmTolerance := 5;
FreeDtm(theddtm);
end;


after increasing the tolerance, you don't Re-Load the DDTM.


~RM


Function FindDDTMonMM: Boolean;
var x,y, theddtm: Integer;
begin
ddtmTolerance := 5;
theddtm := SetDDTM;
repeat
if not DtmRotated(theddtm, X, Y, MMX1, MMY1, MMX2, MMY2) then
begin
IncEx(ddtmTolerance, 5)
FreeDTM(theddtm);
theddtm := SetDDTM;
end else begin
Result := True;
Break;
end;
until (ddtmTolerance >= 50);
ddtmTolerance := 5;
FreeDtm(theddtm);
end;


You should free it to make sure no memory leaks, amirite?

Blumblebee
05-26-2009, 05:56 AM
hmmmm thank you I did not know this, always thought that you didnt need to reload the ddtm if your adjusting the constant, makes sense I guess. Updated the tutorial and +rep'd you guys.

XabdullahX
05-31-2009, 05:44 AM
Thx for a great tutorial :)
Helped me

Naum
08-15-2009, 07:59 PM
BlumbleBee, good tutorial. There is a critical error in the way your DDTM is made. Firstly in your screen shots you need to trim down the picture so it only shows MSX1 to MSY2. Secondly if the first point is not followed then your DDTM wont work. There is at least a 200+ pixel offset in your DDTM x and y points.

However, they were the only faults I could find. Nice to see someone else uses Niels' DDTM Editor. Great Tutorial :)

Coh3n
08-19-2009, 04:55 AM
I've always wondered this.. whenever I try and use DDTMs, it doesn't click anywhere near the points I picked as the subpoints. For example, I have a DDTM function that walks out of the Varrock west bank. It clicks the road fine, other than the fact that the area it clicks is no where near the main or subpoints.

I was just wondering if there was a specific reason for this. Here is the function, if you need to know.


program DDTMExample;
{.include SRL/SRL.scar}

var
DDTMTolerance : Integer;

function LoadDDTMs: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
RoadColor : Integer;
begin
RoadColor := FindVarrockRoadColor;
dtmMainPoint.x := 940;
dtmMainPoint.y := 400;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := RoadColor;
dtmMainPoint.Tolerance := DDTMTolerance;

dtmSubPoints[0].x := 940;
dtmSubPoints[0].y := 400;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := RoadColor;
dtmSubPoints[0].Tolerance := DDTMTolerance;

dtmSubPoints[1].x := 925;
dtmSubPoints[1].y := 400;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := RoadColor;
dtmSubPoints[1].Tolerance := DDTMTolerance;

dtmSubPoints[2].x := 944;
dtmSubPoints[2].y := 396;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := RoadColor;
dtmSubPoints[2].Tolerance := DDTMTolerance;

dtmSubPoints[3].x := 954;
dtmSubPoints[3].y := 399;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := RoadColor;
dtmSubPoints[3].Tolerance := DDTMTolerance;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;

function WalkOutOfBank: Boolean;
var
TheDDTM, x, y : Integer;
begin
DDTMTolerance := 5;
TheDDTM := LoadDDTMs;
repeat
if not DTMRotated(TheDDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
Writeln('Didn''t find DDTM, increasing tolerance...');
IncEx(DDTMTolerance, 5);
FreeDTM(TheDDTM);
TheDDTM := LoadDDTMs;
end else
begin
Writeln('Found Varrock road!');
Mouse(x, y, 4, 4, True);
Result := True;
Break;
end;
until((DDTMTolerance >= 50) or not LoggedIn);
DDTMTolerance := 5;
FreeDTM(TheDDTM);
end;

begin
ClearDebug;
SetupSRL;
ActivateClient;
if WalkOutOfBank then
Writeln('Walking out of the bank.')
else
Writeln('Couldn''t walk out of the bank.');
end.


Also, I really like how you utilize the repeat..until loop. I've never seen it used like that before, so very nice. ;)

marpis
08-19-2009, 05:50 AM
You could explain Areasize, which is very essential when making subpoints of ladders, doors or trees :) Also, that picture is kinda weak, and the DTM you have in it is not that good either. I could bet it finds the DTM in other cords too, thus having a chance to fail.

Blumblebee
08-19-2009, 01:10 PM
You could explain Areasize, which is very essential when making subpoints of ladders, doors or trees :) Also, that picture is kinda weak, and the DTM you have in it is not that good either. I could bet it finds the DTM in other cords too, thus having a chance to fail.

Thank you for the advice. I guess I thought that I had Explained Area Manipulation, Example being, I make one Road DDTM then change the area of searching thus allowing saved code space. When I get time (tommorrow or something) I'll update with a better explaination of area manipulation, areasize, and a different DDTM. Thanks again :)

ShowerThoughts
08-19-2009, 06:21 PM
You have firefox but no ad-block plus?

Sounds like you put some effort in it.

EvilChicken!
08-19-2009, 08:51 PM
Coh3n, whenever a DDTM is found, the resulting X and Y coordinates of the found DDTM are stored by the location of the DDTM's main point. Are you sure that the coordinates of your DDTM's main point match with where you want to click?

Coh3n
08-19-2009, 10:21 PM
Coh3n, whenever a DDTM is found, the resulting X and Y coordinates of the found DDTM are stored by the location of the DDTM's main point. Are you sure that the coordinates of your DDTM's main point match with where you want to click?

Yes, the main point is on the road, just outside the bank's doors. And every time it finds the DDTM, it clicks way west, around where the guards are, know where I mean?

Blumblebee
08-20-2009, 12:18 AM
Coh3n: change the search location. Dont make it search the whole mm, make it search half of it or just a small area where your ddtm is located.

Coh3n
08-20-2009, 12:25 AM
Coh3n: change the search location. Dont make it search the whole mm, make it search half of it or just a small area where your ddtm is located.

Okay, I'll do that too. I got it to work by simply changing the DDTM. I don't know if the original one I made was too close to where it was clicking or what, but either way I made it work. :)

Thanks guys for the help.