SpareGold 4 Share Posted February 25, 2015 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 More sharing options...
DefCon 121 Share Posted February 25, 2015 shop.getItemByName("item").getAmount(); Link to comment Share on other sites More sharing options...
Vlad 216 Share Posted February 25, 2015 Item i = getItemContainer().getShop().get("Newcomer map"); if (i != null) { log(Integer.toString(i.getAmount())); return 3000; } Works. Link to comment Share on other sites More sharing options...
SpareGold 4 Author Share Posted February 25, 2015 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; } 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 More sharing options...
Vlad 216 Share Posted February 25, 2015 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 More sharing options...
SpareGold 4 Author Share Posted February 25, 2015 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 More sharing options...
Vlad 216 Share Posted February 25, 2015 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 More sharing options...
SpareGold 4 Author Share Posted February 26, 2015 Yeah I would agree, Thanks! Link to comment Share on other sites More sharing options...
Notorious 342 Share Posted February 26, 2015 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 More sharing options...
Fran 99 Share Posted February 26, 2015 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.