SRL Archive - MSI Bugs

Small DTM Bug


Yago

2011-06-21 13:24:53

I was running MSI powercutter and I had no axe in the inventory or eqquiped.
MSI went through the supported axe list and found a steel hatchet and started to WC.

Obviously maybe the DTM for steel hatchets should be updated or something.

Here's what I had in the inventory:
Wizard's Mind Bombs
Coins(109k)

Equipped:
Golden Hammer

Hope this helps.

Brandon

2011-06-21 14:20:04

:S I don't get the bug :P If it found the steel hatchet and started woodcutting, isn't that good then? That means the dtm works… unless you had other axes which can be used and it just only found steel..

I don't get this bug :S

Rich

2011-06-21 14:27:32

From: ggzz
:S I don't get the bug :P If it found the steel hatchet and started woodcutting, isn't that good then? That means the dtm works… unless you had other axes which can be used and it just only found steel..

I don't get this bug :S
He didn't have an axe yet it still tried to WC. At least that's what I think you're saying Yago?

Yago

2011-06-21 14:32:52

From: Rich
He didn't have an axe yet it still tried to WC. At least that's what I think you're saying Yago?


Correct. No axe but it found one. Then I gave the list of items I had that may have been similar to the steel hatchet dtm.

NCDS

2011-06-21 15:26:00

All hatchets use the same DTM (except dragon ofc). Anything that was closely colored to a steel hatchet?

I'll see if a golden hammer returns a false positive I guess.

Yago

2011-06-21 15:51:56

Everything else has no resemblance to a steel hatchet

Coh3n

2011-06-22 09:53:01

Do you know if the hatchet was found equipped or not? This is why I dislike DTMs. They should be more accurate than this.. Maybe we're doing something wrong.

Yago

2011-06-22 10:00:01

From: Coh3n
Do you know if the hatchet was found equipped or not? This is why I dislike DTMs. They should be more accurate than this.. Maybe we're doing something wrong.


I don't know. It looked in both my inventory and equipped items though.

Coh3n

2011-06-22 10:01:23

From: Yago
I don't know. It looked in both my inventory and equipped items though.
Yeah. I think it checks the equipment tab first, so it would have found it in the inventory. Can you get the debug log please (MSI/Debug Logs)?

Yago

2011-06-22 10:04:15

From: Coh3n
Yeah. I think it checks the equipment tab first, so it would have found it in the inventory. Can you get the debug log please (MSI/Debug Logs)?


Yes, I'll have to remind myself as soon as I get home.

Coh3n

2011-06-22 21:46:59

Great. :)

Yago

2011-06-22 22:32:31

From: Coh3n
Great. :)


Wow. Totally forgot. Thanks for the bump.

Unfortunately, I had the debug setting set to false…. Sorry.

Coh3n

2011-06-22 22:40:16

From: Yago
Wow. Totally forgot. Thanks for the bump.

Unfortunately, I had the debug setting set to false…. Sorry.

Okay well the only thing we can really do is tell you not to have whatever item you had. :p Or try each item individually and see which is causing the issue.

NCDS

2011-06-23 00:00:47

From: Coh3n
Okay well the only thing we can really do is tell you not to have whatever item you had. :p Or try each item individually and see which is causing the issue.


I'm going to check and make sure it was the golden hammer in the morning ( a bit intoxicated right now) and try to re-work the DTM to compensate for that if it is indeed the problem, but for now, yes, don't have those items with you :p

KingKong

2011-06-23 01:47:37

