SRL Archive - OSR Help

How do DDTMs work?


RISK

2011-01-27 13:24:28

Thank you in advance for anyone who attempts to help.

Often times, my DDTMs do not work and other, rare times they will work properly. I am getting tired of them not working and I would like to learn how DDTMs work exactly so that I can use them properly.

What I mean is, how does it know to click in a specific spot when the colors are theoretically the same or different than originally picked? Wouldn't it get confused and fail to click if it worked that way?

Also, I was thinking about it could be the coordinates, but coordinates are useless, from what I can tell. As the DDTMs created could be in a much higher coordinate area than RuneScape itself. Causing those to be useless.

So what is it that makes DDTMs work and how does one get them to efficiently work without having to redo them over and over?

Also for another question: How would one make a DDTM able to walk in to a building when all the other buildings in the area are the same color as eachother on the minimap? Using custom autocoloring, too.

EvilChicken!

2011-01-27 13:36:08

Assuming you understand how regular DTMs work, dynamic DTMs work in the very same matter, except that they can take dynamic parameters, for i.e. color. I can't really provide a more elaborate explanation unless you either tell me you don't know how regular DTMs work, or give me a more specific query.

Regarding your issue, – this might be a silly question – but it immediately sounds to me as if you search for the DTM using FindDTM(); instead of DTMRotated();. Considering you mentioned the minimap, I assume that is where your DDTMs are targeted at?

For your final concern; what I usually do is to sample a lot of points of the walls, using quite large area sizes (4-6) and have my mainpoint either be a color that cannot shift more than what is covered by ~50 tolerance, or have it be a point with 255 tolerance so I can just click it without having to do external coordinate adjustments.

RISK

2011-01-27 14:16:01

I am, of course, using DTMRotated for my DDTMs and yes, I am attempting to locate the DDTMs on the minimap. I didn't think DDTMs would be much use anywhere but the minimap.

So when you say the walls of a building, would it be something like this?:

Or am I getting that wrong? Also, wouldn't a higher area size make it slower? Or am I incorrect on that?

Could you please explain how a DTM works? I prefer to know everything I can about something if I am going to be using it. So that would greatly help and I would really appreciate it.

EvilChicken!

2011-01-27 16:43:20

Yes, the picture seems to display what I was trying to say.

A higher area size make DDTMs slower indeed, but I think that slowly finding them beats not finding them at all. :p

I'm not 100% sure of how DTM searches are done to be honest, but my guess would be that it searches for a given color using a method similiar to FindColorsTolerance, with the params of the point closest to 0, 0 on the screen, and then based on that point checks the surrounding pixels according to the other points and their data.
With "surrounding", I of couse mean pixels that are equally far away on the screen as the other points of the DTM are distanced from the initial point.
Anybody, feel free to correct me if I said anything wrong; as said, I'm just guessing.

lordsaturn

2011-01-28 00:13:10

DTMs are exactly the same as DDTMs.

DTMs are defined by a string, DDTMs are defined in a code block.

DTM:
var
BankDTM: Integer;

BankDTM := DTMFromString('78DA630C666060486600032608C5F0F52B038' +
'311906684E170FC6A4080319A0873E2116A18709803004A110B71');
DDTM:
var BankDTM: TMDTM; BankDTMPoint1, BankDTMPoint2: TMDTMPoint;

BankDTMPoint1.x := 100;
BankDTMPoint1.y := 150;
BankDTMPoint1.c := GetRockColor; //color
BankDTMPoint1.t := 5; //tolerance
BankDTMPoint1.asz := 1; //area size
BankDTMPoint1.bp :=

BankDTMPoint2 := CreateDTMPoint(200, 250, 12037120, 2, 1, False);

BankDTM.AddPoint(Point1);
BankDTM.AddPoint(Point2);

dont know what .bp is…

DTMs are made using a DTM editor. DDTMs are made dynamically.

Wizzup?

2011-01-29 08:03:22

bp is bad points - requested at some point by tarajunky. They are basically points that shouldn't match.
From finder.pas:
  // Turn the bp into a more usable array.
setlength(goodPoints, Len);
for i := 0 to Len - 1 do
goodPoints[i] := not DPoints[i].bp;

RISK

2011-01-30 01:06:01

Thank you to everyone who has helped so far, but I have more questions regarding DDTMs:

@ EvilChicken! : How many points is "A lot"? I have this for clicking in to the tanner shop:
dtmMainPoint.x := 720;
dtmMainPoint.y := 164;
dtmMainPoint.AreaSize := 5;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := shopColor;
dtmMainPoint.Tolerance := Tol;

dtmSubPoints[0].x := 720;
dtmSubPoints[0].y := 164;
dtmSubPoints[0].AreaSize := 5;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := shopColor;
dtmSubPoints[0].Tolerance := Tol;

dtmSubPoints[1].x := 706;
dtmSubPoints[1].y := 155;
dtmSubPoints[1].AreaSize := 5;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := shopColor;
dtmSubPoints[1].Tolerance := Tol;

dtmSubPoints[2].x := 735;
dtmSubPoints[2].y := 175;
dtmSubPoints[2].AreaSize := 5;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := shopColor;
dtmSubPoints[2].Tolerance := Tol;

dtmSubPoints[3].x := 704;
dtmSubPoints[3].y := 175;
dtmSubPoints[3].AreaSize := 5;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := shopColor;
dtmSubPoints[3].Tolerance := Tol;

dtmSubPoints[4].x := 732;
dtmSubPoints[4].y := 153;
dtmSubPoints[4].AreaSize := 5;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := shopColor;
dtmSubPoints[4].Tolerance := Tol;
Weird formatting is weird.

Is 5 points enough? Or would it need more? This seems to click in to the shop but I would prefer to be on the safe side.

–

@ Anyone :
How do those coordinates on the mainpoint and the subpoints work? They are much too big and small for the minimap itself. Are they downsized to fit the minimap coordinates when used in the script? I can see how color and tol fit in to it. But not the coordinates.

Also when a DDTM is used, what exactly does the script see and click? Does it see the mainpoint or the subpoints? Or does it see the subpoints and if they are all found or at least some of them are found, it clicks the mainpoint? Or is it the other way around?

How does "Area Size" work? "1" seems to be the normal size used by most scripts, but on DDTMs that walk in to buildings, it needs to be much higher than "1". Why is this? I read somewhere that the "Area Size" is the search area, in other words. But I don't quite understand that.

Thank you in advance for anyone who attempts to help me!