SpareGold 4 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?
Vlad 216 Posted February 25, 2015 Item i = getItemContainer().getShop().get("Newcomer map"); if (i != null) { log(Integer.toString(i.getAmount())); return 3000; } Works.
SpareGold 4 Author 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.
Vlad 216 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); }
SpareGold 4 Author 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?
Vlad 216 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.
Notorious 342 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.
Fran 99 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.