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
  • Need help, how to filter multiple items using Filter<Item> filter?


    stevenl4

    Recommended Posts

    Using Java8

     

    say I wanted to deposit everything except a Bronze pickaxe, I'd use

     

    getBank().depositAllExcept(items -> items.getName().equals("Bronze pickaxe"));

     

    What do I do if I want to deposit everything except a Bronze pickaxe, 500 coins and Varrock teleport tab using similar code?

     

     

    Link to comment
    Share on other sites

    Using Java8

     

    say I wanted to deposit everything except a Bronze pickaxe, I'd use

     

    getBank().depositAllExcept(items -> items.getName().equals("Bronze pickaxe"));

     

    What do I do if I want to deposit everything except a Bronze pickaxe, 500 coins and Varrock teleport tab using similar code?

     

     

    If it's just a couple things, you can do:

    getBank().depositAllExcept(i -> i.getName().equals("Bronze pickaxe") || i.getName().equals("Coins"));
    

    Otherwise you can have a list of names, and do:

    getBank().depositAllExcept(i -> list.contains(i.getName()));
    
    Link to comment
    Share on other sites

     

    If it's just a couple things, you can do:

    getBank().depositAllExcept(i -> i.getName().equals("Bronze pickaxe") || i.getName().equals("Coins"));
    

    Otherwise you can have a list of names, and do:

    getBank().depositAllExcept(i -> list.contains(i.getName()));
    

     

    I think the second one is what I'm looking for, how do I create a list of items currently in my inventory at the beginning of the script? Thanks

    Link to comment
    Share on other sites

    I think the second one is what I'm looking for, how do I create a list of items currently in my inventory at the beginning of the script? Thanks

    ArrayList<Item> invItems = new ArrayList<>(getInventory().all());
    
    That will work but you need to call that when you need to check. If you just call at the beginning of the script it will only get the items that exist in the inventory at the beginning of the script
    Link to comment
    Share on other sites

    ArrayList<Item> invItems = new ArrayList<>(getInventory().all());
    
    That will work but you need to call that when you need to check. If you just call at the beginning of the script it will only get the items that exist in the inventory at the beginning of the script

     

    Why construct it as an arraylist when #all returns a list? unless there is some reason why you need an arraylist over a list

     

    xd

    Link to comment
    Share on other sites

    Why construct it as an arraylist when #all returns a list? unless there is some reason why you need an arraylist over a list

     

    xd

    ArrayList rules!

     

    Just got used to do it tbh

    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.