venetox Posted September 25, 2016 Share Posted September 25, 2016 Hi,I will keep this thread updated with snippets of code I find useful. If the code is not mine I will tag/link/name creator. /** * Moves the item found by itemName to the tab defined by tabNumber in the bank. * @param itemName The String itemName of the item. * @param tabNumber The tab number starting from 0, 0 is the global tab, 1 is the first tab etc. * @return Returns true if success, false if failed at any point. */ public boolean moveItemToTab(String itemName, int tabNumber) { RS2Widget tabWidget = getWidgets().get(12, 10, tabNumber); // Here we get the widget that refers to the tab we want to send it to inside the bank. Item item = getBank().getItem(itemName); // Here we get the instance of the item we want to move. (Item must be in bank) if(tabWidget != null && item != null) { Rectangle tabClickRectangle = tabWidget.getBounds(); // Here we get the bounding box for the widget (spot we must click) RectangleDestination tabDestination = new RectangleDestination(bot, tabClickRectangle); // Here we make that bounding box into a destination the mouse can use item.hover(); // Here we move the mouse to the item we want to move. Rectangle currentPos = new Rectangle((int) getMouse().getPosition().getX(), (int) getMouse().getPosition().getY(), 1, 1); // Here we get the mouses current position after moving to the item. RectangleDestination currentDestination = new RectangleDestination(bot, currentPos); // Create destination for the current position. return getMouse().continualClick(currentDestination, new Condition() { // Here we move from the current positon, to the tab's destination. public boolean evaluate() { getMouse().move(tabDestination, true); return tabClickRectangle.getBounds().contains(getMouse().getPosition()); } }); } else return false; } 5 Quote Link to comment Share on other sites More sharing options...
Mr Pro Pop Posted September 26, 2016 Share Posted September 26, 2016 Nice snippet out, Really useful. Hope to see more from you bro, Good luck! Quote Link to comment Share on other sites More sharing options...