Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • RSBuddy/OSBuddy Exchange Price Lookup


    Vlad

    Recommended Posts

    If you're going to use this, don't call it every time you need a price. Store the prices in a map. I use something like this

    HashMap<String, Integer> priceMap = new HashMap<>();
    priceMap.put(item.getName(), PriceLookup.getPrice(item.getID()); //For each item. Do this only once.
    

    Then you can access your items prices with

    priceMap.get(item.getName());
    

    This may not be the best way of doing it, so if someone else has a better way please share. However, this will give you an access time of O(1) so it's pretty quick. May be able to use a smaller data structure so if you have a better way, show us ;)

    Thanks for the info, but if i want to dump all the items i need to make use of that method like 10.000 times.. I've been looking to do multiple items in one go for ages, but haven't really found an answer.. However, with a map you can dump all the items at once since it's an arraylist (right?), but making the map using your method requires me to put in all the item id's by hand and that for 10000 items XD?

    Link to comment
    Share on other sites

    Thanks for the info, but if i want to dump all the items i need to make use of that method like 10.000 times.. I've been looking to do multiple items in one go for ages, but haven't really found an answer.. However, with a map you can dump all the items at once since it's an arraylist (right?), but making the map using your method requires me to put in all the item id's by hand and that for 10000 items XD?

     

    What exactly are you trying to do? And what do you mean by "dump"? All you have to do is get the ID from the item with Dreambot's API, you don't have to type any IDs manually. 

     

    If you had the items in a list...

     

    for (Item i : itemList) {
      priceMap.put(i.getName(), PriceLookup.getPrice(i.getID());
    }
    

     

    I don't really think I understand what you're trying to accomplish, so let me know :)

    Link to comment
    Share on other sites

    What exactly are you trying to do? And what do you mean by "dump"? All you have to do is get the ID from the item with Dreambot's API, you don't have to type any IDs manually. 

     

    If you had the items in a list...

    for (Item i : itemList) {
      priceMap.put(i.getName(), PriceLookup.getPrice(i.getID());
    }
    

    I don't really think I understand what you're trying to accomplish, so let me know :)

    The OP has a full dump of all items in RS with the prices (the last line in the first post). In order to do that, you have to pass all the item ID's into that method, assuming he didn't do that 10000 times he passed one array (i think) with all the item id's through that method. It's like i want to have something like this:

     

    priceMap.put(i.getName(), PriceLookup.getPrice(i.getID());

     

    Where getID() is a method or variable with ALL the item id's stored in it. Is it more clear like so :P?

    Link to comment
    Share on other sites

    The OP has a full dump of all items in RS with the prices (the last line in the first post). In order to do that, you have to pass all the item ID's into that method, assuming he didn't do that 10000 times he passed one array (i think) with all the item id's through that method. It's like i want to have something like this:

     

    priceMap.put(i.getName(), PriceLookup.getPrice(i.getID());

     

    Where getID() is a method or variable with ALL the item id's stored in it. Is it more clear like so :P?

     

    Oh well you'd just have to have a list of the Items IDs and put them into a list in code then iterate over it. It's likely that OP had a text file that he read the IDs from into a program and just output them. I don't think there are any methods in Dreambot's API to get all the item IDs in the game, so you'll have to find that externally. There are lists on many websites, I just don't know any.

     

    His method doesn't support more than 1 item at a time, so you won't be able to do multiples in 1 call of the method.

    Link to comment
    Share on other sites

    Yes that is what i figured, thanks :D. However i do have all the item ID's. I got them via osbuddy extracted them via excel. All i want now is like a variable that will parse each ID into a method so that i can get all the item prices for example.

    Link to comment
    Share on other sites

    Yes that is what i figured, thanks :D. However i do have all the item ID's. I got them via osbuddy extracted them via excel. All i want now is like a variable that will parse each ID into a method so that i can get all the item prices for example.

     

    Put em all in a text file and read up on how to read information from a file. Then, by line, call the price lookup method on the ID and store it in a data structure with its name so that you can output it when its all done. 

    Link to comment
    Share on other sites

    Put em all in a text file and read up on how to read information from a file. Then, by line, call the price lookup method on the ID and store it in a data structure with its name so that you can output it when its all done. 

    Seems legit, can i contact you via skype if i need some help? I got your skype :P

    Link to comment
    Share on other sites

    • 1 month later...

    I can see this being useful if I had this running in a seperate program which stores the data of all items in a sql database and have my bot just look up that database rather than checking the website every time.

     

    If it was being used for a lot of items.

     

    EDIT: Or, for more local purposes, just have it update a text file that the script reads from.  Idea is to have a separate program running this rather than the bot.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.