Tom Posted April 10, 2015 Posted April 10, 2015 Trying to type in the amount of things to make when you interact with an item "Make X". So far I have this, but I don't think it is the best way to do it. widgets.interact(gui.getWidget()[0], gui.getWidget()[1], "Make X"); cSleep(3000, widgets.isVisible(548, 120)); sleep(random(150, 250)); keyboard.typeString("99", true); Still manages to type 99 into the chat sometimes Also, while Im here I may as well ask Is there something in the api to "Use" an item on another item e.g. a Knife on logs. Right now im doing something like this Item item = inventory.getItem("Knife"); item.interact("Use"); inventory.getItem(gui.getLogType()).hover(); mouse.click(false);
Czar Posted April 10, 2015 Posted April 10, 2015 (edited) if (getInventory().isItemSelected()) { // item is selected, now "use" the target item getInventory().interact("Use", "magic logs"); } else { getInventory().interact("Use", "tinderbox"); } Edited April 10, 2015 by Czar 1
Khaleesi Posted April 10, 2015 Posted April 10, 2015 Trying to type in the amount of things to make when you interact with an item "Make X". So far I have this, but I don't think it is the best way to do it. widgets.interact(gui.getWidget()[0], gui.getWidget()[1], "Make X"); cSleep(3000, widgets.isVisible(548, 120)); sleep(random(150, 250)); keyboard.typeString("99", true); Still manages to type 99 into the chat sometimes Also, while Im here I may as well ask Is there something in the api to "Use" an item on another item e.g. a Knife on logs. Right now im doing something like this Item item = inventory.getItem("Knife"); item.interact("Use"); inventory.getItem(gui.getLogType()).hover(); mouse.click(false); Use this: if (script.colorPicker.isColorAt(505, 390, new Color(174, 160, 131))) { script.keyboard.typeString("" + 99); } Checks if you are able to input text, Uses a color to determine if scrollbar is gone. For the "Use" thing: This is what i use: public static void useItemOnItem(String name1, String name2, Script script) { if (script.widgets.getInventory().getSelectedItemName() != null && script.widgets.getInventory().getSelectedItemName().equals(name1)) { Item item = script.widgets.getInventory().getItem(name2); if (item != null) item.interact("Use"); } else { Item item = script.widgets.getInventory().getItem(name1); if (item != null) item.interact("Use"); } } Hope this helped! Khaleesi 1