1. DDTM Walking With Your Own Auto Color Functions

DDTM Walking With Your Own Auto Color Functions

In this tutorial Im going to teach you how to use DDTM walking with your own TPAs and how to make your TPAs for DDTM walking.

Step one:
After you have decided where you want to walk to, pick your first place of where you want to walk to.
I am going to be walking from the Grand Exchange to the Varrock West Bank.

Now press the "Print Screen" button on your keyboard. Make sure you are in your starting position.

Step 2:

Now go to C:\Program Files\SCAR 3.21\Includes\SRL\Scripting Tools and open up "DDTM_editor.exe".

Click on Image when the program loads up, then select "Paste Image".

Scroll over to view the minimap.

Now click on where you want to walk to in the DDTM editor.

Now you just created a point and its called the "Main Point".

Now click on some colors close to the main point that are unique and should'nt be in the same spot if you move. PS: They dont have to be close but if they're close, the DDTM becomes more accurate. Make sure the colors you pick dont move.

Here is a picture of the points I made with the DDTM Editor.

You should have 2-4 sub points. I like to use 3.

Step 3:

Once you think the points you chose are good then go File > DDTM to Text.

You should have something along the lines of this:

SCAR Code:
function SetDDTM: Integer; var   dtmMainPoint: TDTMPointDef;   dtmSubPoints: Array [0..3] of TDTMPointDef;   TempTDTM: TDTM; begin   dtmMainPoint.x := 743;   dtmMainPoint.y := 284;   dtmMainPoint.AreaSize := 0;   dtmMainPoint.AreaShape := 0;   dtmMainPoint.Color := 7568507;   dtmMainPoint.Tolerance := 0;    dtmSubPoints[0].x := 743;   dtmSubPoints[0].y := 284;   dtmSubPoints[0].AreaSize := 0;   dtmSubPoints[0].AreaShape := 0;   dtmSubPoints[0].Color := 7568507;   dtmSubPoints[0].Tolerance := 0;    dtmSubPoints[1].x := 725;   dtmSubPoints[1].y := 280;   dtmSubPoints[1].AreaSize := 0;   dtmSubPoints[1].AreaShape := 0;   dtmSubPoints[1].Color := 15658734;   dtmSubPoints[1].Tolerance := 0;    dtmSubPoints[2].x := 762;   dtmSubPoints[2].y := 284;   dtmSubPoints[2].AreaSize := 0;   dtmSubPoints[2].AreaShape := 0;   dtmSubPoints[2].Color := 15658734;   dtmSubPoints[2].Tolerance := 0;    dtmSubPoints[3].x := 748;   dtmSubPoints[3].y := 242;   dtmSubPoints[3].AreaSize := 0;   dtmSubPoints[3].AreaShape := 0;   dtmSubPoints[3].Color := 195836;   dtmSubPoints[3].Tolerance := 0;    TempTDTM.MainPoint := dtmMainPoint;   TempTDTM.SubPoints := dtmSubPoints;   Result := AddDTM(TempTDTM); end;

Dont close the DDTM editor just yet!

Step 4:

The SetDDTM function will only hold one DDTM so lets make it hold multiple DDTMs.

Replace:

SCAR Code:
function SetDDTM: Integer; var   dtmMainPoint: TDTMPointDef;   dtmSubPoints: Array [0..3] of TDTMPointDef;   TempTDTM: TDTM; begin

With this:

SCAR Code:
function DDTMWalk(WalkNumber: Integer): Integer;var    dtmMainPoint: TDTMPointDef;    dtmSubPoints: array[0..3] of TDTMPointDef;    TempTDTM: TDTM;begin    case WalkNumber of        1: begin

At the end of the function add:

SCAR Code:
end;end;

Step 5:

Now its time to fix your standerds

Go to http://www.villavu.com/forum/showthread.php?t=3293 To learn SCAR Script Official Standards.

Here is my DDTM function at the moment.

