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.
Now you have to add your variables to the function.
Add: TPA : TPointArray; to your vars. This is where all of your points of the color are stored.
Add begin to start adding the contents of the function.
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.
-YOUR POINT'S COLOR- should be your point's color.
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.
Add Result:= GetColor(TPA[0].X, TPA[0].Y);
That makes the result of the function the color found for your point.
Now add:
end;
Now you have made your TPA!!
Step 8:
Now make a TPA for all the rest of your points.
Step 9:
Now you have to implament your TPA in your DDTM.
To do this...
Replace:
dtmMainPoint.Color := 7568507;
With:
dtmMainPoint.Color := -Your TPA function name-;
-Your TPA function name- should be your TPA function name.
And Replace:
dtmSubPoints[0].Color := 7568507;
With: dtmSubPoints[0].Color := -Your TPA function name-;
-Your TPA function name- should be your TPA function name.
Do that with all of the subpoints. Make sure to replace [0] with the subpoint number.
Step 10:
Test your DDTM function.
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.
And now your done!
I hope I helped you. Feel free to ask questions and suggestions.