Is it not possible to use a dtm to find objects then check to see if the number of black pixels is the same or not? Or is this how MSI works already?(i don't use it, so i dunno)

Coh3n

2011-06-23 02:56:20

From: KingKong
Is it not possible to use a dtm to find objects then check to see if the number of black pixels is the same or not? Or is this how MSI works already?(i don't use it, so i dunno)
Could work as a failsafe I guess, but some items have the same number of black pixels such as hatchets and pickaxes.

i luffs yeww

2011-06-23 03:28:27

Wasn't there a move to use blacklists in MSI before? What ever happened to that?

Coh3n

2011-06-23 03:35:11

From: i luffs yeww
Wasn't there a move to use blacklists in MSI before? What ever happened to that?
No one ever converted the system to Simba.

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

KingKong

2011-06-23 05:16:58

From: Coh3n
Could work as a failsafe I guess, but some items have the same number of black pixels such as hatchets and pickaxes.


Some items do, thats why I'm saying that we should use dtm to identify an item(say hatchet), then we count the black pixels of items(not all of them, just the ones that are in the lower half of the item) identified as hatchets and compare it with the real one, if done properly it should either find all hatchets or none. Or we could take a bitmap of the wooden end of the pickaxe or hatchet and use that?

Coh3n

2011-06-23 05:20:54

From: KingKong
Some items do, thats why I'm saying that we should use dtm to identify an item(say hatchet), then we count the black pixels of items(not all of them, just the ones that are in the lower half of the item) identified as hatchets and compare it with the real one, if done properly it should either find all hatchets or none. Or we could take a bitmap of a the wooden end of the pickaxe or hatchet and use that?
Yeah makes sense. Worst case scenario it finds the wrong hatchet, but a hatchet nonetheless. It would be a pain to get the black pixels from the bottom half of the item though.

TomTuff

2011-06-23 06:00:29

From: Coh3n
Yeah makes sense. Worst case scenario it finds the wrong hatchet, but a hatchet nonetheless. It would be a pain to get the black pixels from the bottom half of the item though.


Nope, not a pain…


function HalfBlackCountAt(Slot: Integer): Integer;
var
B: TBox;
TPA: TPointArray;
begin
B := InvBox(Slot);
B.Y1 := B.Y2/2;
FindColorsTolerance(TPA, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2, 0);
Result := Length(TPA);
end;
;

Dgby714

2011-06-23 06:15:25

From: TomTuff
Nope, not a pain…


function HalfBlackCountAt(Slot: Integer): Integer;
var
B: TBox;
TPA: TPointArray;
begin
B := InvBox(Slot);
B.Y1 := B.Y2/2;
FindColorsTolerance(TPA, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2, 0);
Result := Length(TPA);
end;
;


Why wouldn't this work?
Result := CountColor(srl_outline_black, B.X1, B.Y1, B.X2, B.Y2);

also am I stupid or should it be this?
B.Y1 := B.Y1 + ((B.Y2 - B.Y1) div 2);

KingKong

2011-06-23 06:24:33

From: Dgby714
Why wouldn't this work?
Result := CountColor(srl_outline_black, B.X1, B.Y1, B.X2, B.Y2);



because we need the number of black pixels in the lower half of the item, ^ gives all of them, and yeah the B.Y1 should be what you said.

Dgby714

2011-06-23 06:32:54

From: KingKong
because we need the number of black pixels in the lower half of the item, ^ gives all of them, and yeah the B.Y1 should be what you said.


I ment replacing this with the ColorCount.
  FindColorsTolerance(TPA, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2, 0);
Result := Length(TPA);

like
function HalfBlackCountAt(Slot: integer): integer;
var
B: TBox;
begin
B := InvBox(Slot);
IncEx(B.Y1, (B.Y2 - B.Y1) div 2);
Result := CountColor(srl_outline_black, B.X1, B.Y1, B.X2, B.Y2);
end;

Does the item count really take up half of the item? Wouldn't getting the bottom 2/3 or 3/4 black of the item be better?

KingKong

2011-06-23 06:54:53

From: Dgby714
I ment replacing this with the ColorCount.
  FindColorsTolerance(TPA, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2, 0);
Result := Length(TPA);

like
function HalfBlackCountAt(Slot: integer): integer;
var
B: TBox;
begin
B := InvBox(Slot);
IncEx(B.Y1, (B.Y2 - B.Y1) div 2);
Result := CountColor(srl_outline_black, B.X1, B.Y1, B.X2, B.Y2);
end;

In that case you're right, that would be good.

Does the item count really take up half of the item? Wouldn't getting the bottom 2/3 or 3/4 black of the item be better?


I picked half because it'd be harder to get the black pixels just below the item count or any other way.

Edit: Just figured out that the functions tom and you posted count the black pixels relative to srl inventory box points, not the actual ones from half of the item(do i make sense?), dunno how this would affect the result though.

Coh3n

2011-06-23 07:20:43

From: KingKong
I picked half because it'd be harder to get the black pixels just below the item count or any other way.

Edit: Just figured out that the functions tom and you posted count the black pixels relative to srl inventory box points, not the actual ones from half of the item(do i make sense?), dunno how this would affect the result though.
As long as SRL calculates each slot as the same size, it shouldn't matter. Also, you should be able to just count what's below the numbers when the item is stacked. You can just zoom in and count the pixel height, then add it to the Y value.

By a pain I meant that you'll have to do this for every MSI item, then add them all to each item record.

KingKong

2011-06-23 07:50:12

From: Coh3n
As long as SRL calculates each slot as the same size, it shouldn't matter.

But what happens if the item is small and the whole item is fully in the top half of the srl slot?

Also, you should be able to just count what's below the numbers when the item is stacked. You can just zoom in and count the pixel height, then add it to the Y value.

cant be bothered, too much work :p

By a pain I meant that you'll have to do this for every MSI item, then add them all to each item record.


Well thats the price if we want to make it more accurate, but if we can get a few people to contribute, it should'nt be a problem.

Coh3n

2011-06-23 08:07:22

From: KingKong
Well thats the price if we want to make it more accurate, but if we can get a few people to contribute, it should'nt be a problem.
Let's hope not.

And if the item is small it wouldn't matter because the numbers wouldn't show on the item anyway. If it's in the top half, that's why you just cut out where the numbers would be, not half of the box.

NCDS

2011-06-23 09:35:20

Just tested with golden hammer and it did not detect it as a hatchet, and deposited it as it should. However, it did think my whip was an addy hatchet. This is clearly going to be an issue with certain items when using only DTM's.

We can indeed decide on and implement a fail safe for this but for now just try to have the proper hatchet with you already. ;)

Yago

2011-06-23 12:46:47

Great. I think we should use dtms with failsafes.

Edit: Maybe hover for the uptext?

Coh3n

2011-06-23 18:48:47

From: Yago
Great. I think we should use dtms with failsafes.

Edit: Maybe hover for the uptext?
That would work, but wouldn't look good. Imagine it hovering each log in the inventory before banking.

Rich

2011-06-23 19:07:16

From: Coh3n
That would work, but wouldn't look good. Imagine it hovering each log in the inventory before banking.
Instead of hovering objects which the DTMs don't detect as hatchets, hover over the items the DTMs DOES detect.

Coh3n

2011-06-23 19:12:49

From: Rich
Instead of hovering objects which the DTMs don't detect as hatchets, hover over the items the DTMs DOES detect.
That's what I mean. It'll find 28 Willow logs. You don't want it to hover all 28 that are found.

Yago

2011-06-24 10:57:22

From: Coh3n
That's what I mean. It'll find 28 Willow logs. You don't want it to hover all 28 that are found.


We should only hover over tools. And maybe just once upon startup…

Edit: Of coarse I really dont like this solution as we should find a better way to detect items.

Coh3n

2011-06-24 17:47:19

From: Yago
We should only hover over tools. And maybe just once upon startup…

Edit: Of coarse I really dont like this solution as we should find a better way to detect items.
Eventually blacklists will in implemented, just not sure when anyone will get around to doing it.

KingKong

2011-06-26 03:12:48

I think I have a clue as to why the dtm stuffs up. Tell me, does MSI search for the dtm using the topleft and bottom right of inventory coords? Because if it does then it is possible that the black pixels of two/three items in a row/column is detected as one item. IF this is the case, then perhaps the dtm's could be searched by looping through each inv slot.

Coh3n

2011-06-26 03:30:33

From: KingKong
I think I have a clue as to why the dtm stuffs up. Tell me, does MSI search for the dtm using the topleft and bottom right of inventory coords? Because if it does then it is possible that the black pixels of two/three items in a row/column is detected as one item. IF this is the case, then perhaps the dtm's could be searched by looping through each inv slot.

Interesting thought. I'm 99% sure that MSI loops through inventory slots to find regular items (MSI_FindItemSlots), but I'm not sure if we search the entire inventory in MSI_FindTool. I'll definitely check that out when I get home in the morning. I hope that solves it because this has given us grief several times.

KingKong

2011-06-26 03:34:52

I just had a look though the github and this is what i found in MSI_FindTool:

if (FindDTM(MSI_Items[Tool].DTM, x, y, MIX1, MIY1, MIX2, MIY2)) then....
So i think that should be changed, and hopefully that should fix the problem.

Coh3n

2011-06-28 00:34:10

From: KingKong
I just had a look though the github and this is what i found in MSI_FindTool:

if (FindDTM(MSI_Items[Tool].DTM, x, y, MIX1, MIY1, MIX2, MIY2)) then....
So i think that should be changed, and hopefully that should fix the problem.
Okay thanks King. We should be able to use MSI_FindItemSlots for when it checks the inventory, then use the normal MIX1 coordinates for checking the equipment tab. I don't have time to do it right now, but I'll get to it in the next couple days if no one else does. :)

