Soldtodie Posted August 31, 2014 Share 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; } Link to comment Share on other sites More sharing options...
Joseph Posted September 1, 2014 Share Posted September 1, 2014 There already a method that work which is in the inventory class Link to comment Share on other sites More sharing options...
Soldtodie Posted September 1, 2014 Author Share 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. Link to comment Share on other sites More sharing options...
Joseph Posted September 2, 2014 Share Posted September 2, 2014 It doesn't make a diffence I believe. Link to comment Share on other sites More sharing options...
Extreme Scripts Posted September 2, 2014 Share 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 ^_^ Link to comment Share on other sites More sharing options...
Isolate Posted September 2, 2014 Share Posted September 2, 2014 (edited) Edit: Forget It Edited September 2, 2014 by Isolate Link to comment Share on other sites More sharing options...