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
  • Getting number of certain item in shop


    SpareGold

    Recommended Posts

    I understand how to check the shop for an item, buy, sell etc, but is there a way to get the number of a certain item in the shop? For example, if there were 15 logs in the shop, how do I access the 15?

    Link to comment
    Share on other sites

    Item i = getItemContainer().getShop().get("Newcomer map");
    
    		if (i != null) {
    			log(Integer.toString(i.getAmount()));
    			return 3000;
    		}
    

    e2QWY9K.png

     

    Works.

    Link to comment
    Share on other sites

    Okay, I knew it would be that simple and I would end up looking stupid. Thanks guys.


    Item i = getItemContainer().getShop().get("Newcomer map");
    
    		if (i != null) {
    			log(Integer.toString(i.getAmount()));
    			return 3000;
    		}
    

    e2QWY9K.png

     

    Works.

     

     

    Does getShop().sell(string, int); work? I am trying to sell 10 noted logs using getShop().sell("Logs", 10); and I know the script reaches this point, but nothing is happening.

    Link to comment
    Share on other sites

    Okay, I knew it would be that simple and I would end up looking stupid. Thanks guys.

     

    Does getShop().sell(string, int); work? I am trying to sell 10 noted logs using getShop().sell("Logs", 10); and I know the script reaches this point, but nothing is happening.

     

    This works:

    Item i = getItemContainer().getInventory().get("Feather");
    
    		if (i != null && getShop().isOpen()) {
    			getItemContainer().getShop().sell("Feather", 10);
    		}
    Link to comment
    Share on other sites

     

    This works:

    Item i = getItemContainer().getInventory().get("Feather");
    
    		if (i != null && getShop().isOpen()) {
    			getItemContainer().getShop().sell("Feather", 10);
    		}

    This does work! Any explanation of why it works over the other way?

    Link to comment
    Share on other sites

    This does work! Any explanation of why it works over the other way?

     

    I can't say for sure. DreamBot API is weird. I'm guessing all item stuff works with the new ItemContainer class while stuff like checking if the shop is open still works the old way with the Shop class.

    Link to comment
    Share on other sites

    I can't say for sure. DreamBot API is weird. I'm guessing all item stuff works with the new ItemContainer class while stuff like checking if the shop is open still works the old way with the Shop class.

     

    That is because the getShop() is the old call, but that will be changing after this coming update. So there will be no need to call getItemContainer() anymore, you can directly reference the new classes by using the corresponding getter method.

    Link to comment
    Share on other sites

    That is because the getShop() is the old call, but that will be changing after this coming update. So there will be no need to call getItemContainer() anymore, you can directly reference the new classes by using the corresponding getter method.

    that's sick! looking forward to it :D

    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.