Replacing DTMs with Blacklists
Coh3n
2010-07-09 17:58:19
UPDATE: May 4th, 2011:It's been discussed and the best route is the convert Nielsie's system to Simba and go from here. I've attached his system that I dug up from my files.
Yes I know, yet another change. :p RM recently asked me what I thought about using Blacklists instead of DTMs. Blacklists, if I understand correctly, basically recognize an item by the number of black pixels in the border of that item.
Advantages:
- Would clean up a lot of code in MSI. For example, we would no longer need the functions for loading DTM properties. We can just add an attribute to the TItem record that stores the item's border count.
- Faster than DTMs, not to mention we wouldn't have to load 100 DTMs into memory. Instead, we would load 100 integers.
- Much easier to update as it doesn't require creating a new DTM. We can just do a CountColor on the inventory slot containing the item.
Disadvantages:
- Items with the same amount of pixels and same color will be recognized as the same item. One example is Fish food, and Poisoned Fish Food used in the quest "Ernest the Chicken".
This disadvantage is present with DTMs too.
After talking to NCDS for a while, we came up with this. It will recognize an item by it's border count (or perimeter). If the border count matches, it checks for that item's colour in the corresponding inventory slot. This would be how we distinguish between logs, hatchets, etc.
function MSI_FindItem(Item: Integer; SearchBox: TBox): Boolean;
var
i, x, y: Integer;
colCount: Integer;
begin
colCount := CountColor(SRL_OUTLINE_BLACK, SearchBox.x1, SearchBox.y1, SearchBox.x2, SearchBox.y2);
if (colCount = MSI_Items[Item].BorderCount) then
for i := 0 to High(MSI_Items[Item].Colors) do
if FindColor(x, y, MSI_Items[Item].Colors[i], b.x1, b.y1, b.x2, b.y2) then
begin
Result := True;
Exit;
end;
end;
function MSI_FindItemSlots(Item: Integer): TIntegerArray;
var
i, l: Integer;
begin
for i := 1 to 28 do
if MSI_FindItem(Item, InvBox(i)) then
begin
l := Length(Result);
SetLength(Result, l + 1);
Result[l] := i;
end;
end;
If you want to get the number of black pixels for an item, you can run this simple script. Just have whatever item you want in the first inventory slot, drag the corsshairs and hit run!
program new;
{.include SRL/SRL.scar}
function GetBorderCount(InvSlot: Integer): Integer;
var
b: TBox;
begin
b := InvBox(InvSlot);
Result := CountColor(SRL_OUTLINE_BLACK, b.x1, b.y1, b.x2, b.y2);
end;
begin
SetupSRL;
ActivateClient;
Writeln(IntToStr(GetBorderCount(1)));
end.
Thoughts?
3Garrett3
2010-07-09 18:01:39
How do we find the amount of pixles to create this blacklist thing?
I don't even know what they are, so I'll have to learn up. Sounds easier though.
Love this. It's by far my preferred method and has never failed me yet.
You may want to just briefly explain how we are distinguishing the different types of Logs, Pickaxes, etc. for those who may not understand the code ;)
Coh3n
2010-07-09 18:04:07
From: 3Garrett3
How do we find the amount of pixles to create this blacklist thing?
I don't even know what they are, so I'll have to learn up. Sounds easier though.
From: Coh3n
Much easier to update as it doesn't require creating a new DTM. We can just do a CountColor on the inventory slot containing the item.
From: Coh3n
Blacklists, if I understand correctly, basically recognize an item by the number of black pixels in the border of that item.
All you need to know. ;)
E:
From: NCDS
Love this. It's by far my preferred method and has never failed me yet.
You may want to just briefly explain how we are distinguishing the different types of Logs, Pickaxes, etc. for those who may not understand the code ;)
Done.
Sir R. M8gic1an
2010-07-09 18:07:02
From: 3Garrett3
How do we find the amount of pixles to create this blacklist thing?
Result := CountColor(SRL_OUTLINE_BLACK, SearchBox.x1, SearchBox.y1, SearchBox.x2, SearchBox.y2);
From: NCDS
You may want to just briefly explain how we are distinguishing the different types of Logs, Pickaxes, etc. for those who may not understand the code ;)
for i := 0 to High(MSI_Items[Item].Colors) do
if FindColor(x, y, MSI_Items[Item].Colors[i], b.x1, b.y1, b.x2, b.y2) then
begin
Result := True;
Exit;
end;
This does mean we'll have to very selective about the colors arrays.
I do still think having a proper look at Nielsie's system would be a good idea ;) But if this works, then yeah, good. :)
~RM
Coh3n
2010-07-09 18:08:41
Or:
Result := CountColor(SRL_OUTLINE_BLACK, InvBox(i));
In MSI_FindItem, I don't think we need to even loop through the colors as they should be static, meaning we would only need one color, right?
Unless for some reason we would need multiple colors to identify an item, which could possibly end up happening I guess.
Coh3n
2010-07-09 18:22:33
From: Rasta Magician
This does mean we'll have to very selective about the colors arrays.
I do still think having a proper look at Nielsie's system would be a good idea ;) But if this works, then yeah, good. :)
~RM
They should be well picked colours anyway. :rolleyes:
From: NCDS
In MSI_FindItem, I don't think we need to even loop through the colors as they should be static, meaning we would only need one color, right?
That's only there because the colors attribute is an array.
From: NCDS
Unless for some reason we would need multiple colors to identify an item, which could possibly end up happening I guess.
I agree. We have multiple colours for items, yet only one colour for objects. One colour for items is enough I think.
i luffs yeww
2010-07-09 19:30:45
I've been using blacklists over bitmaps/DTMs for awhile, and I love them. :)
I support this.
(Also, it's much easier for new scripters to make a blacklist over bitmaps or DTMs.)
Coh3n
2010-07-09 19:32:22
From: i luffs yeww
I've been using blacklists over bitmaps/DTMs for awhile, and I love them. :)
I support this.
(Also, it's much easier for new scripters to make a blacklist over bitmaps or DTMs.)
Heh, I've never actually used them. :o
I don't know, it's just the idea in general that I love.
Narcle
2010-07-09 19:48:29
Only one problem with blacklists. You can't use them for the bank. Blacklists for just your inventory are awesome, but if you want it for the bank too - no go. That's the only thing that sucks about them. (unless you perfectly cut off the top portion of the search area for every square so that the amount in the bank doesn't cover it up)
Wanted
2010-07-09 19:50:40
From: Narcle
Only one problem with blacklists. You can't use them for the bank. Blacklists for just your inventory are awesome, but if you want it for the bank too - no go. That's the only thing that sucks about them. (unless you perfectly cut off the top portion of the search area for every square so that the amount in the bank doesn't cover it up)
Why couldn't you use for the bank?
Wouldn't you just need a SplitTPA?
Coh3n
2010-07-09 19:56:40
From: Narcle
Only one problem with blacklists. You can't use them for the bank. Blacklists for just your inventory are awesome, but if you want it for the bank too - no go. That's the only thing that sucks about them. (unless you perfectly cut off the top portion of the search area for every square so that the amount in the bank doesn't cover it up)
You could have a blacklist for the item in the bank and in the inventory, but that would be unfortunate.
Narcle
2010-07-09 20:00:14
From: Coh3n
You could have a blacklist for the item in the bank and in the inventory, but that would be unfortunate.
The amount number varies and depending on its size will change how many black pixels are in the item, it could even change the height of the blacklist.
3Garrett3
2010-07-09 20:01:51
From: Coh3n
You could have a blacklist for the item in the bank and in the inventory, but that would be unfortunate.
This wouldn't work, the amount changes = more or less yellow pixles, and then your count would be off. Does this mean that dtms should be included then?
ZephyrsFury
2010-07-09 23:00:36
From: Narcle
The amount number varies and depending on its size will change how many black pixels are in the item, it could even change the height of the blacklist.
This is one of the reasons why blacklists are not used in SRL. Nielsie's system maybe have a solution for this but I can't remember.
Shuttleu
2010-07-10 08:40:12
the item colours are not static, so surely you want it to be FindColorTolerance…
~shut
Coh3n
2010-07-10 10:47:03
From: Narcle
The amount number varies and depending on its size will change how many black pixels are in the item, it could even change the height of the blacklist.
That would affect DTMs also, unless they were made to avoid such errors.
From: 3Garrett3
This wouldn't work, the amount changes = more or less yellow pixles, and then your count would be off. Does this mean that dtms should be included then?
Like Narcle said, you could cut off the top portion of the item, but I'm not really a huge fan of that.
From: ZephyrsFury
This is one of the reasons why blacklists are not used in SRL. Nielsie's system maybe have a solution for this but I can't remember.
We do plan on looking at his system eventually. :p
From: Shuttleu
the item colours are not static, so surely you want it to be FindColorTolerance…
~shut
Alright, I always thought they were static, but that's an easy enough change.
i luffs yeww
2010-07-10 12:12:41
Shuttleu, wat
Items are static. In color and shape and size. Except if they update them when they update hooks.
Shuttleu
2010-07-10 12:58:22
i tried with a salmon and a trout
and when i reloaded the client they were a different colour
~shut
i luffs yeww
2010-07-10 13:20:46
Well I've been using the same color for a GetColor for my air crafter and it's been working for a couple weeks.
Narcle
2010-07-10 15:23:33
From: Coh3n
That would affect DTMs also, unless they were made to avoid such errors.
Its not hard to make a DTM that doesn't use the top part of the item.
From: Coh3n
Alright, I always thought they were static, but that's an easy enough change.
The black color is static.
Shuttleu if that's the case for you your doing it wrong. Use srl_outline_black, that's the constant for the black color RS uses.
Coh3n
2010-07-10 16:23:22
From: Narcle
Its not hard to make a DTM that doesn't use the top part of the item.
You could do the same for blacklists I suppose.
From: Narcle
Shuttleu if that's the case for you your doing it wrong. Use srl_outline_black, that's the constant for the black color RS uses.
I thought he was talking about the item's distinct colour (not the outline).
Shuttleu
2010-07-10 16:55:54
From: Coh3n
I thought he was talking about the item's distinct colour (not the outline).
i was, the middle of the the item (so you can tell the difference between a rune hatchet and bronze hatchet), because the outline by itself is not enough
~shut
Sabzi
2010-07-10 17:03:21
You can use the skip functions to avoid problems with amounts. I haven't found any of those functions in simba, maybe something to suggest? That way you would always be able to skip the same top left area.
3Garrett3
2010-07-10 17:04:35
From: Shuttleu
i was, the middle of the the item (so you can tell the difference between a rune hatchet and bronze hatchet), because the outline by itself is not enough
~shut
We do use tol though, so what's the problem..
Shuttleu
2010-07-10 17:07:03
From: 3Garrett3
We do use tol though, so what's the problem..
the function on the front page doesnt use tolerance
~shut
Coh3n
2010-07-10 17:29:42
From: Sabzi
You can use the skip functions to avoid problems with amounts. I haven't found any of those functions in simba, maybe something to suggest? That way you would always be able to skip the same top left area.
Yeah. RM said that Nielsie's system worked for the bank also, so once we get the chance to check that out we
should be good.
From: Shuttleu
the function on the front page doesnt use tolerance
~shut
Yeah, because my understanding was that item colours were static.
Shuttleu
2010-07-10 17:33:20
From: Coh3n
Yeah, because my understanding was that item colours were static.
its ok
i was replying to 3Garrett3
~shut
Coh3n
2010-07-10 17:37:55
From: Shuttleu
its ok
i was replying to 3Garrett3
~shut
Lol right, my bad. :p
Sabzi
2010-07-10 17:41:25
Nielsie's system? Sorry this must be around somewhere but I was playing tf2 the last few days(engi update) so can you link me, please?
Shuttleu
2010-07-10 17:44:39
Sabzi
2010-07-10 17:46:22
From: Shuttleu
damn, i cant view it :(
~shut
So that's why I didn't see it. Usually I check interesting threads and every thread by nielsie is interesting :p.
Thank anyway, Coh3n!
Coh3n
2010-07-10 17:54:58
Oh wow, sorry guys I didn't even realize it was in the Senior section. His system looks a lot more complicated then what I wrote up. But yeah, Narcle is right, banking would be an issue. I'm not sure if it's worth it to switch from DTMs. After all, I'm a believer with sticking with what works (unless, of course, there's a significant enough reason for me to believe otherwise).
MylesMadness
2010-07-10 17:56:32
From: Coh3n
http://villavu.com/forum/showthread.php?t=45098&highlight=Blacklists
You herd I was sad so you posted a link in the thread so I can be sad while I'm sad
Coh3n
2010-07-10 18:00:17
From: MylesMadness
You herd I was sad so you posted a link in the thread so I can be sad while I'm sad
What? Lol
MylesMadness
2010-07-10 18:01:59
From: Coh3n
What? Lol
The link to Nielsie's system can't be read by many people, including me which saddened me
Coh3n
2010-07-10 18:44:17
From: MylesMadness
The link to Nielsie's system can't be read by many people, including me which saddened me
Yeah I didn't realize. :( I'm sorry I saddened you.
Sir R. M8gic1an
2010-07-11 06:14:20
We could make it not count the top left part of the items…
But couple problems we might run into:
InvBox & BankBox (if something for some reason fails)
It's not ideal, as we're ignoring information..
edit: I just checked the thread. Seems like it works in bank. PMing Nielsie.
~RM
Coh3n
2010-07-11 10:30:09
From: Rasta Magician
We could make it not count the top left part of the items…
But couple problems we might run into:
InvBox & BankBox (if something for some reason fails)
It's not ideal, as we're ignoring information..
edit: I just checked the thread. Seems like it works in bank. PMing Nielsie.
~RM
I just hope it works just as well as DTMs.
Sir R. M8gic1an
2010-07-11 12:29:49
From: Coh3n
I just hope it works just as well as DTMs.
I agree with you, lets not rush any changes. No need to anyway.
~RM
Coh3n
2010-07-11 12:34:01
From: Rasta Magician
I agree with you, lets not rush any changes. No need to anyway.
~RM
Great minds think alike. :rolleyes:
i luffs yeww
2010-07-11 14:48:22
Shuttleu, item colors are static..
Shuttleu
2010-07-11 14:52:49
From: i luffs yeww
Shuttleu, item colors are static..
ima gonna prove you wrong :)
~shut
i luffs yeww
2010-07-11 15:01:49
^ >_> I picked this color weeks ago. It still works.
begin
if(GetColor(643, 230) = 13948382)then
Writeln('wat');
end.
I picked that color on the 25th of June.
From: i luffs yeww
The GetColor I posted is for an equipped air tiara. Equip one and test it.
I too have always been under the impression that the item colors were static.
I'll test it in just a minute to see.
If Nielsie's method doesn't workout, I'm quite sure we could make the TColorSkipBox or whatever it is work.
Shuttleu
2010-07-11 16:00:19
the video is uploading atm…
youtube takes ages
~shut
i luffs yeww
2010-07-11 16:07:48
The GetColor I posted is for an equipped air tiara. Equip one and test it.
From: i luffs yeww
The GetColor I posted is for an equipped air tiara. Equip one and test it.
Were talking about Inv though…
i luffs yeww
2010-07-11 16:10:08
It's the same in the inventory. I can test it in the inv and it'll still be constant.
Shuttleu is right, they change, sorry for that Coh3n >.<
Coh3n
2010-07-11 16:22:20
From: NCDS
Shuttleu is right, they change, sorry for that Coh3n >.<
No worries, it made sense that they would be static, but I can't say I'm surprised they're not.
3Garrett3
2010-07-11 16:27:26
I've always thought that they changed. It made sense that they did, everything else does..
i luffs yeww
2010-07-11 16:38:41
>_> Well I just recorded myself picking the colors and switching to different worlds. I'll upload it in a sec.
Shuttleu
2010-07-11 16:58:10
Wanted
2010-07-11 17:08:26
Items outline colors are static and have only changed once in the past couple of years.
Other colors on items are almost always dynamic, such as when using a bitmap for items it is required you use a tolerance, same when using a DTM with a point such as for runes where all items are the same shape but different colors i.e. runes/rune essence.
3Garrett3
2010-07-11 17:08:31
From: Shuttleu
here is the video
http://www.youtube.com/watch?v=D9DSTVsa0cY
~shut
Hahahah wow you're a dick.
You film yourself picking the two colours, it's a 10 second video. You don't need the 3:40 of bragging about how they changed. I can't wait until Ian posts the video of the colour staying the same. :)
i luffs yeww
2010-07-11 17:10:12
Shuttleu, you're not on lowest quality, fixed graphics, safe mode, etc..
I'm uploading mine soon.
3Garrett3
2010-07-11 17:17:47
From: i luffs yeww
Shuttleu, you're not on lowest quality, fixed graphics, safe mode, etc.
My first thought exactly
Shuttleu
2010-07-11 17:21:04
From: 3Garrett3
My first thought exactly
i am on lowest quality with safe mode
but this is a higher quality video
http://www.youtube.com/watch?v=R8XNqhBUu00~shut
EDIT: if you want then i will remake it showing thats its lowest quality and still changes colour
i luffs yeww
2010-07-11 17:26:05
No need to make a new one. I tested it too; waiting for the video to be processed.
http://www.youtube.com/watch?v=LPGwiZlesKc&fmt=22Watch in HD or else it's hard to see atm.
(May be better quality by default later; it's YouTube, not me. :))
Shuttleu
2010-07-11 17:35:32
too late, already uploading
~shut
I Luffs Yew and Shuttleu, please end this or take it else where, we've already established that they change.
i luffs yeww
2010-07-11 17:53:18
NCDS, wat
Did anyone watch my video? I switched to three different worlds and the color was static.
Shuttleu
2010-07-11 17:56:41
http://www.youtube.com/watch?v=C0CGfs6H5UIHQ version coming soon
@i luffs yeww - i will now watch your video
~shut
From: i luffs yeww
NCDS, wat
Did anyone watch my video? I switched to three different worlds and the color was static.
Maybe it is for certain objects or something, but I tested multiple times with Yew logs and rune hatchet and rarely could I find the same color twice.
It's such as minor detail that it really isn't worth all the debate. It's only an extra param :)
Coh3n
2010-07-11 18:00:16
From: i luffs yeww
NCDS, wat
Did anyone watch my video? I switched to three different worlds and the color was static.
Yeah, that's just one item though. I know it would make sense for all of them to be static/dynamic, but that may not be the case.
NCDS & shut, what items did you test on?
Shuttleu
2010-07-11 18:01:39
i just realized that i luffs yeww never reloads the client which is the reason his doesnt change
@i luffs yeww - reload the client and try again
~shut
Coh3n
2010-07-11 18:02:46
From: Shuttleu
i just realized that i luffs yeww never reloads the client which is the reason his doesnt change
~shut
Ohhh yeah, that's how the minimap colours change. I remember reloading the client like a douzen times when gathering the colours for SRL's autocolouring functions.
i luffs yeww
2010-07-11 18:13:50
Fair enough.
The new color was 1279101 instead of 1279102.
Equipment is still constant, which is odd.
nielsie95
2010-07-15 20:18:28
Greetings from America. RM, code can be released. Keep in mind that it's a concept (and the code's pretty old too).
Sir R. M8gic1an
2010-07-16 08:21:25
Hope you are having a good time on holiday Nielsie :)
Will be merging post onto here. Enjoy people.
~RM
————–
Hey,
I know Boreas worked on this for some time. I don't know if he ever finished it. But here's how I would do it. Open your bank and run the script. It should recognize most (tradeable, f2p) items. Currently it runs with an automaticly generated list from the GE, so some items may not work. Tell me how it works :)
I know Magic Staffs and Arrows don't work properly, but this is because the colors are located too high. I can't adjust the system to make it work with those..
CX gamer
2010-08-11 12:38:29
If anyone is interested; here is a list of a bunch of items and their corresponsive black pixels.
http://pastebin.com/sN0LZY5GIt may lag a bit on old PC's.
i luffs yeww
2010-08-11 14:14:20
Did you get those off the GE DB? If so, not all of them are right.
nielsie95
2010-08-11 14:18:01
From: Rasta Magician
I know Magic Staffs and Arrows don't work properly, but this is because the colors are located too high. I can't adjust the system to make it work with those..
Please not that this doesn't apply anymore.
From: nielsie95
Got it to work with arrows and staffs, I'll reupload later today.
Slot[1]: Steel hatchet (46ms)
Slot[2]: Iron arrow (62ms)
Slot[3]: Bronze bar (47ms)
Slot[4]: Bronze arrow (15ms)
Slot[5]: Steel arrow (16ms)
Slot[6]: Amulet of strength (47ms)
Slot[7]: Amulet of power (15ms)
Slot[8]: Mind talisman (62ms)
Slot[9]: Bronze hatchet (0ms)
Slot[10]: Raw swordfish (16ms)
Slot[11]: Lederhosen top (0ms)
Slot[12]: Air talisman (32ms)
Slot[13]: Raw shrimps (31ms)
Slot[14]: Diamond (47ms)
Slot[15]: Bronze pickaxe (31ms)
Slot[16]: Lederhosen shorts (15ms)
Slot[17]: Emerald (16ms)
Slot[18]: Thread (16ms)
Slot[19]: Green d'hide chaps (32ms)
Slot[20]: Mithril hatchet (0ms)
Slot[21]: Raw anchovies (16ms)
Slot[22]: Mime gloves (62ms)
Slot[23]: Lobster pot (0ms)
Slot[24]: Tinderbox (31ms)
Slot[25]: Raw salmon (109ms)
Slot[26]: Mime top (0ms)
Slot[27]: Bones (32ms)
Slot[28]: Uncut emerald (47ms)
Slot[29]: Mime boots (16ms)
Slot[30]: Small fishing net (0ms)
Slot[31]: Trout (47ms)
Slot[32]: Salmon (62ms)
Slot[33]: Leather boots (0ms)
Slot[34]: Iron pickaxe (15ms)
Slot[35]: Raw tuna (32ms)
Slot[36]: Oak logs (47ms)
Slot[37]: Law rune (109ms)
Slot[38]: Body rune (62ms)
Slot[39]: Raw lobster (16ms)
Slot[40]: Mithril platebody (47ms)
EDIT: Reuploaded
Boreas
2010-08-11 15:02:47
IIRC every version of BlackLists from the tut I made a few years ago to Nielsie's has skipped the top portion of item slots (for the black). That does mean that for staffs etc the color stage has to not skip (which Nielsie took care of). DDTMs and ColorCounts could also skip it.
Thanks to the list posted by CX gamer, heres a list of black pixel counts and how many items have that count.
http://pastebin.com/nqB2q4Pc (Ignore the 0=287, as that is just because the IDs are not completely consecutive.) Here
http://uppit.com/me1j5axy5kn5/countfreq.xls is a spreadsheet with the same list but with a graph at bottom. The graph ignores counts that no items have (y=0), which means the squares at the very bottom (y=1) have an X value of the black pixel count of items that can be recognized solely by a color count. The ones with a Y of about 8 are probably due to bronze/iron/steel/gold etc. The ones with higher Y values are why BlackLists also look at the positions of the black pixels if the counts match.
CX gamer
2010-08-11 15:22:21
My list used RAM memory hacking to save each induvidual image from the runescape client, that was also how I managed to upload an image of a trimmed dungeoneering cape on RS wikia ^^.
Please note that here and there may be some errors, but they should be minimal.
That's a neat looking graph there. :o
Gu3st...
2010-09-19 11:15:22
Alright, now that JaGeX' recent update to RS made a lot of the DTMs break, and with the new Cooking skill, I think it might be time to get these things going (Thanks Boreas and NCDS for reminding me of this thread :rolleyes:).
I agree that it should be done soon, but we've currently got multiple unfinished skills, and plenty of bugs.
Even though this would technically solve one of the 'bugs' I think we should get the other things taken care of.
Feel free to start gathering BL counts for items and save them, but I don't think we should push implementing the system at this particular moment. Not until we're a little more stable anyways.
I don't have much for time today, but tomorrow and tuesday are looking good :)
Coh3n
2010-09-20 16:02:21
From: NCDS
I agree that it should be done soon, but we've currently got multiple unfinished skills, and plenty of bugs.
Even though this would technically solve one of the 'bugs' I think we should get the other things taken care of.
Feel free to start gathering BL counts for items and save them, but I don't think we should push implementing the system at this particular moment. Not until we're a little more stable anyways.
I don't have much for time today, but tomorrow and tuesday are looking good :)
I agree, but Zyt3x, if you're interested in it, then go ahead and see if you can get it to work with Simba. :) Just be sure that Cooking is in a decent state before you move on to something else.
E: Nevermind, I think this should be added soon. We've had so many problems with DTMs since MSI started. Whether they just don't work or they get outdated. Automatically updating Blacklists will save us a lot of time and agony in the long run. If you don't mind, Zyt3x, I would like to take on this project. I will finish up with the Relocater this afternoon, hand the obstacle handling over to RM, and take a look at this.
Gu3st...
2010-09-21 08:23:47
From: Coh3n
I agree, but Zyt3x, if you're interested in it, then go ahead and see if you can get it to work with Simba. :) Just be sure that Cooking is in a decent state before you move on to something else.
E: Nevermind, I think this should be added soon. We've had so many problems with DTMs since MSI started. Whether they just don't work or they get outdated. Automatically updating Blacklists will save us a lot of time and agony in the long run. If you don't mind, Zyt3x, I would like to take on this project. I will finish up with the Relocater this afternoon, hand the obstacle handling over to RM, and take a look at this.
Yes, please do.
I have a lot of tests coming up, and wont have much time for MSI
I use TPAs to do my Banking procedures in my herblore script. Here is what I use:
for i := 0 to High(Herbcolor) do
begin
if FindColorsTolerance(HcTPA, HerbColor[i], MBx1, MBy1, MBx2, MBy2, 5) then
HTPA := CombineTPA(HTPA, HcTPA);
end;
begin
HATPA := SplitTPAEx(HTPA, 10, 10);
SortATPAFrom(HATPA,Point(MBx1, MBy1));
for i := 0 to High(HATPA) do
begin
MiddleTPAEx(HATPA[i], x, y);
MMouse(x, y, 5, 5);
if WaitUpTextMulti(Herbtext, 500) then
begin
ClickMouse2(False);
Break;
end;
end;
end;
So far it finds my item regardless of where its at in the bank as long as it's visable.
~BraK
nielsie95
2010-09-21 09:46:34
Remember that blacklists are basically DTMs. The only difference is that with blacklist you try to recognize the item from a spot, and with DTMs you try to find the spot of an item.
Automatically generating blacklists is just as easy/hard as automatically generating DTMs. The advantage of using blacklists is that you can compare an unknown item with multiple objects and therefore pick the object with the least tolerance. If you use a DTM with a high tolerance, you might end up with a false positive.
Things that you should keep in mind are items with the same boundary (length), stack/count (in bank) and colours. It's not as easy as just counting the outline, or just a part of the outline.
From: nielsie95
Remember that blacklists are basically DTMs. The only difference is that with blacklist you try to recognize the item from a spot, and with DTMs you try to find the spot of an item.
Automatically generating blacklists is just as easy/hard as automatically generating DTMs. The advantage of using blacklists is that you can compare an unknown item with multiple objects and therefore pick the object with the least tolerance. If you use a DTM with a high tolerance, you might end up with a false positive.
Things that you should keep in mind are items with the same boundary (length), stack/count (in bank) and colours. It's not as easy as just counting the outline, or just a part of the outline.
We could always take the item recognition a step farther and do GetTPABounds, then a SimilarColors check to identify the type of the item, if that's what your saying.
nielsie95
2010-09-21 12:55:02
Of course you can do that, but why wouldn't you use a DTM then?
From: nielsie95
Of course you can do that, but why wouldn't you use a DTM then?
We already do, and we use a similar same color recognition, though for whatever reason they are proving to be rather unreliable for some people.
nielsie95
2010-09-21 15:26:16
Ok :) I'm not trying to say that blacklists are a bad idea. I'm just trying to make clear that using blacklists wont automatically solve this problem and that you should keep in mind that DTMs can do a lot too. DTMs can be automatically generated, check for the boundaries and colours too. You should only use blacklists if you want to do something that the DTM system can't offer you (for example, picking an item out of a list that is most likely to be the item at a certain spot).
From: nielsie95
Ok :) I'm not trying to say that blacklists are a bad idea. I'm just trying to make clear that using blacklists wont automatically solve this problem and that you should keep in mind that DTMs can do a lot too. DTMs can be automatically generated, check for the boundaries and colours too. You should only use blacklists if you want to do something that the DTM system can't offer you (for example, picking an item out of a list that is most likely to be the item at a certain spot).
I know what your saying. That's pretty much why we haven't done much with this yet is because were looking for the best way to go about everything.
Your words have been helpful so far and your help is always welcome :)
I'm a little intoxicated right now, so I'm just going to break for a little bit >.<
Coh3n
2010-09-21 23:51:30
From: nielsie95
Ok :) I'm not trying to say that blacklists are a bad idea. I'm just trying to make clear that using blacklists wont automatically solve this problem and that you should keep in mind that DTMs can do a lot too. DTMs can be automatically generated, check for the boundaries and colours too. You should only use blacklists if you want to do something that the DTM system can't offer you (for example, picking an item out of a list that is most likely to be the item at a certain spot).
Hmm I never really thought about an automatically updating DTM script. All we need this for it to recognize items in the inventory, equipment tab and bank. I would like to see a solid system used that is both efficient and reliable.
Boreas
2010-09-22 10:06:43
From: Coh3n
Hmm I never really thought about an automatically updating DTM script. All we need this for it to recognize items in the inventory, equipment tab and bank. I would like to see a solid system used that is both efficient and reliable.
That would be great because it could have most of the same benefits as BlackLists, but be more familiar. I would have done that from the start instead of BLs, if DDTMs were around back then.
Here's some stuff I posted the other day
From: Jethr0x
Hey, Boreas, would you mind if I attempt and make something with your idea of creating dynamic dtms during runtime?
I wouldn't mind at all. Few things to keep in mind:
1) Use the Black_Outline constant for the black with a tol of 0
2) Don't look at entire TBox produced by InvBox, add about 15 to y1 to get around the numbers
3) Make the parent point with max tol at x1 y1 (adjusted as above)
4) Only search for the DDTM at that point, and just repeat the search 28 times (or whatever for bank). So it's not really searching, but rather checking if it is in each slot.
5) For color points you need to see what is inside the black outline so that you don't get the brown background.
6) You can either get a sample of color points in a standard pattern (checkerboard, net, etc) or look at other items with same black outline and just see what is different, for example don't bother with the handles of the pickaxes.
For more info see the old version of BlackLists I posted in tutorial island, or the new version by Nielsie posted somewhere (MSI maybe?).
I forgot that #4 is actually wrong. What you actually need to do, is apply the same auto generating algorithm to each slot, and go through and compare if the all the points are the same (first compare if the number of points are the same). This way, you don't actually use FindDTM, and you won't find an unstrung bow DDTM in a strung bow.
Also #3 isn't clear. Each point needs to have X1,Y1+15 subtracted from it. So the parent point will be 0,0. This way when you apply the algorithm in Slot1, you get the exact same numbers as Slot28.
Coh3n
2010-09-22 13:11:22
From: Boreas
Also #3 isn't clear. Each point needs to have X1,Y1+15 subtracted from it. So the parent point will be 0,0. This way when you apply the algorithm in Slot1, you get the exact same numbers as Slot28.
Wouldn't that "shift" the whole DDTM down 15 if it was applied to every point?
marpis
2010-09-22 13:49:34
Could FindDeformedBitmap be an option?
Boreas
2010-09-22 19:46:26
From: Coh3n
Wouldn't that "shift" the whole DDTM down 15 if it was applied to every point?
I mean if you're looking at slot X, which has X1Y1 of 200,300, and there is a black point at 207 319, the point in the DDTM is 7,4. You ignore the top part due to the numbers, so you are looking in a box starting at 200,315, and record everything relative to that. This way when you have the same item in a slot at 250,400, and there is a black point at 257,419, you subtract 250,415 and get 7,4 again.
I suppose you could make them all relative to the top of slot, and just not record anything in the top 15 to avoid the numbers. Either way is fine, as long as you take care of the relativity when making the DDTM, and not when searching for it, so that DDTMs of the same item generated in different spots will be the same.
Coh3n
2010-09-23 17:26:56
From: Boreas
I mean if you're looking at slot X, which has X1Y1 of 200,300, and there is a black point at 207 319, the point in the DDTM is 7,4. You ignore the top part due to the numbers, so you are looking in a box starting at 200,315, and record everything relative to that. This way when you have the same item in a slot at 250,400, and there is a black point at 257,419, you subtract 250,415 and get 7,4 again.
I suppose you could make them all relative to the top of slot, and just not record anything in the top 15 to avoid the numbers. Either way is fine, as long as you take care of the relativity when making the DDTM, and not when searching for it, so that DDTMs of the same item generated in different spots will be the same.
Oh okay, makes sense now. :)
Gu3st...
2011-01-28 11:58:37
From: Boreas
TBH I have no idea why SRL, MSI and all other scripts don't use your system by now. It's fast, auto updating, can create during runtime for a brand new item nobody has ever seen before, and can even do fire staff vs water staff.
Bump on this topic.
I say we start using it now.
Coh3n
2011-01-28 12:25:19
From: Zyt3x
Bump on this topic.
I say we start using it now.
Okay, we just need someone to actually do it. That would involve converting to Simba + implementing it into MSI. I have way too many other things to do, so someone else will have to take care of this one if we want it done anytime soon.
E: I'm assuming you're talking about Nielsie's system? If so, I have a version here if you can't find it on the forums.
Gu3st...
2011-01-28 12:31:32
From: Coh3n
Okay, we just need someone to actually do it. That would involve converting to Simba + implementing it into MSI. I have way too many other things to do, so someone else will have to take care of this one if we want it done anytime soon.
E: I'm assuming you're talking about Nielsie's system? If so, I have a version here if you can't find it on the forums.
I'll get on it :)
And yes, Nielsie's system. Thanks for the file ^^,
WT-Fakawi
2011-03-02 17:34:34
What's the status of the blacklist project? I am asking because for my current Ratz II project I wrote a primitive yet working system that does the same.
It has many wonders. You can indentify objects runtime and act accordingly.
The simplest example is a bone. I have specified in my script to pick up 'bone'. Once the bone appears the first time in my inventory, I "blacklist" the object runtime, I hoover the mouse to get the name, I grab the outline TPA, the Width and Height and a primitive folldfill colorTPA of the object.
From that moment on, I
know what a bone is. I can call it "Bone" in my script. Now this is something new for me, but extremely helpful. It is an eyeopener. I can now happily fish, cook, collect, cut, burn, simply by saying click Tinderbox - click Log until not find Log. And all runtime.
The possibilities are endless.
EDIT: I use in Ratz II this: if ClickAnyNamedInvObj('Burnt', False) then ChooseOption('Drop'); This will drop any Burnt runescape food. Any. I was shocked.
Cooking is easy too now. The Cook All button is decorated with… the object. Just click it and all is cooked.
I would really love to see a working system implemented in SRL. I know nielsie and boreas and recently MSI picked up on things, but a sort of standarisation seems in order. From my own experience I would propose a system that
- Keeps track of your inventory, using the existing core SRL procedures like InvBox etc. This Inventory(1..28): Array of TInventItem can maybe be part of a new core SRL object. It could even be implemented in the Player structure. (A separate array for armour will be handy too. Also in Player?)
- Keeps a reference library with objects, either generated or static. Lets begin with the basic ftp objects, logs, ores, bars, stuff like that.
The enduser will from that moment on be able to adress an object through it's
name. Not through a bitmap, not through a DTM. This is of great significance. A function GetInvObject will return its name (or a TInventItem), and GetInvObjects a string of names.
Stackable objects can be properly identified using masquerader's amount include that still works 100%. (GetInvObjectAmount?)
It is funny to realize we never implemented something like this in SRL's core while it so useful, yet the Inventory covers one third of the GUI!
So in short: I propose a system that allows endusers to adress an object through it's name.
From: WT-Fakawi
The enduser will from that moment on be able to adress an object through it's name. Not through a bitmap, not through a DTM. This is of great significance. A function GetInvObject will return its name (or a TInventItem), and GetInvObjects a string of names.
Only thing is SRL 5 has switched from string case's to Integer constants to use in the case's. This could be accommodated though.
Are you proposing something like a BlackList.Simba full of item records to use?
WT-Fakawi
2011-03-02 18:07:46
For starters yes. It might quickly become outdated, but it is a good start. And I'd call it Items.simba aot blacklist.simba, but thats all detail.
Most Items can be identified through their outline TPA and their width and height, though 10% has equal proportions. (From what I recall bones and ashes, but not sure anymore). So you need at least a couple of colors, and though they change a tolerance of 3 is sufficient.
I can identify most if not all of the Ratz II object with my predefined invbase of TInventItems, on top of the script. It has bones, logs, tinderbox, net, hatchet, runes, coins, all kinds of armour, magic, range, combat (bronze to adamant), all food, meat, chicken, shrimp, anchovies, raw, cooked and burnt, and all junk you can pick up from the Ratz-spot.
It is simple yet 100% efficient. Another example:
Function SwitchGear:Boolean;
var
combat, magic, range: Array of String;
t,i: Integer;
begin
WTSetFightMode;
combat := ['helm','power','dagger','sword','scimitar','shield','legs','platebody'];
range := ['Sling', 'leather body','cowl','chaps'];
magic := ['izard robe','izard hat','ue ski', 'Staff of air']
case Players[CurrentPlayer].Status of
'auto' : Begin
CleanupInventory;
if InvCount > 25 then Munch(5);
t := GetSystemTime;
While InvCount > 23 do
begin
if ClickAnyNamedInvObj('ogs', False) then ChooseOption('rop') else Break;
if GetSystemTime > T + 20000 Then Break;
end;
inc(GearSwitch);
for i := 1 to 11 do
begin
TakeOff(i);
end;
'magic': Begin
for i:= 0 to High(magic) do
ClickAnyNamedInvObj(magic[i], True);
FTWait(8);
Cast('wind rush', True);
FTWait(12);
if pos('spell',GetBlackchatMessage) <> 0 then Result := true;
End;
'range': for i:= 0 to High(range) do
ClickAnyNamedInvObj(range[i], True);
'combat': for i:= 0 to High(combat) do
ClickAnyNamedInvObj(combat[i], True);
end;
end;
You understand this. It switches armour between combat, range and magic. Simple and all
namebased.
Boreas
2011-03-02 18:11:57
Items should be stored in an INI (or another runtime updateable file). Nielsie's system can fill and update it on the fly. No more DTM and BMP databases.
Edit: TBH I no idea why Nielsie's system wasn't implemented as soon as he showed it handled fire staff vs water staff.
Coh3n
2011-03-02 19:24:03
From: Boreas
Edit: TBH I no idea why Nielsie's system wasn't implemented as soon as he showed it handled fire staff vs water staff.
I think now it just requires someone to convert it from SCAR to Simba.
Gu3st...
2011-05-04 07:06:13
So all that's needed is to convert it to Simba?
That's all work that we'd have to do to make this work?
Coh3n
2011-05-04 09:50:27
From: Zyt3x
So all that's needed is to convert it to Simba?
That's all work that we'd have to do to make this work?
Assuming it works when converted, yes.
WT-Fakawi
2011-05-04 10:14:25
Is it possible to put this in SRL as opposed to MSI? I think it belongs in SRL.
Coh3n
2011-05-04 10:15:54
From: WT-Fakawi
Is it possible to put this in SRL as opposed to MSI? I think it belongs in SRL.
Absolutely.
E: Updated the first post.
Gu3st...
2011-05-04 11:59:33
From: WT-Fakawi
Is it possible to put this in SRL as opposed to MSI? I think it belongs in SRL.
Most definitely :)
I tried my best converting it.. I'm not sure it if actually works though:
Coh3n
2011-11-05 03:54:03
From: Zyt3x
Most definitely :)
I tried my best converting it.. I'm not sure it if actually works though:
I'd love to get this working. DTMs can be a pain. :p
E: It seems to work, but I don't understand how it works or how you're supposed to use it to simply find an item.
E2: I'm not sure how well this idea would work anymore. If you've played RS lately, you've probably noticed that a lot of items get "cut-off" when you withdraw from the bank or chop a tree or mine a rock. Blacklists would probably fail because of this; however, assuming this is just a bug, we may be okay. We'll have to see.
nielsie95
2011-11-05 04:46:33
It can be made to work with cut off items, but it will not work with resizing items. Currently it works like this:
- You start off with a box in which you want to recognize the item. (GetItem)
- In this box, you find the bounds of the item.
- Using the bounds, width and height, you get all the possible items for that spot. (GetPossibleItems)
- Each blacklist item stores w/h/bounds and unique colours + their coords. If there is one possible match, you know the item.
- If there is more than one possible item, you compare each possible to the current item. Check if the bounds match and compare all the specific colours to the ones in the item and track the highest tolerance. From all the items that match bounds, you take the one with the least (max) colour difference.
- There might be possibilities with similar colours you want to compare (brown colour of the staff, for example). To avoid this colour having the max tolerance and still end up with multiple possibilities, there is the SkipSimilarItemColors directive. This directive makes sure only unique colours from the possible items are tested.
The box you want to test can easily be cut into half, currently it takes (x1, y2-17, x2, y2) to compensate for item stacks. But if items resize, the bounds will not match and the points of the specific colours will be off. For this to work best, it's good if all (similar) blacklists originate from the same colour palette. The list in the script above was generated from the GE site.
Coh3n
2011-11-05 04:51:57
That's interesting, it may just work. We could just add a few pixels to the x1 box and we're off to the races. Also, the item resizing has been fixed as I guess it was just a bug in the game.
Flight
2011-11-05 04:58:19
Could someone post a little bit of info on what blacklists are? From what I've read all they do is count the number of black points within a box and if they exist at specific points. If this really is the case, I wouldn't suggest it for item-finding. Correct me if I'm wrong, but let's say you want to tell the difference between a raw and cooked fish. They share the same black border points at the same coordinates, so how would the script know the difference between the two?
I really think I'm missing the general concept of blacklists, so maybe someone could fill me in.
Coh3n
2011-11-05 05:01:15
From: Flight
Could someone post a little bit of info on what blacklists are? From what I've read all they do is count the number of black points within a box and if they exist at specific points. If this really is the case, I wouldn't suggest it for item-finding. Correct me if I'm wrong, but let's say you want to tell the difference between a raw and cooked fish. They share the same black border points at the same coordinates, so how would the script know the difference between the two?
I really think I'm missing the general concept of blacklists, so maybe someone could fill me in.
Your understanding is the very basic form that works well in certain situations. nielsie (I think) wrote a system that can tell any item apart. His previous post will probably help you a little.
Kyle Undefined
2011-11-09 07:18:49
Ok, so I've been studying Blacklists for awhile now and I believe I understand them. They seem a lot better than DTM's, which is good.
If we are still moving forward with this, I've created a tool that should help. I got a few things from the script that was posted earlier and just added to it. It prints out some data that probably isn't needed, but it doesn't hurt to see.
If you're using the bank, make sure the BankScreen is open. You don't have to worry about blank spaces in your bank or inventory.
I know it needs some tweaks done, but I'm too tired at the moment to perfect it to my satisfaction. Let me know what you think, and what should be changed/added/removed.
Here is an example of the output:
||================================================================||
|| Items ||
||================================================================||
TZHAAR_KET_OM:
with MSI_Items[whichItem] do
begin
Name := 'Tzhaar-ket-om';
UpText := ['haar-ket'];
Stackable := False;
EquipLevel := -1;
BorderCount := 74;
RGBToColorCount := 3722886;
Color := 3290685;
Tol := 34;
Hue := 2.61764705882352;
Sat := 2.46539792387543;
end;
DRAGON_2H_SWORD:
with MSI_Items[whichItem] do
begin
Name := 'Dragon 2h sword';
UpText := ['gon 2h s'];
Stackable := False;
EquipLevel := 60;
BorderCount := 79;
RGBToColorCount := 3266259;
Color := 3296877;
Tol := 58;
Hue := 3.84482758620689;
Sat := 2.47745358090185;
end;
DRAGON_LONGSWORD:
with MSI_Items[whichItem] do
begin
Name := 'Dragon longsword';
UpText := ['agon longsw'];
Stackable := False;
EquipLevel := 60;
BorderCount := 83;
RGBToColorCount := 3593256;
Color := 3361651;
Tol := 58;
Hue := 3.86206896551724;
Sat := 2.54006799417192;
end;
RUNE_SCIMITAR:
with MSI_Items[whichItem] do
begin
Name := 'Rune scimitar';
UpText := ['ne scimi'];
Stackable := False;
EquipLevel := 40;
BorderCount := 82;
RGBToColorCount := 3593854;
Color := 4546624;
Tol := 71;
Hue := 2.53521126760563;
Sat := 2.57471659223634;
end;
1RON_BAR:
with MSI_Items[whichItem] do
begin
Name := '1ron bar';
UpText := ['ron b'];
Stackable := False;
EquipLevel := -1;
BorderCount := 66;
RGBToColorCount := 3020934;
Color := 2897470;
Tol := 33;
Hue := 2.63636363636363;
Sat := 2.4736405147364;
end;
LEATHER:
with MSI_Items[whichItem] do
begin
Name := 'Leather';
UpText := ['eath'];
Stackable := False;
EquipLevel := -1;
BorderCount := 80;
RGBToColorCount := 3022041;
Color := 1785154;
Tol := 26;
Hue := 2.8076923076923;
Sat := 2.10355029585798;
end;
RUNE_PICKAXE:
with MSI_Items[whichItem] do
begin
Name := 'Rune pickaxe';
UpText := ['ne pick'];
Stackable := False;
EquipLevel := 41;
BorderCount := 97;
RGBToColorCount := 2367011;
Color := 3298612;
Tol := 64;
Hue := 2.1875;
Sat := 2.52119252873563;
end;
SHEARS:
with MSI_Items[whichItem] do
begin
Name := 'Shears';
UpText := ['hea'];
Stackable := False;
EquipLevel := -1;
BorderCount := 82;
RGBToColorCount := 4463225;
Color := 2504011;
Tol := 43;
Hue := 2.60465116279069;
Sat := 2.45203488372093;
end;
HAMMER:
with MSI_Items[whichItem] do
begin
Name := 'Hammer';
UpText := ['amm'];
Stackable := False;
EquipLevel := -1;
BorderCount := 72;
RGBToColorCount := 2450557;
Color := 2634821;
Tol := 34;
Hue := 2.61764705882352;
Sat := 2.46539792387543;
end;
CHISEL:
with MSI_Items[whichItem] do
begin
Name := 'Chisel';
UpText := ['his'];
Stackable := False;
EquipLevel := -1;
BorderCount := 59;
RGBToColorCount := 2515669;
Color := 1781572;
Tol := 30;
Hue := 3.1;
Sat := 2.41458333333333;
end;
COAL:
with MSI_Items[whichItem] do
begin
Name := 'Coal';
UpText := ['Coal'];
Stackable := False;
EquipLevel := -1;
BorderCount := 178;
RGBToColorCount := 6841389;
Color := 2636354;
Tol := 33;
Hue := 3.21212121212121;
Sat := 2.20844811753902;
end;
MITHRIL_ORE:
with MSI_Items[whichItem] do
begin
Name := 'Mithril ore';
UpText := ['thril'];
Stackable := False;
EquipLevel := -1;
BorderCount := 178;
RGBToColorCount := 6841473;
Color := 2836528;
Tol := 33;
Hue := 3.21212121212121;
Sat := 2.09728867623604;
end;
KNIFE:
with MSI_Items[whichItem] do
begin
Name := 'Knife';
UpText := ['Knife'];
Stackable := False;
EquipLevel := -1;
BorderCount := 63;
RGBToColorCount := 2469501;
Color := 5593964;
Tol := 58;
Hue := 2.60344827586206;
Sat := 2.46787320625401;
end;
YEW_LOGS:
with MSI_Items[whichItem] do
begin
Name := 'Yew logs';
UpText := ['ew lo'];
Stackable := False;
EquipLevel := -1;
BorderCount := 83;
RGBToColorCount := 3517146;
Color := 1325385;
Tol := 33;
Hue := 3.51515151515151;
Sat := 2.44522144522144;
end;
WILLOW_LOGS:
with MSI_Items[whichItem] do
begin
Name := 'Willow logs';
UpText := ['llow '];
Stackable := False;
EquipLevel := -1;
BorderCount := 83;
RGBToColorCount := 3516974;
Color := 2113091;
Tol := 31;
Hue := 3;
Sat := 2.32937181663837;
end;
BIRDS_NEST:
with MSI_Items[whichItem] do
begin
Name := 'Birds nest';
UpText := ['rd''''s '];
Stackable := False;
EquipLevel := -1;
BorderCount := 74;
RGBToColorCount := 4366976;
Color := 2700086;
Tol := 27;
Hue := 2.7037037037037;
Sat := 2.36396890717878;
end;
Successfully executed.
Swatarianess
2011-11-09 07:45:21
From: Camo Developer
Ok, so I've been studying Blacklists for awhile now and I believe I understand them. They seem a lot better than DTM's, which is good.
If we are still moving forward with this, I've created a tool that should help. I got a few things from the script that was posted earlier and just added to it. It prints out some data that probably isn't needed, but it doesn't hurt to see.
If you're using the bank, make sure the BankScreen is open. You don't have to worry about blank spaces in your bank or inventory.
I know it needs some tweaks done, but I'm too tired at the moment to perfect it to my satisfaction. Let me know what you think, and what should be changed/added/removed.
Here is an example of the output:
||================================================================||
|| Items ||
||================================================================||
TZHAAR_KET_OM:
with MSI_Items[whichItem] do
begin
Name := 'Tzhaar-ket-om';
UpText := ['haar-ket'];
Stackable := False;
EquipLevel := -1;
BorderCount := 74;
RGBToColorCount := 3722886;
Color := 3290685;
Tol := 34;
Hue := 2.61764705882352;
Sat := 2.46539792387543;
end;
DRAGON_2H_SWORD:
with MSI_Items[whichItem] do
begin
Name := 'Dragon 2h sword';
UpText := ['gon 2h s'];
Stackable := False;
EquipLevel := 60;
BorderCount := 79;
RGBToColorCount := 3266259;
Color := 3296877;
Tol := 58;
Hue := 3.84482758620689;
Sat := 2.47745358090185;
end;
DRAGON_LONGSWORD:
with MSI_Items[whichItem] do
begin
Name := 'Dragon longsword';
UpText := ['agon longsw'];
Stackable := False;
EquipLevel := 60;
BorderCount := 83;
RGBToColorCount := 3593256;
Color := 3361651;
Tol := 58;
Hue := 3.86206896551724;
Sat := 2.54006799417192;
end;
RUNE_SCIMITAR:
with MSI_Items[whichItem] do
begin
Name := 'Rune scimitar';
UpText := ['ne scimi'];
Stackable := False;
EquipLevel := 40;
BorderCount := 82;
RGBToColorCount := 3593854;
Color := 4546624;
Tol := 71;
Hue := 2.53521126760563;
Sat := 2.57471659223634;
end;
1RON_BAR:
with MSI_Items[whichItem] do
begin
Name := '1ron bar';
UpText := ['ron b'];
Stackable := False;
EquipLevel := -1;
BorderCount := 66;
RGBToColorCount := 3020934;
Color := 2897470;
Tol := 33;
Hue := 2.63636363636363;
Sat := 2.4736405147364;
end;
LEATHER:
with MSI_Items[whichItem] do
begin
Name := 'Leather';
UpText := ['eath'];
Stackable := False;
EquipLevel := -1;
BorderCount := 80;
RGBToColorCount := 3022041;
Color := 1785154;
Tol := 26;
Hue := 2.8076923076923;
Sat := 2.10355029585798;
end;
RUNE_PICKAXE:
with MSI_Items[whichItem] do
begin
Name := 'Rune pickaxe';
UpText := ['ne pick'];
Stackable := False;
EquipLevel := 41;
BorderCount := 97;
RGBToColorCount := 2367011;
Color := 3298612;
Tol := 64;
Hue := 2.1875;
Sat := 2.52119252873563;
end;
SHEARS:
with MSI_Items[whichItem] do
begin
Name := 'Shears';
UpText := ['hea'];
Stackable := False;
EquipLevel := -1;
BorderCount := 82;
RGBToColorCount := 4463225;
Color := 2504011;
Tol := 43;
Hue := 2.60465116279069;
Sat := 2.45203488372093;
end;
HAMMER:
with MSI_Items[whichItem] do
begin
Name := 'Hammer';
UpText := ['amm'];
Stackable := False;
EquipLevel := -1;
BorderCount := 72;
RGBToColorCount := 2450557;
Color := 2634821;
Tol := 34;
Hue := 2.61764705882352;
Sat := 2.46539792387543;
end;
CHISEL:
with MSI_Items[whichItem] do
begin
Name := 'Chisel';
UpText := ['his'];
Stackable := False;
EquipLevel := -1;
BorderCount := 59;
RGBToColorCount := 2515669;
Color := 1781572;
Tol := 30;
Hue := 3.1;
Sat := 2.41458333333333;
end;
COAL:
with MSI_Items[whichItem] do
begin
Name := 'Coal';
UpText := ['Coal'];
Stackable := False;
EquipLevel := -1;
BorderCount := 178;
RGBToColorCount := 6841389;
Color := 2636354;
Tol := 33;
Hue := 3.21212121212121;
Sat := 2.20844811753902;
end;
MITHRIL_ORE:
with MSI_Items[whichItem] do
begin
Name := 'Mithril ore';
UpText := ['thril'];
Stackable := False;
EquipLevel := -1;
BorderCount := 178;
RGBToColorCount := 6841473;
Color := 2836528;
Tol := 33;
Hue := 3.21212121212121;
Sat := 2.09728867623604;
end;
KNIFE:
with MSI_Items[whichItem] do
begin
Name := 'Knife';
UpText := ['Knife'];
Stackable := False;
EquipLevel := -1;
BorderCount := 63;
RGBToColorCount := 2469501;
Color := 5593964;
Tol := 58;
Hue := 2.60344827586206;
Sat := 2.46787320625401;
end;
YEW_LOGS:
with MSI_Items[whichItem] do
begin
Name := 'Yew logs';
UpText := ['ew lo'];
Stackable := False;
EquipLevel := -1;
BorderCount := 83;
RGBToColorCount := 3517146;
Color := 1325385;
Tol := 33;
Hue := 3.51515151515151;
Sat := 2.44522144522144;
end;
WILLOW_LOGS:
with MSI_Items[whichItem] do
begin
Name := 'Willow logs';
UpText := ['llow '];
Stackable := False;
EquipLevel := -1;
BorderCount := 83;
RGBToColorCount := 3516974;
Color := 2113091;
Tol := 31;
Hue := 3;
Sat := 2.32937181663837;
end;
BIRDS_NEST:
with MSI_Items[whichItem] do
begin
Name := 'Birds nest';
UpText := ['rd''''s '];
Stackable := False;
EquipLevel := -1;
BorderCount := 74;
RGBToColorCount := 4366976;
Color := 2700086;
Tol := 27;
Hue := 2.7037037037037;
Sat := 2.36396890717878;
end;
Successfully executed.
Nice tool gonna test it out for few items :D
edit: It just shows the Item header then nothing else :/
Kyle Undefined
2011-11-09 09:21:26
Did you select RS as the client? Also, did you use Bank or Inventory?
Coh3n
2011-11-09 11:40:29
That looks nice, Camo. Did you write your own, or is that from the system Nielsie wrote?
Kyle Undefined
2011-11-09 11:46:35
The GetBankScrollPos(), SetBankScrollPos(), and BankBox() is from Nielsie's system. Everything else I wrote.
Coh3n
2011-11-09 11:56:18
From: Camo Developer
The GetBankScrollPos(), SetBankScrollPos(), and BankBox() is from Nielsie's system. Everything else I wrote.
I don't have time to look through it now, but does yours compensate for the amount of the item? IIRC, nielsie's cut off part of the top of the item so it would work in the bank and inventory.
Kyle Undefined
2011-11-09 12:02:01
From: Coh3n
I don't have time to look through it now, but does yours compensate for the amount of the item? IIRC, nielsie's cut off part of the top of the item so it would work in the bank and inventory.
Yes, it drops the TPA by 17 so it cuts off the numbers. I saw Nielsie's post about that so I incorporated it.
Coh3n
2011-11-09 12:03:18
From: Camo Developer
Yes, it drops the TPA by 17 so it cuts off the numbers. I saw Nielsie's post about that so I incorporated it.
That's cool, I'll have to take a look at it later. :) Need some more sleep now.
E: Couple things from the output:
1RON_BAR:
I'm guessing that's a OCR error. Also the constants don't match MSI's constants so we'd have to figure something out about that.
Kyle Undefined
2011-11-09 12:10:10
Yeah, I saw that.
The constant name that I'm using is just the item name, simplified and uppercase'd.
Bixby Sayz
2011-11-09 12:21:42
From: bro433
It just shows the Item header then nothing else :/
Yeah I get the same thing for both inventory and bank, after having made sure client was selected.
Swatarianess
2011-11-09 12:35:39
From: Camo Developer
Did you select RS as the client? Also, did you use Bank or Inventory?
used invent then bank :/ i'll try it again
Kyle Undefined
2011-11-09 13:07:49
Hmm, I'll give it a look, hold on. I tested this forever, I don't know why it's not working…
nielsie95
2011-11-09 13:22:49
Have you tried using the image from zybez/wikia? I used the images from the online GE and that worked too :)
Also, I'm not sure what CreateAutoColorInfo does, but if you're going to use a single color to identify an item, you might as well use DTM's. The way you have it now can easily create DTM's too :)
Kyle Undefined
2011-11-09 13:35:42
From: nielsie95
Have you tried using the image from zybez/wikia? I used the images from the online GE and that worked too :)
Also, I'm not sure what CreateAutoColorInfo does, but if you're going to use a single color to identify an item, you might as well use DTM's. The way you have it now can easily create DTM's too :)
Hmm, didn't think of that. That way I can scan all items and make a list at once…
That function is actually pretty neat. I'm taking the TBox points where the item is, searching for colors, deleting the duplicates, and passing the colors into the CreateAutoColorInfo function. It then gets the best color, tolerance, sat, hue. So it's basically AutoColor on the fly from what I understand from it.
I tested the colors by opening up the ACA program that you wrote and plugging in those values, and it found the right item.
I'm using Wikia to see if the item is stackable, and Zybez to get the required level to equip if it can be.
I'm in the middle of something else right now, but I'll definitely try to upgrade/improve it. How did you use the online GE for images?
Also, any luck getting it to work? Are you filling in the form that pops up?
nielsie95
2011-11-09 13:43:54
I was talking about using the GE images to generate blacklists for my script. The reason why I used multiple colours + their offsets was that using a colour to check if in item is there, might still give false positives (mithril/rune axe for example). Plus, it would mean that you're basically doing a DTM search. That's why I tried to identify the items, rather than searching for it (picking the blacklist with the least tolerance).
Kyle Undefined
2011-11-09 19:58:10
Why wouldn't you just get a list of objects that have the same black pixel count, then narrow it down to the specific object using the autocolor? Unless I'm just missing the point completely, which is possible :P
nielsie95
2011-11-10 17:22:38
No, that's what I meant :p
It's just that you might still confuse two items if you use one colour. Perhaps your approach doesn't have this (with the ACA like approach), though :)
Kyle Undefined
2011-11-10 22:30:46
Lol oh ok. I get what you mean now, that's the reason why I did the AC way so hopefully it keeps the array down :)
Sir R. M8gic1an
2011-12-19 09:19:39
Im just not really sure why you do this:
"RGBToColorCount := (RGBtoColor((TPABounds.X1 + TPABounds.X2) + 1, (TPABounds.Y1 + TPABounds.Y2) + 1, Length(TPA))) + ';'); "
Cus what I read from this is the following:
The value of pixel at .X1 + .X2 + 1 IS the Red value of COLOR
The value of pixel at .Y1 + .Y2 + 1 IS the Green value of Color
the length of the TPA is the Blue value of Color
Now, to me that seems like a logical flaw, except if you figured out that is actually a working algorithm…. but that may be why people weren't finding the items? And I think the algorithm might not actually work, cus the points X1+X2+1 and Y1 + Y2 + 1 are actually outside the object, so they will (theoretically) be the same for every item, the only change there being the length.
If you want to go foolproof about it, I suggest that you sum up the RGBs (separately) of all the pixels in your colours array (including duplicates as that is what will really tell the similarity in item) ;)
-RM
Kyle Undefined
2011-12-19 10:00:10
From: Sir R. M8gic1an
Im just not really sure why you do this:
"RGBToColorCount := (RGBtoColor((TPABounds.X1 + TPABounds.X2) + 1, (TPABounds.Y1 + TPABounds.Y2) + 1, Length(TPA))) + ';'); "
Cus what I read from this is the following:
The value of pixel at .X1 + .X2 + 1 IS the Red value of COLOR
The value of pixel at .Y1 + .Y2 + 1 IS the Green value of Color
the length of the TPA is the Blue value of Color
Now, to me that seems like a logical flaw, except if you figured out that is actually a working algorithm…. but that may be why people weren't finding the items? And I think the algorithm might not actually work, cus the points X1+X2+1 and Y1 + Y2 + 1 are actually outside the object, so they will (theoretically) be the same for every item, the only change there being the length.
If you want to go foolproof about it, I suggest that you sum up the RGBs (separately) of all the pixels in your colours array (including duplicates as that is what will really tell the similarity in item) ;)
-RM
I'll have to wrap my head back around this, but I understand what you're saying. Thanks for the feedback! :)
m34tcode
2011-12-19 10:59:08
This is a good idea, but we need a colored pixel or two in every item. If jagex adds a new item or changes one so that 2 have the same black pixel counts, then the resulting confusion in scripts could lead to bans.
Maybe create a new TItem type?
possibly containing an int, and 2 pixels for checking, an ID, and name(uptext)
Kyle Undefined
2011-12-19 16:30:06
From: m34tcode
This is a good idea, but we need a colored pixel or two in every item. If jagex adds a new item or changes one so that 2 have the same black pixel counts, then the resulting confusion in scripts could lead to bans.
Maybe create a new TItem type?
possibly containing an int, and 2 pixels for checking, an ID, and name(uptext)
Yeah, you'd always want to have colors that go with the blacklist. Especially for items like hachets, pickaxes, etc.
m34tcode
2011-12-19 17:30:00
So, with that in mind, it would be nice to have a library of items. We can make a reflection script that generates the items, or they can be created dynamically during runtime.
If they are created dynamically then we don't even need to make a library
Kyle Undefined
2011-12-19 17:32:03
Keeping the library contained to the players computer is the best way to go, to be honest. You would still create a database of the items, but only ones that are needed in a script.
m34tcode
2011-12-19 17:33:29
Exactly. So when Reflection finds an item in the inventory, it can add it to an array of items