Chichoo 0 Share Posted January 5, 2019 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 More sharing options...
Nuclear Nezz 2040 Share Posted January 5, 2019 there's a method isPlaceholder() on Item. Link to comment Share on other sites More sharing options...
Chichoo 0 Author Share Posted January 5, 2019 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 More sharing options...
Nuclear Nezz 2040 Share Posted January 5, 2019 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 More sharing options...
Chichoo 0 Author Share Posted January 5, 2019 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 More sharing options...
Nuclear Nezz 2040 Share Posted January 5, 2019 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 More sharing options...
Chichoo 0 Author Share Posted January 6, 2019 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.