PDA

View Full Version : Making an Mini-map DTMs!



Claymore
10-18-2008, 03:38 AM
Index
1 - For your Information...
2 - DDTM Editor by Nielsie95
3 - Creating the DTM using Nielsie95's DDTM Editor
4 - Using the DTM

So you want to learn to make a DTM!

Today is your lucky day, because I'm bored and I want to teach you to make a DTM (DDTM to be specific) and using it. But first you must understand a few things about DTM, or DDTM but preferably called DTM.

1 - For Your Information...

1.1
The difference between DTM and DDTM is that DDTM allows you to edit the colors while the script runs. Meaning that you can auto-color each color in each sub points (or the main points, but that rarely happens).

1.2
Easiest way to create DTMs is by using Nielsie95's DDTM Editor! This awesome software/program allows you to create the DTM just like in SCAR, except this program writes the code in DDTM format.

If you have questions, post here but further more lets move on to how to create the DDTM!

2 - DDTM Editor by Nielsie95

Download Nielsie95's DDTM Editor and open it. Lets talk about Nielsies95's awesome program shall we?

1.1 Mouse and Zoom In

http://img408.imageshack.us/img408/3802/eliteswitchtw4.png

So does this part of the program do? Well see that strip box over there? Well that's the close up of the color. Try it! Notice that where ever you hover your mouse on the big empty part of the program (where you import the pictures, will show how on 2.1) it shows the color and the surroundings of the position of your mouse.

(*) Mouse click creates point
It creates a point when you click.
(*) Mouse click moves point
It moves the point to where ever you click, first you must define what point you want to move! (Shown later.)
(*) Mouse click picks color.
It gives the color to the point to whatever color you picked, first you must define what point you want to move.

1.2 SettingBox

http://img522.imageshack.us/img522/3125/eliteswitchgz2.png

This shows the points you have clicked! Give it a try, click anywhere on the empty space! Notice that it gives you the coordinates and colors which is revealed on the Colors and Position section (shown at 1.3). Notice you get this



17, 29: -1 is actually X, Y: Color


17, 29 is just a random coordination i picked, and the color -1 will always appear because you never added a picture. I will show you how to add a picture soon.

To Delete a point just click on what point you want to delete, make sure it is highlighted blue. Then click on Delete! I don't know what [Add] does.

1.3 Color and Position

http://img101.imageshack.us/img101/903/eliteswitchki9.png

So, once you make a point you will see that there is a bunch of information written on each box.

X:, Y: This reveals the exact coordination of the point chosen. You can edit it by click on the arrows. Make sure the point is highlighted in the SettingBox! This is very common for people to realize that the point is not highlighted and they freak out that the point is not moving!

Area Size: This determines how big you want the point to search. Sort of like a 'Tolerance'. I like to pick 4 for large areas of the Minimap (MM Roads) and 2 for small areas, objects (NPC's). Sometimes you can use 4 on NPCs if they are too spreaded out (The NPC's).

Area Shape: Should be Rectangle unless you know what your doing. Someone please explain what this does anyways just for curiosity!

Tolerance: This is the tolerance for the Color! Nothing else to say, eh?

Color: This is the color of the point chosen! If your auto-coloring, make sure you change this. (Later, not now! Will show later).

The color will show up at the bottom, just for your information. :rolleyes:

The big spacious area is where your image will be imported.

Lets GET STARTED shall we? Ok, i said that before but this time i mean it! :D

3 - Creating the DTM using Nielsie95's DDTM Editor.

Import a picture first of all. There are 2 ways to do this but 1 of them is quicker and they both do the same thing.

3.1 Importing Pictures!

1. [Print Screen] on the Runescape Client. Make sure your angle is exactly 'N' and that you got a CLEAR shot of the picture! Open up DDTM Editor again and go to [Image] > Paste Image. Ta-da! A picture to create your DTM. Example of a picture that can be used to make a DTM is in 3.2, but lets show how to make a picture the second way.

