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
  • Try asking for help in the chatbox
  • Item in bank count, with placeholders.


    Chichoo
     Share

    Recommended Posts

    Hi all,

    I was wondering if it was possible to determine if an item in bank with a placeholder had a count of 0? Every time I've tried it always had a count of at least 1. Does this mean writing for items with placeholders isn't as robust as writing for items without placeholders? Not sure if this makes much sense but I want to do something like if no more items x in bank, move on to y task.

    Thank you in advance!

    Link to comment
    Share on other sites

    9 hours ago, Nuclear Nezz said:

    there's a method isPlaceholder() on Item.

    Could you please elaborate? I've tried to mess around with it a bit but couldn't come with any conclusive solution on my end. I've tried getPlaceholderValue() but that doesn't give the count.

    What I effectively want to do is getBank().count(<Item>), but with placeholders, if I have zero of that item, it'll still give a value of one instead of zero.

    Link to comment
    Share on other sites

    I'm not sure if you're looking for a specific item or not but

    getBank().count(i->i != null && i.getName().equals("Varrock teleport") && i.isPlaceholder())

    or if you're trying to find anything that is not a place holder, put a ! in front of that there placeholder check.

    Link to comment
    Share on other sites

    2 hours ago, Nuclear Nezz said:

    I'm not sure if you're looking for a specific item or not but

    getBank().count(i->i != null && i.getName().equals("Varrock teleport") && i.isPlaceholder())

    or if you're trying to find anything that is not a place holder, put a ! in front of that there placeholder check.

    Ahh, I'm trying to find the number of an item, i.e. number of "Logs" in the bank.

    getBank().count() returns the correct amount of "Logs" if there are zero, however if "Logs" is a placeholder, it will return one instead of zero. I hope that makes more sense.

    Link to comment
    Share on other sites

    3 hours ago, Chichoo said:

    Ahh, I'm trying to find the number of an item, i.e. number of "Logs" in the bank.

    getBank().count() returns the correct amount of "Logs" if there are zero, however if "Logs" is a placeholder, it will return one instead of zero. I hope that makes more sense.

    getBank().count(i->i != null && i.getName().equals("Logs") && !i.isPlaceholder())

    Link to comment
    Share on other sites

    Oh, I think I just understood what placeholder means now. An item is a placeholder if it has a value of 0 and exists in the bank. If the item in the bank has quantity > 0, then it exists as an item, and not currently placeholder.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.