Jump to content

Interact with multiple options not working?


FyredUp

Recommended Posts

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?

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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 :(

Link to comment
Share on other sites

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]);
}
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...