Introduction
I've always been obsessed with data gathering, so it only made sense to me to make a database for stuff that pertains to RuneScape. So, I present: HieroLib.
Requirements
- ezForm, found here.
- proSocks32.dll, found here.
To Install:
1) Extract HieroLib to your includes folder
2) Use the line {$I HieroLib/HieroLib.simba} in your code.
Features:
- TInvObjects
- TMsObjects
- Databases
TInvObjects:
What it is: A TInvObject is a custom record that I've made that represents an item that can be found within the inventory of a player.
Simba Code:
type TInvObject = record
name: string; //the name of the object
mainText: TStringArray; //text when left-clicking the object, (LIGHT logs, BURY bones, etc)
DTM, noteDTM: integer; //the DTM associated with the object. for now, this is called and freed at beginning and end
//of the script. this may be changed if it causes a memory issue
//noted dtm in stackable items is the same as normal dtm
h, w: integer; //height and width of the item
outlineCount: integer; //number of pixels of the black outline. NOTE: stackable items may have different outline counts
convexity: extended; //convexity of the outline of the points
family: string; //the family of items it is (ores, logs, herbs, etc.)
//note: the "family" parameter is just experimental for now.
//later, this will be used for the guessing of items in the inventory
stacks, stacksInBank: boolean; //whether or not the item stacks
//note: an item that does not stack in the bank will not
//stack in the inventory.
tradeable: boolean; //whether or not the item is tradeable
value: integer; //the grand exchange medium price
highAlchValue, lowAlchValue: integer; //high and low alchemy values
msVer: TMsObject; //the mainscreen representation of it (for drop looting)
//these pieces of information are derived at runtime, to allow for faster searching
invSlots, BankSlots: TIntegerArray; //slots in the inventory or bank that this item is found in
actionBarSlot: integer; //slot in the actionbar the item is on
bankTab: integer; //tab in the bank it was found in
//TODO: upon item fetch, add default tab to bankTab
end;
Some examples of what you can do with it:
- get how many of a certain item you currently have (TInvObject.count)
- drop a certain amount of them (TInvObject.drop)
- wait until you obtain another one of them (TInvObject.waitAmountChange)
- drop all items like it, e.g. drop all potions or drop all cooked fish (TInvObject.dropFamily)
TMsObjects:
What it is: A TMsObject is also a custom record that represents an object that can be found on the main screen of runescape, whether it be a tree, an NPC, a bank chest, or a rock.
Simba Code:
type TMsObject = record
name: string; //the name of the object
upText: TStringArray; //upText when left-clicking the object
col, tol, col2, tol2: integer; //color and tolerance of the object
cs, cs2: TColorSettings; //colorsettings of col and col2
col2Exists: boolean; //does color 2 even exist?
maxTPALength, minTPALength: integer; //max and min amounts of the col1 and col2 that occur
maxHeight, maxWidth, minHeight, minWidth: integer; //maximum and minimum dimensions of the object
maxDensity, minDensity: extended; //maximum and minimum densities of the TPointArray
clusterSize: integer; //the cluster size to use when finding the object
animThresh: integer; //the minimum amount of pixels that must be animating for the object to be valid
//used only in .findAnimating and .findAnimatingAll
//these two are the only pieces of information that are derived at runtime
points: TPointArray; //the points that define the region of the MsObject
center: TPoint; //the middle of the MsObject
end;
Some examples of what you can do with it:
- Find it and click it! For example, if your record for a tree is all set up, all you have to do is call tree.click() and it will click the tree closest to you.
- Find one object based the location of another.
- Find the object only if it's animating (like a portal)
- Find an object inside of another object
Databases:
For me, this is the best part about HieroLib. I will be maintaining a list of items and mainscreen objects and hosting it on my own server. Loading an object from the database is as simple as this:
Simba Code:
var
OakLogs: TInvObject;
OakTree: TMsObject;
begin
OakLogs.load('oak logs');
OakTree.load('oak tree');
end;
As of right now, the database is pretty bare because I've just created it. As HieroLib grows, and as I write more scripts, its size will increase. For now, I won't be allowing anyone else to write to the database, but that will most likely change.
If you would like to access the database directly to view what is in it currently, the link is my IP address (found within the includes) + /phpmyadmin, with the username being "SRL_Public" and the password being my username, in all lowercase.
Credits
Credits to @Brandon for writing proSocks32 and a message-sending function, which I included in this library.
Credits to @The Mayor for his post that details how to detect the shape of a TPA using a convex hull, which I have implemented in my TInvObject finding functions.
Conclusion:
Thank you all for taking the time to read this. I hope that HieroLib can grow to be great for everyone that uses it.
Any feedback or suggestions that you may have is greatly appreciated.