SRL Archive - OSR Help

FindDTM Help


MrWicked0

2010-02-19 09:36:34

Alright so I have gotten further with my current script and everything seems to be good except for DTM's.

I cant seem to get them to work… I have read what I can find on the forums regarding them but it just wont work….


I am using the following code:

Loading the DTM:

FlyRod := DTMFromString('78DA636C616360E0666240063EE6DC0C2250F' +
'67F2060AC01AA914455C3C000E13342798C13816AFE32E257D306' +
'542348C09C7AA01A4E026AFA816AD809A8A900AA11C1AF060007A' +
'D09E2');


Finding the DTM:

if FindDTM(FlyRod, MMx, MMy,MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Rod Found!!');
end else
begin
Writeln('Rod Not Found!!');
end;

This is what my DTM looks like in the editor.


I have the tolerance set to 20 for the parent. ( I would assume that's the only one I would have to change… As black is well… black.. )

I dont know what the Area Size and Area Shape stuff is for… and no one seems to mention it in there DTM tutorials. Is it required? what does it do..


Does anyone know why I cant seem to find my fly rod!?

Frement

2010-02-19 09:42:54

I usually set the tolerance of every point to 5.

E: Also try using only the outline.

MrWicked0

2010-02-19 09:48:38

Lol Strangely enough that seems to have worked…..

Thanks man. Rep++

Frement

2010-02-19 09:52:50

No problem, keep learning ;)

YoHoJo

2010-02-19 15:20:50

Nooo!
NO TOLERANCE ON POINTS!
The outline color of items is CONSTANT!
And so is the area/position of the points!

Leave the DTM just like you have it in the picture, and on the first point, change the Tolerance to 255, and it will be fine!

NCDS

2010-02-19 15:44:42

From: YoHoJo
Nooo!
NO TOLERANCE ON POINTS!
The outline color of items is CONSTANT!
And so is the area/position of the points!

Leave the DTM just like you have it in the picture, and on the first point, change the Tolerance to 255, and it will be fine!


+1

You want your "Parent" point to have 255 tolerance as RS uses Static Colors and by setting the tolerance to 255 you will find it no matter what variation of that color it is really.

MrWicked0

2010-02-19 21:30:51

Thanks guys!

twobac

2010-03-25 20:02:07

From: NCDS
+1

You want your "Parent" point to have 255 tolerance as RS uses Static Colors and by setting the tolerance to 255 you will find it no matter what variation of that color it is really.


If I have a dtm of FishX (uncooked), and the main point tol is set to 255.

FindDTM would find an uncooked, cooked & burnt FishX if I had them all in my inventory?

Sex

2010-03-25 20:15:33

Yes.

twobac

2010-03-25 20:30:07

So what would be better
1. use a tol of 255 for all DTMs and use UpText to work out how cooked an item maybe
2. use a lower tol of about 20?
3. something else?

i luffs yeww

2010-03-25 20:33:29

You could use a bitmap. Or a DDTM. Or a lower tol for the parent. (Like 0..)

Sex

2010-03-25 20:33:40

When I am doing DTMs that have to be specific like that (item with same shape but different texture/color) I use a tolerance of 15 in the main point and 0 in all the edge points.

Edit: Or do a color check where the DTM is found.

Nava2

2010-03-25 20:52:58

Use a ddtm for fish of the same shape but different colour.

A dtm with a tol that isn't 255 is usually your best bet. It's silly to have it that high it would lead to sone silly silly false positives that are not necessary. A proper tol > all tol.

twobac

2010-03-25 22:23:02

ok thanks everyone. I have had lots of probs so far with Bitmaps/DTMs for my bone burying procedure, but the concept is the same for many other procedures.

Bitmap Finder - Never works after I switch worlds? Only works on the world I create the bitmap on. here is an example.
[php]program New;
{.include srl/srl.scar}
var
NormalBones:integer;
procedure LoadBitMap;
begin
NormalBones := BitmapFromString(14, 15, 'beNp9ke0LwVAUxvf/f' +
'1UIGZuJNIQxy1jCFGM+YN6Sl+GLIv+Ap06tdTduv9Z5bs8997lnHB' +
'dcRUGgQlcUwP1YrUq5kM1Q/Xk8VpYF0rEoYzO7XZDneZLH1ZLY2Db' +
'wO1+uCwxVJWkNBvPR8NftznyG44iKGGq1yv1d543TazX5eJzZp8xa' +
'rQb8nWVJCjZh0i6nE9DX2oBx2qbp70aS7goOh4rdYgGbd3Cod4Dfi' +
'fz4vu83gJ7AS8VMUpFlr74f9mOj50nUIBGJkCzlxNBxIQbyYLD0tO' +
't2K6aSoc7n5XxarwFJiofNTqP+7398AVKEur8=');
end;
procedure FBitmap;
var
x, y: integer;
begin
FindBitmapToleranceIn(NormalBones, x, y, 560, 214, 734, 457, 35);
end;
begin
SetupSRL;
FBitmap
end.[/php]

with DTMs previously to finding this thread I had always left the tol at 0. Since setting it to 255, it has managed to find and bury all bones in the inventory. A real achievement and I am very happy. lol (first brick in the wall of learning how to script :) )


