Jump to content
Wanted

Introduction of the Item_Data_Base

Recommended Posts

https://github.com/OSI1/OSI1/commit/d6ade21b1c85e9108f19d273b4681f6511fd3fc8

 

From now on, if you go to your OSI\RS2\Skill\Item_Data_Base\*Skillname*\ folder you will find dtm and bmp (well mainly dtm files, since bmp are re-constructable) of widely used items in that skill.

 

To use these items you will need to go to OSI\RS2\Skill\*Skillname*.scar and look at the item indexes and use the Load*Skillname*Item function

 

Example:

 

Runecrafting.scar

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
const Item data database index
Contributors: Wanted
Description: Indexes of all the runecrafting related database items.
Date Created: November 9th, 2011. By Wanted. RS2 Build 677.
Last Modification: November 9th, 2011. By Wanted. RS2 Build 677.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

const                            // Modified            By              Build #
 dtmPouch_Small = 0;            // November 9, 2011    Wanted          677
 dtmPouch_Medium = 1;           // November 9, 2011    Wanted          677
 dtmPouch_Large = 2;            // November 9, 2011    Wanted          677
 dtmPouch_Giant = 3;            // November 9, 2011    Wanted          677
 bmpPouch_Small_Damaged = 4;
 bmpPouch_Medium_Damaged = 5;
 bmpPouch_Large_Damaged = 6;    // November 9, 2011    Wanted          677
 bmpPouch_Giant_Damaged = 7;

 

{$DEFINE RS2}
{$DEFINE OSI_Color_Anti_Randoms}
//{$DEFINE SMART}                   // Comment out to disable SMART

{.include OSI\OSI.scar}
{.include OSI\RS2\Skill\Runecrafting.scar}

procedure ScriptTerminate;
begin
 FreeOSI;
end;

procedure Whatever;
var
 dtmSmallPouch, Tol: Integer;
 P: TPoint;
begin
 dtmSmallPouch := LoadRunecraftingItem(dtmPouch_Small, Tol);
 FindDTM(dtmSmallPouch, P.X, P.Y, MIX1, MIY1, MIX2, MIY2);
 FreeDTM(dtmSmallPouch);
end;

begin
 SetUpOSI;
end.

Link to comment
Share on other sites

I have working dtms (but not bmp) for all the ores and bars if they are of any use to you. They take into account the "item clipping" that sometimes happens on the corners of items.

 

God I love this idea. This is one of the most painful parts of scripting: coming up with consistently working dtms.

 

They might be if you still have the .dtm files , bmp should be useful. ( Don't forget you can also make dtms that work for any item of the same shape (255 tol with the right color in the center point, though it may be useful to have dtms that can read what type of item that item shape is).

 

You can always make pull requests on github :-P

Link to comment
Share on other sites

I always save my dtms. Good idea on 255 tolerance. Useful for a lot of situations. When withdrawing though you want to find the exact bar you are looking for (say withdrawing steel bars for cannonballs and have other bars in inventory).

 

I'll have to have a look at your already done bitmaps before making some off mine.

 

Edit: Just had a closer look. You appear to be using all dtms except for one bitmap? On my way out the door; have to have a closer look when I get back. You have debated the pros and cons of LoadItem vs having LoadRunecraftingItem, LoadMiningItem I assume. I see you went with the latter.

Edited by Bixby Sayz
Link to comment
Share on other sites

I always save my dtms. Good idea on 255 tolerance. Useful for a lot of situations. When withdrawing though you want to find the exact bar you are looking for (say withdrawing steel bars for cannonballs and have other bars in inventory).

 

I'll have to have a look at your already done bitmaps before making some off mine.

 

Edit: Just had a closer look. You appear to be using all dtms except for one bitmap? On my way out the door; have to have a closer look when I get back. You have debated the pros and cons of LoadItem vs having LoadRunecraftingItem, LoadMiningItem I assume. I see you went with the latter.

 

Yep, its very useful to have both kinds.

 

There are scenarios where bitmaps are more practical and accurate to use. For example, different ores have a clear large different area of colors that is easy to use for main point.

 

But if I were to need something like the difference between Large Pouch and a dark Large Damaged pouch and bitmap would probably work better. The same could be said for rune essences. However, magic runes have different colors.

 

Also, one of the major things about SRL I never liked was the forced use of so many resources. Hence why OSI uses the resources you need it for, whether its RS2 or something else.

 

If you are working with a particular skill you can choose to use premade OSI functions and data inherent to just that skill, instead of being forced to use tons of extra unneeded and probably unmaintained resources.

Link to comment
Share on other sites

I agree with the not loading anything more than you have too. But I was thinking of the potential duplication when items cross skills and potential for code to get out of sync if maintaining duplicate code in two ares. For example ores are the output of mining, but are also used in smithing. Do you keep the same dtms in both skill files?

 

Just thinking off the top of my head without considering the ramifications: would it be better to have the items themselves in a separate monster list, still have the routines in the skill files, but they just load from the master list, rather than keep the definitions there. Not sure I explained that well.

Link to comment
Share on other sites

I agree with the not loading anything more than you have too. But I was thinking of the potential duplication when items cross skills and potential for code to get out of sync if maintaining duplicate code in two ares. For example ores are the output of mining, but are also used in smithing. Do you keep the same dtms in both skill files?

 

Just thinking off the top of my head without considering the ramifications: would it be better to have the items themselves in a separate monster list, still have the routines in the skill files, but they just load from the master list, rather than keep the definitions there. Not sure I explained that well.

 

Interesting point.

 

Though I think we'll be fine having duplicates if necessary. There shouldn't be too many instances of this. Smithing/ mining. Smithing/ combat. Firemaking/woodcutting, fletching/ranging, runecrafting, and magic. That's about it.

Edited by Wanted
Link to comment
Share on other sites

Yeah, more that I think about it why complicate more than necessary.

 

On a side note by the time I finish writing my Falador smelter (few more days i hope) I'll have enough to populate a fully functional feature complete smelting portion of the smithing skill. Actually no: it won't initially have using molds to create items (gold/silver jewelery, tiaras, etc) although it will relatively easy to add.

Link to comment
Share on other sites

It's me again Margaret!

 

Been running into issues with the original ore/bar dtms I gave you: the tolerances are too strict.

 

They work when you first login 95ish percent of the time. As time progresses and the colors shift ingame they start to fail. The longer you play in one session the worse it gets. The inventory seems to change the most. Ores seem to shift more than the bars oddly enough, with Coal being the worst offender.

 

Spend a day redoing the dtms for the ores and bars and testing them to ensure they work while still uniquely identifying. Affects mining.scar and smithing.scar.

 

Edit: Crap, double post.

Link to comment
Share on other sites

I'll commit these with OSI updates soon. I'm worried dtms may become nonviable because jagex is fucking with item shapes (at least with rune essence and other random objects that aren't tools like ores, essence, but not pickaxes) not sure what to think

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...