Thanks for everyone's help.

E: I've made MSI_FindTool search each inventory slot rather than the entire inventory at once, Yago, could you please tell me if you still have this problem (be sure your setup is exactly the same as before).

E2: Something I came across, Nava. What's the point of SpiralMouse?

Yago

2011-06-29 11:52:06

From: Coh3n

E: I've made MSI_FindTool search each inventory slot rather than the entire inventory at once, Yago, could you please tell me if you still have this problem (be sure your setup is exactly the same as before).


Ill run it right now and edit this post…

Yago

2011-06-30 11:37:50

From: Yago
Ill run it right now and edit this post…


Edit: Wow totally forgot about this… Here's the debug I got from the file:

I believe it found the axe equipped….

[ ] ---- We are powerskilling, we have no specific location
[ ] -- MSI_AtLocation: True
[ ] -- MSI_SetupPlayer
[ ] ------ Scanning for randoms...
[ ] ---- MSI_SetSkillLevels
[ ] ------ [HOOKED] CharacterStats_FunctionCall: CharacterStats
[ ] ---------- Bobzilla_GetData: Getting skill levels
[ ] ---------- Player Found in XML, Updating
[ ] ------ [HOOKED] CharacterStats_FunctionCall: CharacterStats: 1
[ ] ------ Woodcutting Level: 78
[ ] ---- MSI_SetSkillLevels: Finished
[ ] ---- MSI_SetupWC/Mining
[ ] ------ Best tool for Woodcutting is Dragon Hatchet
[ ] ------ MSI_FindTool
[ ] -------- Searching Equipment tab
[] -------- Failed to find DTM of Dragon Hatchet
[ ] ------ MSI_FindTool: False
[ ] ------ MSI_FindTool
[ ] -------- Searching Equipment tab
[ ] -------- Failed to find DTM of Rune Hatchet
[ ] ------ MSI_FindTool: False
[ ] ------ MSI_FindTool
[ ----- Searching Equipment tab
[ ] ---ailed to find DTM of Adamant Hatchet
[ ] ------ MSIol: False
[ ] ------ MSI_FindTaownz ] -------- Searching Equipb
[ ] -------- Failed to find DTM of l Hatchet
[ ] ------ MSI_FindTool: False
[ - MSI_FindTool
[] -------- Searching Eq tab
[ ] -------- Found DTM of Steel Hatchet
[] ------ MSI_FindTool: True
[ ] ---- MSI_SetupWC/Mining: True
[] -- MSI_SetupPlayer: True
[ ] ---- Player's SPS_Areas: []
] -- MSI_AutoObjects
[] ---- MSI_CountItems: Found 0 of Normal logs (0 XP)
[ ] ---- MSI_CountItems: Found 0 of Oak logs (0 XP)
[ ] ---- MSI_DropAll

