anderiel Posted June 2, 2016 Posted June 2, 2016 I want to drag around items in inventory, to arrange them for easier clicking. But i cant figure out how to actually drag them to change the place of one item. Inventory does not have any calls for that (or at least i did not find any) and i also tried this: execute(new ContinualClickMouseEvent(inventory.getMouseDestination(from),new Condition(){ @Override public boolean evaluate() { return InventorySlotDestination.getSlot(to).contains(mouse.getPosition()); } })); execute(new MoveMouseEvent(inventory.getMouseDestination(to),true)); but all that does is it clicks the item i want to drag and stays there until i force quit the script.
Incus Valley Posted June 2, 2016 Posted June 2, 2016 (edited) This is what I use to swap items in inventory spaces. public boolean swapItems(int slot1, int slot2) throws InterruptedException { if (getInventory().isItemSelected()) { getInventory().deselectItem(); } return getMouse().continualClick(getInventory().getMouseDestination(slot1), new Condition() { @Override public boolean evaluate() { getMouse().move(getInventory().getMouseDestination(slot2), true); return getInventory().getMouseDestination(slot2).getBoundingBox().contains(getMouse().getPosition()); } }); } Kinda messy, but it works. Edited June 2, 2016 by Incus Valley
anderiel Posted June 3, 2016 Author Posted June 3, 2016 It does work, thanks i do wonder if there is a cleaner solution though.