Jump to content

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


Wolk

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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];
Link to comment
Share on other sites

1 hour ago, Wolk said:

Thanks @Lol_marcus and @BravoTaco!

Sadly neither of those work since they use the same logic that I used/tried.


Item.hasAction("Fill")

always returns true for runecrafting pouches even when the option isn't available.

Is the option visible even when its full? If so you will probably have to use configs than.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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