Here's my inventory and my equipped items.

Someone should wear what I was wearing to confirm the double negative because I believe it found the axe in my equipped items.

Yago

2011-06-30 11:40:29

Bump for my edit

NCDS

2011-06-30 13:17:19

From: Yago
Edit: Wow totally forgot about this… Here's the debug I got from the file:

I believe it found the axe equipped….

[ ] ---- We are powerskilling, we have no specific location
[ ] -- MSI_AtLocation: True
[ ] -- MSI_SetupPlayer
[ ] ------ Scanning for randoms...
[ ] ---- MSI_SetSkillLevels
[ ] ------ [HOOKED] CharacterStats_FunctionCall: CharacterStats
[ ] ---------- Bobzilla_GetData: Getting skill levels
[ ] ---------- Player Found in XML, Updating
[ ] ------ [HOOKED] CharacterStats_FunctionCall: CharacterStats: 1
[ ] ------ Woodcutting Level: 78
[ ] ---- MSI_SetSkillLevels: Finished
[ ] ---- MSI_SetupWC/Mining
[ ] ------ Best tool for Woodcutting is Dragon Hatchet
[ ] ------ MSI_FindTool
[ ] -------- Searching Equipment tab
[] -------- Failed to find DTM of Dragon Hatchet
[ ] ------ MSI_FindTool: False
[ ] ------ MSI_FindTool
[ ] -------- Searching Equipment tab
[ ] -------- Failed to find DTM of Rune Hatchet
[ ] ------ MSI_FindTool: False
[ ] ------ MSI_FindTool
[ ----- Searching Equipment tab
[ ] ---ailed to find DTM of Adamant Hatchet
[ ] ------ MSIol: False
[ ] ------ MSI_FindTaownz ] -------- Searching Equipb
[ ] -------- Failed to find DTM of l Hatchet
[ ] ------ MSI_FindTool: False
[ - MSI_FindTool
[] -------- Searching Eq tab
[ ] -------- Found DTM of Steel Hatchet
[] ------ MSI_FindTool: True
[ ] ---- MSI_SetupWC/Mining: True
[] -- MSI_SetupPlayer: True
[ ] ---- Player's SPS_Areas: []
] -- MSI_AutoObjects
[] ---- MSI_CountItems: Found 0 of Normal logs (0 XP)
[ ] ---- MSI_CountItems: Found 0 of Oak logs (0 XP)
[ ] ---- MSI_DropAll