2. Second way is, just get a small image of the area you are getting, like the one on 3.2 and go to [Image] > Browse Image. Than go to the file location of your picture and open it, Ta-da! Again... a picture on the, spacious area i call it! Moving on.

3.2 Examples of what can be used

http://img339.imageshack.us/img339/5070/eliteswitchfq9.png

Draynor Bank for those who don't know! All Banks work too!

http://img296.imageshack.us/img296/144/eliteswitchie5.png

3-Way Road, all 3-Way Roads works unless there a more than 3-Way roads nearby, than it's a bad idea to make one!

http://img263.imageshack.us/img263/6906/eliteswitchmx8.png

Rocks are a common one, this one was taken in Draynor. You can use any rock as long as there are at least 3+ rocks minimum and 10+ max! Really, it depends, if those 10 rocks are bunched together, than its a bad idea!

http://img93.imageshack.us/img93/7197/eliteswitchqs3.png

Ferns! These don't have Auto-Colors, but i made one. For now you can use tolerance. These ferns are packed together, but this is just an example, because ferns are sort of common as well!

There are other ways of making DTMs! Non-moving NPCs bunched together, 4 way roads!, a curved road, trees, and soon after you read this, you'll explore more on what you can create by using your, Imaginanation!

So anyways, those are examples. You can use them if you like, but it is better for you to make it yourself. So a few pointers! Make sure your angle in Runescape is North. And that's it, i thought there were more but that's just it.

3.3 Making the DTM

Part 1, Main Point.

What is a Main Point? Are you serious! Shut up. Jokes. Main point is where the mouse will click. The main point must have a tolerance of 255 and a color that will suit all colors in the Minimap. Why? Because the Main Point doesn't do the role of where the DTM is (well not really), the one that supports the main point, sub points which will be described in Part 2, is the ones that locates the exact point of the DTM and then the script will click on the main point, but if the color is blocked (from crowded people, NPCs) then your :f: Hahaha...

So how do you know your color supports ALL colors, we can use the Find Matching Pixel function! First of all, set up the color, and tolerance is 255! Than make sure that the main point is highlighted blue on the SettingBox or else you did not set up the main point at all! Than go to [Image] > Find Matching Pixels. Ta-da! The screen should be completely red or the Mini-map should be. Or else if for example, NPC dots appear, or your mini-map self (the white square) appears, than that means you messed up.

Don't assume your color (the mini-map square dude or NPCs) will work because what about the color on the floor of where your main point is, does it also match with the NPC colors, if it does than good job or else you failed, and have to find a new color.

Note to make the red stuff go away, just move tolerance by +1 than back to -1 or something. Just play with the SettingBox and the red stuff is gone.

So wait, what if the color doesn't work and i want to switch to a different color, but i want to do it, the FAST WAY! Well, remember in 2.1 the Mouse and Zoom In section of the program. I hope you understood how it worked, otherwise your really slow, no offense. Anyways the fast way is to first highlight (click) on the point you want to change colors. Than choose the option [(*) Mouse click pick colors] and go on and pick the colors and start testing them!

Part 2 - Sub-Points

What is a Sub-Point? Well Billy it's when 2 people love each other very much and, a sub point is the 'supporting' leg of the main point. The sub point is a lot more important because this shows the exact spot the DTM is. So to create one? Make sure that the main point is clicked (highlighted) and start choosing your sub-points. Well wait? You didn't even show us. Your like my drunk dad who taught me how to play football. Anyways to make one, click on the object on the mini-map you want to use. Here is an example of what a sub-point should look like! Watch the master.

http://img263.imageshack.us/img263/9893/eliteswitchey2.png

So awesome right? A few pointers.

- Pick the point in which the color is supported by the Auto-Color, for example the FindRockColor; finds the lightest color of the rock.
- Choose the most centered or least to the corner of the object. So that means if you picked a road, the sub point shouldn't be on the edge, but on the center of the road. For NPCs it's ok, just do like what i do.

