farmerGold Posted May 2, 2017 Posted May 2, 2017 Tell me please How to check if there is a thing in the bank ?
Chris Posted May 2, 2017 Posted May 2, 2017 public class Bank extends ItemContainer Represents the API regarding bank functionality. https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html contains public boolean contains(java.util.List<Item> items) Determines whether or not this containers contains any of the specified items. Parameters: items - The items to match. Returns: True if the containers contains at least one item matched. getBank().contains("TriHard") 3
Saiyan Posted May 2, 2017 Posted May 2, 2017 only check if the bank contains an item if the bank tab is open 1
farmerGold Posted May 2, 2017 Author Posted May 2, 2017 Many thanks to all. Long time did not write scripts)
Phaibooty Posted May 14, 2017 Posted May 14, 2017 On 5/1/2017 at 9:58 PM, Chris said: public class Bank extends ItemContainer Represents the API regarding bank functionality. https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html contains public boolean contains(java.util.List<Item> items) Determines whether or not this containers contains any of the specified items. Parameters: items - The items to match. Returns: True if the containers contains at least one item matched. getBank().contains("TriHard") Hi, Using that, how would I display # of a item in paint? I just need to be able to call it? Maybe, puclic int = getbank... something... Or would it be more complicated than that? Where I have to update a number every time I open the bank? 1
Chris Posted May 14, 2017 Posted May 14, 2017 int numberOfPogChamps; if (getBank().isOpen()){ numberOfPogChamps += getBank().getAmount("PogChamp"); } //onPaint g.drawString("# of Pogchamps: " + numberOfPogChamps, 20, 50); 1
LoudPacks Posted May 14, 2017 Posted May 14, 2017 (edited) 11 hours ago, Chris said: int numberOfPogChamps; if (getBank().isOpen()){ numberOfPogChamps += getBank().getAmount("PogChamp"); } //onPaint g.drawString("# of Pogchamps: " + numberOfPogChamps, 20, 50); This will add the bank amount each time you open the bank. So if you have 200 and open the bank twice it will say 400 instead of 200. You should update the var like: numberOfPogChamps += getBank().getAmount("PogChamp") - numberOfPogChamps; //or numberOfPogChamps = getBank().getAmount("PogChamp") This way it will only update the changes. Edited May 14, 2017 by LoudPacks 1
Chris Posted May 14, 2017 Posted May 14, 2017 6 hours ago, LoudPacks said: This will add the bank amount each time you open the bank. So if you have 200 and open the bank twice it will say 400 instead of 200. You should update the var like: numberOfPogChamps += getBank().getAmount("PogChamp") - numberOfPogChamps; //or numberOfPogChamps = getBank().getAmount("PogChamp") This way it will only update the changes. yeah u rite but i figured he would know that after a few tests xD 1