SCAR Code:
function DDTMWalk(WalkNumber: Integer): Integer;var    dtmMainPoint: TDTMPointDef;    dtmSubPoints: array[0..3] of TDTMPointDef;    TempTDTM: TDTM;begin    case WalkNumber of        1: begin          dtmMainPoint.x := 743;          dtmMainPoint.y := 284;          dtmMainPoint.AreaSize := 0;          dtmMainPoint.AreaShape := 0;          dtmMainPoint.Color := 7568507;          dtmMainPoint.Tolerance := 0;           dtmSubPoints[0].x := 743;          dtmSubPoints[0].y := 284;          dtmSubPoints[0].AreaSize := 0;          dtmSubPoints[0].AreaShape := 0;          dtmSubPoints[0].Color := 7568507;          dtmSubPoints[0].Tolerance := 0;           dtmSubPoints[1].x := 725;          dtmSubPoints[1].y := 280;          dtmSubPoints[1].AreaSize := 0;          dtmSubPoints[1].AreaShape := 0;          dtmSubPoints[1].Color := 15658734;          dtmSubPoints[1].Tolerance := 0;           dtmSubPoints[2].x := 762;          dtmSubPoints[2].y := 284;          dtmSubPoints[2].AreaSize := 0;          dtmSubPoints[2].AreaShape := 0;          dtmSubPoints[2].Color := 15658734;          dtmSubPoints[2].Tolerance := 0;           dtmSubPoints[3].x := 748;          dtmSubPoints[3].y := 242;          dtmSubPoints[3].AreaSize := 0;          dtmSubPoints[3].AreaShape := 0;          dtmSubPoints[3].Color := 195836;          dtmSubPoints[3].Tolerance := 0;           TempTDTM.MainPoint := dtmMainPoint;          TempTDTM.SubPoints := dtmSubPoints;          Result := AddDTM(TempTDTM);        end;   end;end;

Step 6:

Because the MiniMap moves, you need to set the area size of each subpoint to something like 4. It really depends on how far the subpoints are from the mainpoint. The closer, the less areasize you need, the farther, the more area size you need. It also depends on how much of the color you picked is around that subpoint. But remember, the more areasize, the less acurate and more time it takes to find the DDTM.

Step 7:

Now its time to make a TPA to find the color of each subpoint since colors on the MiniMap change every couple of minutes.

Lets start of with making a TPA to find the color of the mainpoint.

Here would be a TPA function for finding my mainpoint color.

SCAR Code:
function FindFloorColor: Integer;var    TPA : TPointArray;begin    if FindColorsTolerance(TPA, 7568507, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y);  end;

Ill teach you how to make your own TPA function.

First, you have to make a function that gives a result as an integer.

Add: TPA : TPointArray; to your vars. This is where all of your points of the color are stored.

Now you have to find the colors that are close to the color of your point you chose in your DDTM.