Examples of other sub-points.

http://img408.imageshack.us/img408/4426/eliteswitchea8.png

Notice how the sub-point is in the middle of the rock. Also i used the lightest color of the rock. For other objects use tolerance.

http://img408.imageshack.us/img408/5268/eliteswitchlg6.png

Notice that the the 8x Zoom in box is completely gray from the road. That means it is in the middle and is good to go!

So anyways I hoped you learned something, because we're moving on!

Part 3 Making the Sub-Points and Main Point Altogether.

So how do you make them altogether? First off, the main-point. It should be nearby the objects (Of whatever the DTM is based on), but not too close. Once you got the main-point to support all colors and is somewhat near the sub-points (Like take a look on the examples provided in 3.2 Part 2, Notice that the main point is close to the sub point a little, the max distance is at least 20 pixels away from it) we can move on to sub-points.

Now making sub-points isn't the easiest thing to describe, but first off make the sub-point just like the one in Part 2, 3.2 and than we can set it up! MAKE SURE that the sub-point we are about to edit is highlighted blue in the SettingBox otherwise you are not EDITING the point. The reason is that people are saying they're DTM is not working, probably because you didn't actually set up the sub-points correctly because you did not IDENTIFY what point you are editing, you douche bag. So even while your editing the sub-point, make sure it doesn't get unhighlighted, it's usually caused by miss-clicks.

Part 4 Setting up the Sub-Point

Remember the Color and Position in 1.3? Well than lets edit this a little.

X: Leave it.
Y: Leave it.
Area Size: 4 if it's a road, 2 for NPC's. 4 for objects like ferns or rocks.
Area Shape: Leave it.
Tolerance: Whatever you want it to be, if auto-coloring (like roads) than 5 or 1.
Color: Leave it, if auto-coloring we add it later!

Repeat and continue making sub-points until you got at least 3! Here are examples of what it should look like afterwords.

http://img511.imageshack.us/img511/6969/eliteswitchwa3.png

This is what it should look like (The area size does not appear, but make sure the area size is 4 or 2) if you were making a road.

http://img252.imageshack.us/img252/2750/eliteswitchmh1.png

For banks too.

http://img263.imageshack.us/img263/955/eliteswitchru7.png

Last but not least, rocks!

Thats it! You finally created a DTM! Now to export it as a DDTM Format, go to [File] > DDTM to Text and Ta-da big time! You got yourself a DDTM for your script! Lets move on!

4 - Using the DTM


function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 15;
dtmMainPoint.y := 3;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 10324605;
dtmMainPoint.Tolerance := 255;
dtmSubPoints[0].x := 15;
dtmSubPoints[0].y := 3;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 10324605;
dtmSubPoints[0].Tolerance := 255;
dtmSubPoints[1].x := 5;
dtmSubPoints[1].y := 4;
dtmSubPoints[1].AreaSize := 4;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 3883329;
dtmSubPoints[1].Tolerance := 1;
dtmSubPoints[2].x := 22;
dtmSubPoints[2].y := 8;
dtmSubPoints[2].AreaSize := 4;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 3883329;
dtmSubPoints[2].Tolerance := 1;
dtmSubPoints[3].x := 13;
dtmSubPoints[3].y := 12;
dtmSubPoints[3].AreaSize := 4;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 3883329;
dtmSubPoints[3].Tolerance := 1;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;


You got this code right? Well this code is for the Rock DDTM. So how do we set it up to get it to work, well lets move on to 4.1!

4.1 - Fixing things up a notch!

Well first, we need to auto-color! But how? Well first we need to create a variable.


var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM; //All of them already added.
Color: Integer


than just right after begin, do this.


begin
Color := FindRockColor;


But for a fail safe, lets add some stuff.


begin
Color := FindRockColor;
if (Color <> 0) then
Wait(50)
else
Color := RockColor; //Add your own rock color specified by player. RockColor was a const to me.


