Jump to content

Item hasAction doesn't change if the banking interface is open. Alternative?


Recommended Posts

Posted

Hi!

Wondering if anyone else ran into this problem before.

I thought of a way to check if a runecrafting pouch is empty or not (during banking). If the banking interface is open the rune pouch has either the option "Fill" or "Empty". I wanted to create a check to see if the item has the action (when the banking interface is open).

I thought I could do it like underneath, but that provides you with all the items that would normally have that action (with the banking interface closed).

getInventory().filter(item -> item.hasAction("Fill")

How would I go on to read the (current) actions of an object? Or if anyone knows of a better way to check/know if the pouch is filled or not, please let me know since old strategies don't work anymore.

Posted
15 hours ago, Muffins said:

I believe the rune pouch config/id changes based on what's in it, if it's degraded etc.

 

This post is old but should provide some guidance.

 

https://osbot.org/forum/topic/10309-pouch-algorithm-for-adding-pouch-support-to-your-script/

Thanks for your reply. 

I actually read that post and tried to implement a varbits method, but I couldn't get it to work. After that I remembered runelite having a plugin to count the essence so I went looking on their GitHub and there they mentioned that the varbits that track the amount of essence in a pouch were removed. Which explains why the varbits method I used always returned 0. 

So far no luck. Any other creative ideas?

Posted (edited)

Not sure if maybe something like this would work? //ignore the lack of format, it was fine in Eclipse, not sure why it messed up when I posted. ^^

	private String[] pouches = new String[] { "Small pouch", "Medium pouch", "Large pouch", "Giant pouch" };

public void pouch() throws InterruptedException {
	for (String pouch : pouches) {
    if  (!getInventory().contains(pouch); {
		  getBank().withdraw(pouch, 1);
        } else if (getInventory().contains(pouch)){
				if(pouch.hasAction("Fill")){
            		pouch.interact("Fill");
            		sleep(random(50, 500));    
        }
        new ConditionalSleep(1500, 20) {
            @Override
            public boolean condition() throws InterruptedException {
                return (pouch.hasAction("Empty"));
            }
        }.sleep();
    }
  }

 

Edited by Lol_marcus
Posted
On 6/6/2020 at 2:36 PM, Wolk said:

Hi!

Wondering if anyone else ran into this problem before.

I thought of a way to check if a runecrafting pouch is empty or not (during banking). If the banking interface is open the rune pouch has either the option "Fill" or "Empty". I wanted to create a check to see if the item has the action (when the banking interface is open).

I thought I could do it like underneath, but that provides you with all the items that would normally have that action (with the banking interface closed).


getInventory().filter(item -> item.hasAction("Fill")

How would I go on to read the (current) actions of an object? Or if anyone knows of a better way to check/know if the pouch is filled or not, please let me know since old strategies don't work anymore.

Try this, haven't tested it.

Item pouch = (Item) Arrays.stream(getInventory().getItems()).filter((i) -> i.getName().contains("pouch") && i.hasAction("Fill")).toArray()[0];

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...