Soldtodie Posted August 31, 2014 Posted August 31, 2014 public boolean deselectItem() { if(inventory.isItemSelected()) { return mouse.click(inventory.getMouseDestination(getSelectedItemSlot())); } return false; } public int getSelectedItemSlot() { if(inventory.isItemSelected()) { for(int slot = 0; slot < 28; slot++) { Item it = inventory.getItemInSlot(slot); if(it != null && it.getName().equals(inventory.getSelectedItemName())) { InventorySlotDestination is = new InventorySlotDestination(getBot(), slot); for(int x = is.getBoundingBox().x; x < is.getBoundingBox().x + is.getBoundingBox().width; x++) { for(int y = is.getBoundingBox().y; y < is.getBoundingBox().y + is.getBoundingBox().height; y++) { if(getColorPicker().isColorAt(x, y, new Color(255, 255, 255))) { return slot; } } } } } } return -1; }
Joseph Posted September 1, 2014 Posted September 1, 2014 There already a method that work which is in the inventory class
Soldtodie Posted September 1, 2014 Author Posted September 1, 2014 There already a method that work which is in the inventory class Yeah. But with this you can get the selected item.
Extreme Scripts Posted September 2, 2014 Posted September 2, 2014 I think the reason he chose to do it this way is so that if ever he needed to get the selected item for another task then it could be easily done the way he's written it ^_^
Isolate Posted September 2, 2014 Posted September 2, 2014 (edited) Edit: Forget It Edited September 2, 2014 by Isolate