Results 1 to 10 of 10

Thread: item database

  1. #1
    Join Date
    Oct 2016
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default item database + HieroLib

    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.
    Attached Files Attached Files
    Last edited by Hierophant; 10-27-2016 at 11:51 PM. Reason: Way more information

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Nice! I did something very similar back when Darkscape was still alive. I used the outlineCount, height, width, item text, and a CTS2 color to look for. All of this was automatically retrieved and stored as text to be looked up later. I never got around to having the script automatically withdraw unknown items from the bank, but it was still pretty easy to do that manually.

    Unless you can automate the creation of the DTM, I think it would be worth dropping it altogether and just using step 3.
    Last edited by Citrus; 10-25-2016 at 05:28 PM.

  3. #3
    Join Date
    Oct 2016
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Unless you can automate the creation of the DTM...
    This is something that I'd actually really like to do, but I haven't figured out how simba converts the points in a DTM to a string yet.
    It would have helped if I had read the documentation first. Thanks for the suggestion, I'll be implementing it.
    Last edited by Hierophant; 10-25-2016 at 05:57 PM.

  4. #4
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

  5. #5
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

  6. #6
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Also similar to a script @WT-Fakawi; did a while back that auto updated colors and stuff in your inventory

  7. #7
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    There was talk of doing something like this ~2 years ago. I think it was going to use bitmaps, hosted online (or cached locally), as opposed to dtms.

    It never got going, simply because it was such a huge undertaking, even if we were able to find all the item bitmaps online. (maybe they were hosted on rs through the GE?)

  8. #8
    Join Date
    Oct 2016
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    There was talk of doing something like this ~2 years ago. I think it was going to use bitmaps, hosted online (or cached locally), as opposed to dtms.

    It never got going, simply because it was such a huge undertaking, even if we were able to find all the item bitmaps online. (maybe they were hosted on rs through the GE?)
    I intend to host this locally from my home connection, so I chose DTM instead of bitmap because a DTM is less characters than a bitmap (generally).
    This won't have literally *every* item, but it will have most items that are easily obtainable or grand exchange buyable. The only reason I have for not releasing my item updating script is I don't want to risk a SQL injection attack.

  9. #9
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    I've done something similar to this on OSRS: https://github.com/Olly-/ItemFinder

  10. #10
    Join Date
    Oct 2016
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Just a quick update:
    Automatic DTM creation works!
    I've made script that loops through each inventory box and creates a DTM of the item, if the item is not already in the database. The DTM is then compared to all of the other items in the inventory and points are added to the DTM if a false positive occurs.
    I'll post everything that's needed to access the database tomorrow, I just have a few finishing touches to add. For now, here's a .gif of the DTM creator in action.
    https://media.giphy.com/media/3o7TKs...oi8U/giphy.gif
    White outline = not the item
    Green outline = the item
    Red outline = false positive

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •