Pretty much just trying to hold down 'Num1' on the keyboard while I run a for loop and release after.
keyboard.pressKey(97);
if(tabs.isOpen(Tab.INVENTORY)) {
int myNum = (int) inventory.getAmount(Item);
for (int i = 0; i < myNum; i++) {
mouse.click(random(690, 720), random(430, 460), false);
objects.closest(Object).interact();
}
keyboard.releaseKey(97);
} else {
tabs.open(Tab.INVENTORY);
}
I use this in another script to drop items with shift and it works
keyboard.pressKey(16);
for (int i = 0; i < myPattern.length; i++) {
getMouse().click(getInventory().getMouseDestination(myPattern[i]));
}
keyboard.releaseKey(16);