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
  • Storing items help


    sp3cpk

    Recommended Posts

    So say I want my bot to get all the items in the bank and store it/cache it (as in remember the items in the bank when the bank is closed) 

    how exactly would I do that?

    Link to comment
    Share on other sites

    9 minutes ago, Milasoft said:

    The getBank().all() method will return a List of all items in the bank.

    you store it in an array?

    can you show me an example? 

    Link to comment
    Share on other sites

    15 minutes ago, Milasoft said:

    Each Item is stored in the List

    I tried

                List<Item> bankItems = new ArrayList<>(getBank().all());
                if(bankItems.stream().anyMatch(lol -> lol.getName().equalsIgnoreCase("Coins"))){
                getKeyboard().type("lol");
                sleep(2000);
                }

    Seems to only know coins are in the bank > when bank is open

    I want the bot to recognize if it had specific items in the bank, even when it is closed 

    Link to comment
    Share on other sites

    2 hours ago, Milasoft said:

    Declare the list as an instance variable then. So put

    
    List<Item> bankItems; 

     at the top of your class, and then in the method do

    
    bankItems = getBank().all();

     

    Tried this and still getting the same issue

    2 hours ago, PolyesterZest said:
    
    getBank().getBankHistoryCache()

     DreamBot already does this for you

    Never knew this existed, tried it and getting same issue.

    in what format are the items stored in the list? id? string?

    Link to comment
    Share on other sites

    It is a List<Item>, so you can get the name, id, and amount of each item. It will only get filled once the bank is opened for the first time during the script's run though

    Link to comment
    Share on other sites

    1 minute ago, PolyesterZest said:

    It is a List<Item>, so you can get the name, id, and amount of each item. It will only get filled once the bank is opened for the first time during the script's run though

    this is what I have so far            

    List<Item> bankItems = getBank().getBankHistoryCache();
                if(bankItems.stream().anyMatch(lol -> lol.getName().contentEquals("Coins"))){
                    getKeyboard().type("2");
                }

    as soon as the bank is closed it'll stop spamming "2".

     

    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.