So my questions are.
1. What was wrong on the Bitmap finder above?
2. For items in Inventory that have same shape diff colour, food/armor/weapons etc
- Why are DDTMs better than DTMs and what about Bitmaps?
- Which are faster, less memory hungrey?
3. For items in Inventory that have a unique shape/colour, what mthod is best here?

Sorry for all the questions, I have tried to limit them. :)

Slowly getting the hang of things.

Thanks Again.

Frement

2010-03-25 22:26:51

From: twobac
ok thanks everyone. I have had lots of probs so far with Bitmaps/DTMs for my bone burying procedure, but the concept is the same for many other procedures.

Bitmap Finder - Never works after I switch worlds? Only works on the world I create the bitmap on. here is an example.
[php]program New;
{.include srl/srl.scar}
var
NormalBones:integer;
procedure LoadBitMap;
begin
NormalBones := BitmapFromString(14, 15, 'beNp9ke0LwVAUxvf/f' +
'1UIGZuJNIQxy1jCFGM+YN6Sl+GLIv+Ap06tdTduv9Z5bs8997lnHB' +
'dcRUGgQlcUwP1YrUq5kM1Q/Xk8VpYF0rEoYzO7XZDneZLH1ZLY2Db' +
'wO1+uCwxVJWkNBvPR8NftznyG44iKGGq1yv1d543TazX5eJzZp8xa' +
'rQb8nWVJCjZh0i6nE9DX2oBx2qbp70aS7goOh4rdYgGbd3Cod4Dfi' +
'fz4vu83gJ7AS8VMUpFlr74f9mOj50nUIBGJkCzlxNBxIQbyYLD0tO' +
't2K6aSoc7n5XxarwFJiofNTqP+7398AVKEur8=');
end;
procedure FBitmap;
var
x, y: integer;
begin
FindBitmapToleranceIn(NormalBones, x, y, 560, 214, 734, 457, 35);
end;
begin
SetupSRL;
FBitmap
end.[/php]

with DTMs previously to finding this thread I had always left the tol at 0. Since setting it to 255, it has managed to find and bury all bones in the inventory. A real achievement and I am very happy. lol (first brick in the wall of learning how to script :) )


So my questions are.
1. What was wrong on the Bitmap finder above?
2. For items in Inventory that have same shape diff colour, food/armor/weapons etc
- Why are DDTMs better than DTMs and what about Bitmaps?
- Which are faster, less memory hungrey?
3. For items in Inventory that have a unique shape/colour, what mthod is best here?

Sorry for all the questions, I have tried to limit them. :)

Slowly getting the hang of things.

Thanks Again.


1. I would have made bitmap mask of the outline.
2. DTM is best for that imo.
3. I still say DTM is the best option.

i luffs yeww

2010-03-25 23:27:46

Bitmaps are faster apparently. According to Freddy..

And I'd say bitmaps.

http://villavu.com/forum/showthread.php?t=47374

Notice how he doesn't get the whole part. You really don't need much of the picture at all and it can find the difference between them. A small 2x7 would suffice for most things.

twobac

2010-03-26 00:03:35

Thanks I will read the tut 2morrow