SRL Archive - RuneScape News and General

DTM doens't work properly


Laimonas171

2012-10-20 07:03:51

Ok situation is kinda "mysterious".

I use two dtms gold ore and gold bar
procedure SetDTM;//DTM Defining procedure.
begin
goldOre := DTMFromString('mWAAAAHicY2FgYJjBxMDQB8SzgHgxEAcyMjAEAbEHEHsD8eZ+KYZEPzOGTb2SDJkh1gz8QD3ImBENgwAA4fkIew==');
goldBar := DTMFromString('mbQAAAHicY2VgYJjPxMCwBIgXA/FsIF4FxAqMDAzyQKwCxKpArAjEC+rFGC4tlwXjSHcehhur5Rj4gfrRMSMWDAYA8jMK5w==');
end;

procedure ReleaseDTM; //DTM Freeing procedure.
begin
FreeDTM(goldOre);
FreeDTM(goldBar);
end;


Ok so here is the problem if i use ORE DTM it deposit to bank properly, if I use BAR DTM it do not find it.
Procedure barsFromInventoryToBank;
var
x, y: integer;
Begin
SetDTM; //Declares dtms
If (FindDTM(goldBar, x, y, MIX1, MIY1, MIX2, MIY2)) Then // Ms is the cords of the main screen
begin
mouse(x,y,5,5, false);
WaitOption('t-All', 500);
Writeln('did banking.');
end;
ReleaseDTM; //frees dtms
end;

Mysterious part.
if I use bar or ore work great. in function take from bank
Procedure takeFromBAnk;
var
x, y: integer;
Begin
SetDTM;
If (FindDTM(goldOre, x, y, MSX1, MSY1, MSX2, MSY2)) Then // Ms is the cords of the main screen
begin
mouse(x,y,5,5, false);
WaitOption('w-All', 500);
Writeln('Taking some ores');
end;
ReleaseDTM;
end;

Kasi

2012-10-20 07:06:27

try declaring your variables locally.

Laimonas171

2012-10-20 07:08:06

From: Kasi
try declaring your variables locally.

tried, doesn't work as well
EDIT: PRobably tolerance of middle point of DTM was to low, because after re login it works fine.

riwu

2012-10-20 07:24:28

Yeah you have to make sure every point has an appropriate tolerance. I personally prefer bitmap (deformed) over DTM when it comes to inventory objects because any slight distortion of the obj (although that doesn't seem to happen anymore) will fail the DTM. Personal preference though, we have uber DTM fans who find DTM an absolute all-in-one solution to everything too (but i'd say TPA beats it in most cases ;) )

Also a better practice is to load only the DTM that you will be using in that procedure and not all of them, to prevent unnecessary memory hog and also allows you to declare the DTM locally.

Also you should fix the standard (i believe i gave you the link on another post), it's something very simple to learn and will be good to master them right at the start.

procedure BarsFromInventoryToBank; //camel case
var
x, y, goldBarDTM: Integer; //localized dtm
begin //dont need cap for bold words
goldBarDTM:= DTMFromString(blabla); //2 space after begin

if (FindDTM(goldBarDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then // Ms is the cords of the main screen
begin //'begin' dont need a space after 'if'
mouse(x,y,5,5, false);
WaitOption('t-All', 500); //maybe do an if check?
Writeln('did banking.');
end;

FreeDTM(goldBarDTM); //frees dtms
end;
Fix them for you but do take note of them in the future. Also post your qns in the correct section next time http://villavu.com/forum/forumdisplay.php?f=70

Laimonas171

2012-10-20 08:45:04

From: riwu

Fix them for you but do take note of them in the future. Also post your qns in the correct section next time http://villavu.com/forum/forumdisplay.php?f=70

Sorry and thank you.

litoris

2012-10-20 09:10:01

From: Laimonas171
tried, doesn't work as well
EDIT: PRobably tolerance of middle point of DTM was to low, because after re login it works fine.


If the inventory image gets distorted, bitmaps will get affected just as much as DTMs ;)

You have two options with DTMs to make them work well:
a) Give mild tolerance(~25) to any points inside the black outline, and avoid picking outline points on the upper left(if using for bank/stacked item)
b) Give a tolerance of 255 to the midpoint and pick a ton of points in the border, again avoiding upper left side if needed. Picking 20 or so points at "unique" points in the border should make it very accurate.

riwu

2012-10-20 09:16:41

From: litoris
If the inventory image gets distorted, bitmaps will get affected just as much as DTMs ;)

You have two options with DTMs to make them work well:
a) Give mild tolerance(~25) to any points inside the black outline, and avoid picking outline points on the upper left(if using for bank/stacked item)
b) Give a tolerance of 255 to the midpoint and pick a ton of points in the border, again avoiding upper left side if needed. Picking 20 or so points at "unique" points in the border should make it very accurate.

Nope, in advanced bitmap searching methods, you can check for % deformed, which i usually have it accepting if the accuracy is higher than 50%. (but that should be adjusted depending on the size of bitmap and the potency of similar obj) Whereas for DTM, even a single point mismatch returns false, i've read somewhere that the devs are developing a % match DTM functions though.

Again, it's up to personal preference, but usually most ppl just stick to the one they first learnt, which i wouldn't encourage as only when you learn both you will know when to apply them in different situations ;) (eg. DTM will be more suitable for walking with the implanted DTM rotation functions)

litoris

2012-10-20 10:18:22

From: riwu
Nope, in advanced bitmap searching methods, you can check for % deformed, which i usually have it accepting if the accuracy is higher than 50%. (but that should be adjusted depending on the size of bitmap and the potency of similar obj) Whereas for DTM, even a single point mismatch returns false, i've read somewhere that the devs are developing a % match DTM functions though.

Again, it's up to personal preference, but usually most ppl just stick to the one they first learnt, which i wouldn't encourage as only when you learn both you will know when to apply them in different situations ;) (eg. DTM will be more suitable for walking with the implanted DTM rotation functions)


You can do a percent match function yourself with DDTMs. You search for the whole DTM at first, and if it returns false, you search for the whole DTM minus one of the subpoints, and go further until you get a match. You could stop at 3 subpoints left so that you don't get mismatches etc.

Gucci

2012-10-20 13:21:47

You're going to need to declare the DTM's as integers and try using less points and play with the tolerance, seems like you used a lot of points