Chris Posted August 6, 2015 Share Posted August 6, 2015 I want to to select the talisman and interact with the ruins but it only returns the option for tiaras aka "Enter" Entity ruins = s.objects.closest("Mysterious ruins"); if (ruins != null) { s.sleep(s.random(3000)+500); if (s.getInventory().contains("Air talisman")) { if (s.getInventory().getSelectedItemName().equals("Air talisman")) { ruins.interact("Use"); s.sleep(s.random(300) + 600); } else { s.inventory.getItem("Air talisman").interact("Use"); //if first statement is not true it will select it again (Hoping ) } } else { ruins.interact("Enter"); //if you are using a tiara it will just call 'enter' and go inside s.sleep(s.random(300) + 1000); } } Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted August 6, 2015 Share Posted August 6, 2015 (edited) I want to to select the talisman and interact with the ruins but it only returns the option for tiaras aka "Enter" Entity ruins = s.objects.closest("Mysterious ruins"); if (ruins != null) { s.sleep(s.random(3000)+500); if (s.getInventory().contains("Air talisman")) { if (s.getInventory().getSelectedItemName().equals("Air talisman")) { ruins.interact("Use"); s.sleep(s.random(300) + 600); } else { s.inventory.getItem("Air talisman").interact("Use"); //if first statement is not true it will select it again (Hoping ) } } else { ruins.interact("Enter"); //if you are using a tiara it will just call 'enter' and go inside s.sleep(s.random(300) + 1000); } } Can't help you if you're making a runecrafter ... Tip: Make sure to do inventory.isItemSelected() && s.getInventory().getSelectedItemName().equals("Air talisman") Khaleesi Edited August 6, 2015 by Khaleesi 1 Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 6, 2015 Share Posted August 6, 2015 (edited) public boolean usePleb(String action, String action2) { // action == the item it is going to select, action2 == in this case, is the ruins Entity ruins = objects.closest(action2); if (inventory.isItemSelected()) { // IF ITEM IS SELECTED if (inventory.getSelectedItemName() == action) { // IF THE SELECTED ITEM IS == action ruins.interact("Use"); } else { inventory.deselectItem(); } } else { inventory.interact("Use", action); // THIS ONE WILL SELECT THE ITEM IF ITEM IS NOT SELECTED } return true; } to use this just use; usePleb("Air talisman", "Mysterious Ruins"); Edited August 6, 2015 by iJodix 1 Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted August 6, 2015 Share Posted August 6, 2015 public boolean usePleb(String action, String action2) { // action == the item it is going to select, action2 == in this case, is the ruins Entity ruins = objects.closest(action2); if (inventory.isItemSelected()) { // IF ITEM IS SELECTED if (inventory.getSelectedItemName() == action) { // IF THE SELECTED ITEM IS == action ruins.interact("Use"); } else { inventory.deselectItem(); } } else { inventory.interact("Use", action); // THIS ONE WILL SELECT THE ITEM IF ITEM IS NOT SELECTED } return true; } to use this just use; usePleb("Air talisman", "Mysterious Ruins"); Here's a nicer version ;) public boolean usePleb(String itemName, String objectName) { if (objectName.isEmpty() || itemName.isEmpty() || !getInventory().contains(itemName)) return false; Entity localEntity = getObjects().closest(objectName); if (localEntity == null || !localEntity.exists()) return false; if (!localEntity.isVisible()) getCamera().toEntity(localEntity); if (getInventory().isItemSelected() && !getInventory().getSelectedItemName().equalsIgnoreCase(itemName)) getInventory().deselectItem(); getInventory().interact("Use", itemName); localEntity.interact("Use"); return true; } 1 Quote Link to comment Share on other sites More sharing options...