Ok so now that we got the SRL Auto-color going, lets add it to each sub-points.


dtmSubPoints[Only SubPoints except 0!].x := 15;
dtmSubPoints[Only SubPoints except 0!].y := 3;
dtmSubPoints[Only SubPoints except 0!].AreaSize := 4;
dtmSubPoints[Only SubPoints except 0!].AreaShape := 0;
dtmSubPoints[Only SubPoints except 0!].Color := Color;
dtmSubPoints[Only SubPoints except 0!].Tolerance := 5;


There you go, make sure its only for all sub-points EXCEPT 0!

Lets move on.

4.2 Naming your DTM

Well the name of the DTM is made from the function. So go ahead, make a name! Call it, RockDDTM or LoadRock, SetUpDTMRock.

So now that we got the name and the Color/Tolerance going, we can now use functions to use the DTM.

4.3 Functions to use DTMs on Mini-maps

First of all make a new procedure.


procedure ToTheTrees;


because the DDTM i used is a Rock DTM from Draynor, i picked that procedure.

Now for some variables.


var
Rocks {Name your DTM like usual}, X, Y: Integer;
begin


now we begin the procedure and already made the variables.

2 ways to search for a DDTM on the Mini-map.


DTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;


DTM: Integer; The DTM you want the function to find
X, Y: Variables
X1, Y1, X2, Y2: Integer; Where you want the function to search in (a box form) usually it should just be MMX1...MMY2

Results True if it finds the DTM, else it's False.


