Jump to content

Interact with multiple options not working?


Recommended Posts

Posted

I am attempting to go through tutorial island and in the combat section, I am using getInventory().getItem(ITEM).interact("Wield", "Equip") to deal with being in the stats menu vs just equipping via inventory. However, it does not work and simply fails to find the option on the item. I can split it up into getInventory().getItem(ITEM).interact("Wield") and getInventory().getItem(ITEM).interact("Equip") and it works fine. Anyone have any clues as to what I may be doing wrong?

Posted
1 hour ago, FyredUp said:

I am attempting to go through tutorial island and in the combat section, I am using getInventory().getItem(ITEM).interact("Wield", "Equip") to deal with being in the stats menu vs just equipping via inventory. However, it does not work and simply fails to find the option on the item. I can split it up into getInventory().getItem(ITEM).interact("Wield") and getInventory().getItem(ITEM).interact("Equip") and it works fine. Anyone have any clues as to what I may be doing wrong?

https://osbot.org/api/org/osbot/rs07/api/model/Interactable.html

Pretty sure you can only put 1 options, but you could try with {"Wield", "Equip"} since the method only takes 1 parameters. I'm pretty sure its not gonna work, but you can still try :)

Posted
3 hours ago, Nyb said:

https://osbot.org/api/org/osbot/rs07/api/model/Interactable.html

Pretty sure you can only put 1 options, but you could try with {"Wield", "Equip"} since the method only takes 1 parameters. I'm pretty sure its not gonna work, but you can still try :)

the interact function takes the params 

java.lang.String... actions

meaning it can take any number of arguments, given they are strings. So it 'should' work, but it doesnt :(

Posted
18 hours ago, FyredUp said:

I am attempting to go through tutorial island and in the combat section, I am using getInventory().getItem(ITEM).interact("Wield", "Equip") to deal with being in the stats menu vs just equipping via inventory. However, it does not work and simply fails to find the option on the item. I can split it up into getInventory().getItem(ITEM).interact("Wield") and getInventory().getItem(ITEM).interact("Equip") and it works fine. Anyone have any clues as to what I may be doing wrong?

I would recommend not calling the interact() in the same call as getItem() as it could throw an NPE.

Anyways you can try this if the first action is the one you always want to use.

Item invItem = getInventory().getItem("ItemName");
if (invItem != null) {
    String[] actions = invItem.getActions();
    if (actions != null)
        invItem.interact(actions[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...