Here's my inventory and my equipped items.

Someone should wear what I was wearing to confirm the double negative because I believe it found the axe in my equipped items.

I don't get that. It didn't detect the Golden hammer as anything for me… :confused:

Yago

2011-06-30 16:37:29

Try wearing exactly what I was wearing and having the same items in your inv? Maybe a little process of elimination will help. Ill mess around with it a bit. Someone please try this same thing.

Coh3n

2011-07-02 11:50:05

Can you open your Items.simba file and change line 1923 in MSI_FindTool with this? Tell me what happens.

toolFound := FindDTM(MSI_Items[tool].DTM, x, y, 560, 285, 605, 320);

Yago

2011-07-02 14:37:13

It Failed to find the hatchets.

KingKong

2011-07-02 20:48:51

From: Yago
It Failed to find the hatchets.


So the new fix worked? or did it fail to find the hatchet even if you had it?

Yago

2011-07-02 21:24:48

From: KingKong
So the new fix worked? or did it fail to find the hatchet even if you had it?


It worked… In other words it didn't detect my golden hammer as a hatchet this time.

Coh3n

2011-07-04 06:53:43

From: Yago
It worked… In other words it didn't detect my golden hammer as a hatchet this time.
Good to know, thanks for your help. :)

Will update to the latest version. Also, just encounters this bug with my character, it's finding the green team cape as the steel DTM. All I did was add a mmouse() after the DTM was found and it moved right to the cape.

Yago

2011-07-04 10:36:24

From: Coh3n
Good to know, thanks for your help. :)

Will update to the latest version. Also, just encounters this bug with my character, it's finding the green team cape as the steel DTM. All I did was add a mmouse() after the DTM was found and it moved right to the cape.


It could have been my cape then… The DTM should still be changed then…

Coh3n

2011-07-04 11:42:14

From: Yago
It could have been my cape then… The DTM should still be changed then…
It only look in the weapon slot now so it won't matter. Someone can change the DTM if they want, but it has to be tested with all the hatchets.

Yago

2011-07-04 15:00:19

From: Coh3n
It only look in the weapon slot now so it won't matter. Someone can change the DTM if they want, but it has to be tested with all the hatchets.


OK thanks Coh3n.