FindDTMRotated((DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; StaratAngle, EndAngle: Integer; AngleStep: Extended; var AngleResult: Extended): Boolean;


I'm not exactly sure how it goes but i believe it's something like this.

StartAngle, EndAngle: Integer; What it does is it finds the DTM, if it fails it tilts the DTM to whatever the Angle Step is (Preferably 0.01 or 0.1 or 0.5) Depends on how accurate and fast you want it to go.
AnlgleStep: Extended; If it fails to find a DTM, it tilts the DTM to whatever the Angle step is.
var AngleResult: Extended; THIS IS A VARIABLE! IT just shows the result of what Angle it found the DTM in. It isn't IMPORTANT but it's just there for developers to see what angle the DTM is found in.

So how do we use it in our script?


procedure ToTheTrees;
var
Rocks, X, Y: Integer;
begin
Rocks := RockDDTM; //Whatever you named the function for setting up the DDTM


Ok we got the DTM set up, now we try and look for it in the Mini-map.


procedure ToTheTrees;
var
Rocks, X, Y: Integer;
Angle: Extended; //Forgot to add the Angle!
begin
Rocks := RockDDTM;
FindDTMRotated(Rocks, X, Y, MMX1, MMY1, MMX2, MMY2, -30 {This is the casual angle most SRL Members use}, 30, 0.01 {0.1 is faster}, Angle {The result of the angle it found the DDTM});


So we got the function, but if you want DTMRotated (The one with less options) then


DTMRotated(Rocks, X, Y, MMX1, MMY1, MMX2, MMY2);


Lets continue.


procedure ToTheTrees;
var
Rocks, X, Y: Integer;
Angle: Extended;
begin
Rocks := RockDDTM;
if (FindDTMRotated(Rocks, X, Y, MMX1, MMY1, MMX2, MMY2, -30, 30, 0.01, Angle)) then
begin
WriteLn('Found DTM in ' + FloatToStr(Angle) + ' Degrees.');
FreeDTM(Rocks);
Mouse(X, Y, 5, 5, True);
FFlag(5);
end
else
begin
FreeDTM(Rocks);


What I did is if SCAR finds the DTM, it is to reveal on what angle it found it in and to click on the X, Y coordinates and Flag. Else if it fails to find the DTM it frees it. So this is the part where you add Fail Safes!


procedure ToTheTrees;
var
Rocks, X, Y: Integer;
Angle: Extended;
I: Byte;
begin
Rocks := RockDDTM;
if (FindDTMRotated(Rocks, X, Y, MMX1, MMY1, MMX2, MMY2, -30, 30, 0.01, Angle)) then
begin
WriteLn('Found DTM in ' + FloatToStr(Angle) + ' Degrees.');
FreeDTM(Rocks);
Mouse(X, Y, 5, 5, True);
FFlag(5);
end
else
begin
FreeDTM(Rocks);
SymbolAccuracy := 0.4;
while (I < 10) do
begin
if (FindSymbol(X, Y, 'Fish')) then
begin
Mouse(X, Y, 5, 5, True);
FFlag(5);
Exit;
end
else
Inc(I);
Wait(175 + Random(50));
end;
if (RadialRoadWalk(FindWaterColor, 195, 225, 60, 1, 1)) then
begin
FFlag(5);
Exit;
end;
end;
WriteLn('Failed to find walk to the Willow Trees!');
Exit;
end;


Tries: Byte; If you haven't heard bout Byte, it is an Integer in the range of 0 - 255. I use it because it takes up less memory.

So what I did here is added a Find Symbol (10 Times) then Radial Road Walk on Water. If it succeeds, it Exits the procedure without having the epic fail message!

So there you have it, using a DTM on your script!

Note! My DDTM doesn't work! Did that on purpose.

5 Tips!

For Bank DTMs/NPC based DTMs, they all have a color which is always the same, 195836. Just make the tolerance 5 and your done!

You can make a function where you can call out a DTM! I call it DTMFromFunction(WhatDTM: string): Integer;


DTMFromFunction(WhatDTM: string): Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
Color: Integer;
begin
case Lowercase(WhatDTM) of
'rock':
begin
Color := FindRockColor;
if (Color <> 0) then
Wait(50)
else
Color := RockColor;
end;
end;
case Lowercase(WhatDTM) of
'rock':
begin
dtmMainPoint.x := 15;
dtmMainPoint.y := 3;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 10324605;
dtmMainPoint.Tolerance := 255;
dtmSubPoints[0].x := 15;
dtmSubPoints[0].y := 3;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 10324605;
dtmSubPoints[0].Tolerance := 255;
dtmSubPoints[1].x := 5;
dtmSubPoints[1].y := 4;
dtmSubPoints[1].AreaSize := 4;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := Color;
dtmSubPoints[1].Tolerance := 5;
dtmSubPoints[2].x := 22;
dtmSubPoints[2].y := 8;
dtmSubPoints[2].AreaSize := 4;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := Color;
dtmSubPoints[2].Tolerance := 5;
dtmSubPoints[3].x := 13;
dtmSubPoints[3].y := 12;
dtmSubPoints[3].AreaSize := 4;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := Color;
dtmSubPoints[3].Tolerance := 5;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
end;
end;


Edit the standards yourself, anyways you can do that.

Well I hope you learned a lot today, if you got questions/suggestions/or something else to add, post. Otherwise rate 5. :p

Magiic
10-18-2008, 10:03 PM
wow, you sure do go in depth :P hopefully *NOTE HOPEFULLY* this will help some new scripters learn how to use ddtms as well as using them to find a bank on the mm tbh i only read half of it, ill read the rest tomoz lol

Blumblebee
10-18-2008, 10:06 PM
yeah looks good, a very nice tutorial. Wish this was out when i learnt ddtms. :p

Claymore
10-19-2008, 07:16 AM
i think i did the tut wrong XD -30, 30 should be -5, 5, 0.1/

Anyways yea i do narrow things down ;p

ekamjit
10-23-2008, 11:21 AM
thx awesome tut

Heavenzeyez1
10-28-2008, 12:41 PM
Thank you.
Well explained.
~Eerik~

lordsaturn
11-10-2008, 02:50 AM
Aren't the StartAngle and EndAngle in FindDTMRoated in radians, not degrees?

And why do you have your first subpoint matching the mainpoint? It's just the same thing twice..