June 28, 20205 yr 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?
June 28, 20205 yr 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
June 29, 20205 yr Author 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
June 29, 20205 yr you could try getInventory().getItem(ITEM).interact() if your out side of a bank but also i think "Equip" should be "Wear".
June 29, 20205 yr 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]); }
June 29, 20205 yr Developer Make sure to null check the item first, will give errors when the items is not in your inventory
Create an account or sign in to comment