FyredUp Posted June 28, 2020 Share Posted June 28, 2020 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? Quote Link to comment Share on other sites More sharing options...
Nyb Posted June 28, 2020 Share Posted June 28, 2020 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 Quote Link to comment Share on other sites More sharing options...
FyredUp Posted June 29, 2020 Author Share Posted June 29, 2020 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 Quote Link to comment Share on other sites More sharing options...
Nbacon Posted June 29, 2020 Share Posted June 29, 2020 you could try getInventory().getItem(ITEM).interact() if your out side of a bank but also i think "Equip" should be "Wear". Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted June 29, 2020 Share Posted June 29, 2020 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]); } Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted June 29, 2020 Share Posted June 29, 2020 Make sure to null check the item first, will give errors when the items is not in your inventory Quote Link to comment Share on other sites More sharing options...