Write: if FindColorsTolerance(-TPA-, -YOUR POINT'S COLOR-, MMX1, MMY1, MMX2, MMY2, -TOLERANCE-) then
-TPA- should be your TPA which in this case it would be just TPA.
MMX1, MMY1, MMX2, MMY2 are the coordinates to search for your point's color.
-TOLERANCE- should be the tolerance... youll have to experiment to find the perfect tolerance.

That makes the result of the function the color found for your point.

end;

Step 8:

Now make a TPA for all the rest of your points.

Step 9:

To do this...
Replace:
dtmMainPoint.Color := 7568507;

With:
dtmMainPoint.Color := -Your TPA function name-;

And Replace:
dtmSubPoints[0].Color := 7568507;

With: dtmSubPoints[0].Color := -Your TPA function name-;

Do that with all of the subpoints. Make sure to replace [0] with the subpoint number.

Step 10:

To do that.. call: DDTMWalk(1);

If your DDTM didnt work, try increasing the area size of all the subpoints. If your DDTM still dosnt work, your TPA may be outputting the wrong color. Try re-choosing the color or increase / decrease the tolerance.

Step 11:

Make a DDTM and a TPA for each place to walk to.

To add a new DDTM, add another number to the case WalkNumber.

Remember:
To walk to an area: call DDTMWalk(-WalkNumber-);

Go to Includes\SRL\SRL\Core\AutoColor.scar to find SRL's auto color TPA's.

I hope I helped you. Feel free to ask questions and suggestions.
Last edited by TRiLeZ; 10-06-2009 at 12:27 PM.

2. Just read through it and it's really easy to follow. Explains everything nicely. Great Tutorial
Only suggestion is to enlarge that picture.
Edit: You could also place some of the last step things into code tags, to make it flow better.

3. Originally Posted by r!ch!e
Just read through it and it's really easy to follow. Explains everything nicely. Great Tutorial
Only suggestion is to enlarge that picture.
Click it to enlarge it.

4. Rename it to DDTM Walking With Your Own AutoColor Functions

5. thx m8, great tut, helped me with my script alot you might have even given me the last bit of knowlage i need before becoming a SRL memb so tysm

6. SRL Junior Member
Join Date
May 2008
Location
Oregon, USA
Posts
154
Mentioned
0 Post(s)
Quoted
0 Post(s)
thanks alot. this really helped me. i will be looking into this method.

7. Senior SRL Member
Join Date
Jun 2006
Posts
3,861
Mentioned
3 Post(s)
Quoted
0 Post(s)
Why do you do
SCAR Code:
function FindFloorColor: Integer;var    TPA : TPointArray;    I, Col : Integer;begin    if FindColorsTolerance(TPA, 7568507, MMX1, MMY1, MMX2, MMY2, 10) then    begin        Col := GetColor(TPA[i].X, TPA[i].Y);        Result:= Col;    end;end;
SCAR Code:
function FindFloorColor: Integer;var  x, y: Integer;begin  if(FindColorTolerance(x, y, 7568507, MMX1, MMY1, MMX2, MMY2, 10))then    Result:= GetColor(x, y);end;
? As far as I can tell, you never use the rest of the TPA, nor the variable I.

8. I took this function from one of my scripts and forgot to remove all things unnecessary.
Ill edit the unnecessary stuff out.

9. Can you expand on step 8?
I am not sure how to make the TPA for the other 3 points.

do i need more var, TPA1, TPA2, TPA3?

and then
FindColorsTolerance(TPA1....
FindColorsTolerance(TPA2....
FindColorsTolerance(TPA3....

Thanks for ur help.

10. Nope. 'TPA' stands for TPointArray (the T, like in TIntegerArray) means Type, I believe. But the important part is the A(rray). Arrays are specified by brackets, like this: TPA[1].

To go through all of the points in one FindColorsTolerance function, all you need to do is use a loop. A few will work, so I'll show you them. ^^

SCAR Code:
for i := 0 to High(Colors) do //The High() function just returns how many of something is in the array, so if TPA was TPA := [0, 462, 2];, High(TPA) would return 2. (Remember that it's always best to start your counting from 0, since that's how programs almost always do it! :))  if(FindColorsTolerance(TPA[i], Colors[i], etc. etc.))then    Writeln('Yay! :3');

Sorry, too lazy to get it to work with SCAR and actual colors and everything, but you seem to just be misunderstanding arrays, so I don't see the need to fill EVERY thing out for you.

SCAR Code:
repeat  FindColorsTolerance(TPA[i], etc. etc.);  Inc(i);until(i = High(Colors));//And instead of using High(), you can just use however many sets of whatever there are in the sequence if you know, of course. :) It's just good to know how things work, in my opinion.

and another..

SCAR Code:
while i < High(Colors) do  FindColorsTolerance(TPA[i], etc. etc.);

And you could also use a goto, but I'm not exactly sure how to use them. but you get the point, hopefully. ^^
Last edited by i luffs yeww; 03-18-2010 at 02:16 AM.

11. ok very confused as ur answer is different to the steps in the tut.
I have followed step 8 and created a TPA for each point
PHP Code:
 function MainPoint: Integer; var   TPA : TPointArray; begin   if FindColorsTolerance(TPA, 1856094, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y); end; function point0: Integer; var   TPA : TPointArray; begin   if FindColorsTolerance(TPA, 1856094, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y); end; function point1: Integer; var   TPA : TPointArray; begin   if FindColorsTolerance(TPA, 1724759, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y); end; function point2: Integer; var   TPA : TPointArray; begin   if FindColorsTolerance(TPA, 1723735, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y); end; function point3: Integer; var   TPA : TPointArray; begin   if FindColorsTolerance(TPA, 1725273, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y); end;  
Then step 9 implanted the TPA in your DDTM

PHP Code:
 function DDTMWalk(WalkNumber: Integer): Integer; var   dtmMainPoint: TDTMPointDef;   dtmSubPoints: array[0..3] of TDTMPointDef;   TempTDTM: TDTM; begin   case WalkNumber of     1: begin       dtmMainPoint.x := 708;       dtmMainPoint.y := 249;       dtmMainPoint.AreaSize := 4;       dtmMainPoint.AreaShape := 0;       dtmMainPoint.Color := MainPoint;       dtmMainPoint.Tolerance := 0;       dtmSubPoints[0].x := 708;       dtmSubPoints[0].y := 249;       dtmSubPoints[0].AreaSize := 4;       dtmSubPoints[0].AreaShape := 0;       dtmSubPoints[0].Color := point0;       dtmSubPoints[0].Tolerance := 0;       dtmSubPoints[1].x := 700;       dtmSubPoints[1].y := 254;       dtmSubPoints[1].AreaSize := 4;       dtmSubPoints[1].AreaShape := 0;       dtmSubPoints[1].Color := point1;       dtmSubPoints[1].Tolerance := 0;       dtmSubPoints[2].x := 715;       dtmSubPoints[2].y := 244;       dtmSubPoints[2].AreaSize := 4;       dtmSubPoints[2].AreaShape := 0;       dtmSubPoints[2].Color := point2;       dtmSubPoints[2].Tolerance := 0;       dtmSubPoints[3].x := 712;       dtmSubPoints[3].y := 255;       dtmSubPoints[3].AreaSize := 4;       dtmSubPoints[3].AreaShape := 0;       dtmSubPoints[3].Color := point3;       dtmSubPoints[3].Tolerance := 0;       TempTDTM.MainPoint := dtmMainPoint;       TempTDTM.SubPoints := dtmSubPoints;       Result := AddDTM(TempTDTM);     end;   end; end;  
E: I will try to add a loop thanks

12. No, I'm saying the same thing as he is.

Okay, by making a TPA, all you have to do is..

SCAR Code:
var  TPA: TPointArray;TPA := [1234, 5678, 9012, 3456, 7890];

Again, it's an array (a set/sequence of integers, extendeds, strings, booleans, variants, bytes), so to access it, it's just TPA[0], TPA[1], TPA[2], TPA[3], or TPA[4].

And to access those all at once, you can just do..

SCAR Code:
for i := 0 to 4 do  Writeln(IntToStr(PointToInt(TPA[i])));//I dunno if PointToInt is anything, but I hope you understand.. :p

Actually I just looked at the tut, and you don't even need to use a TPA for this. It's not used.
Last edited by i luffs yeww; 03-18-2010 at 02:43 AM.

13. Right I have seen an example DDTM function and all the color have been replaced with a single TPA function name, cool.

but still struggling as the detailed steps above (step 6) to create the TPA is so different.
[
PHP Code:
 function FindFloorColor: Integer; ar   TPA : TPointArray; begin   if FindColorsTolerance(TPA, 7568507, MMX1, MMY1, MMX2, MMY2, 10) then     Result:= GetColor(TPA[0].X, TPA[0].Y); end;  
How i get from this to..

var TPA: TPointArray;
TPA := [7568507, 7568507, 15658734, 15658734, 195836];

for i := 0 to 4 do
Writeln(IntToStr(PointToInt(TPA[i])));

sorry for not getting this?

14. Like my edit says, you don't need a TPA. Look at bullzeye's post.

Originally Posted by bullzeye95
Why do you do
SCAR Code:
function FindFloorColor: Integer;var    TPA : TPointArray;    I, Col : Integer;begin    if FindColorsTolerance(TPA, 7568507, MMX1, MMY1, MMX2, MMY2, 10) then    begin        Col := GetColor(TPA[i].X, TPA[i].Y);        Result:= Col;    end;end;
SCAR Code:
function FindFloorColor: Integer;var  x, y: Integer;begin  if(FindColorTolerance(x, y, 7568507, MMX1, MMY1, MMX2, MMY2, 10))then    Result:= GetColor(x, y);end;
? As far as I can tell, you never use the rest of the TPA, nor the variable I.

15. thanks, i will give it a go. thanks again

16. Sorry for it being confusing. :< My fault completely.

17. Have given up on DDTM walking for the ime being, i have just managed to get the RadialRoadWalk to work.

18. eRaidialWalk(ex) is all you need. Ju are not always necesaary. N

Nice turoalial though.st use while..loops wit conditions. obviosly you need some autocolours but thaye

19. Oh, Nava2. :3 you're so great. ^^

20. Where can I find out more about eRaidialWalk(ex)? I have searched the forum and it does not appear any where else.

Last edited by twobac; 03-18-2010 at 11:23 PM.

21. Year bump. Sue me.

Thanks for the guide. I've been seeing them everything lately, just curious on how their used.

Originally Posted by Nava2
eRaidialWalk(ex) is all you need. Ju are not always necesaary. N

Nice turoalial though.st use while..loops wit conditions. obviosly you need some autocolours but thaye
Wat.

22. DTMs are just groups of pixels of certain colors. You can use them to search for icons or sprittes. On the minimap you can use them to figure out where you character is. It is like serching for an image, or part of an image, but uses muuuuch less cpu time.

23. Originally Posted by m34tcode
DTMs are just groups of pixels of certain colors. You can use them to search for icons or sprittes. On the minimap you can use them to figure out where you character is. It is like serching for an image, or part of an image, but uses muuuuch less cpu time.
I know what Dtm's are and how to use them...Was just wondering how DDtms were different (Reliable, Speed, etc).

24. Oh, I believe DDTMs are DTMs you create in run-time. Not before you run the script.

So DDTMs are created on-the-fly. Does that make sense?

You can create a DTM, have the script search for it, then have the script create its own dtm(DDTM), and search for this new DDTM

25. Originally Posted by m34tcode
Oh, I believe DDTMs are DTMs you create in run-time. Not before you run the script.

So DDTMs are created on-the-fly. Does that make sense?

You can create a DTM, have the script search for it, then have the script create its own dtm(DDTM), and search for this new DDTM
A DDTM is simply a Dynamic DTM.