KankerHenk 0 Posted July 30, 2020 Hey, I'm having some trouble where a script will sometimes have an item selected after dropping an inventory, and then fails to perform its next action. The solution is to click somewhere to de-select the item. The only way i've found that seems to work is to move the mouse to a random position and click(). I was wondering if there is a more elegant way of canceling a selection. The way i currently do it is as follows: if(mc.getInventory().getSelectedItemIndex() != -1){ Point p = new Point(Calculations.random(520, 549), Calculations.random(208, 338)); mc.getMouse().move(p); sleep(randomWait(1400)); mc.getMouse().click(); sleep(randomWait(1800)); } (mc here is the method context or 'this' of the script) Thanks!
SubCZ 284 Posted July 30, 2020 The Inventory class has a built in method for this: mc.getInventory().deselect() Note that Inventory also has a method to check if an item is selected: mc.getInventory().isItemSelected()
Recommended Posts
Archived
This topic is now archived and is closed to further replies.