Owner3 Posted April 13, 2013 Share Posted April 13, 2013 How to get a script to buy items from a shop. Link to comment Share on other sites More sharing options...
danieljvdm Posted April 14, 2013 Share Posted April 14, 2013 ^ This. I feel like it's missing in the API, but I couldn't find the method to move mouse to coordinates either... ideas? Link to comment Share on other sites More sharing options...
Owner3 Posted April 14, 2013 Author Share Posted April 14, 2013 bump Link to comment Share on other sites More sharing options...
Speakmore Posted April 14, 2013 Share Posted April 14, 2013 bump Maxi posted back on Daniel's thread saying it is currently not in the API and would have to manually be scripted until added to it (the API). Link to comment Share on other sites More sharing options...
Owner3 Posted April 14, 2013 Author Share Posted April 14, 2013 Maxi posted back on Daniel's thread saying it is currently not in the API and would have to manually be scripted until added to it (the API). you got any experience with it? Link to comment Share on other sites More sharing options...
Speakmore Posted April 14, 2013 Share Posted April 14, 2013 you got any experience with it? Not a chance ^_^ Just started reviewing and looking at script yesterday, I just recall reading Maxi's post on the topic on the other thread. Link to comment Share on other sites More sharing options...
FrostyPops Posted April 16, 2013 Share Posted April 16, 2013 I would like to know this as well. Link to comment Share on other sites More sharing options...
danieljvdm Posted April 17, 2013 Share Posted April 17, 2013 private Rectangle getShopItemBounds(int itemId) { int slot = -1; for (int i = 0; i < client.getInterface(300).getChild(75).getInv().length; i++) { if (client.getInterface(300).getChild(75).getInv()[i] - 2 == itemId) { slot = i + 1; break; } } if (slot == -1) { return null; } int row = (int) Math.ceil((slot / 8.0) - 1); int column = slot > 8 ? slot - (row * 8) : slot; column--; int x = 80 + (column * 16) + (column * 31); int y = 69 + (row * 16) + (row * 31); return new Rectangle(x, y, 31, 31); } /** * Buys an item from the shop. * @param Item the item. * @throws InterruptedException if another thread has interrupted the current thread. */ private void buyShopItem(Item item) throws InterruptedException { Rectangle itemBounds = getShopItemBounds(item.getId()); RectangleDestination destination = new RectangleDestination(itemBounds); selectOption(null, destination, "Buy 10", false); sleep(100); selectOption(null, destination, "Buy 10", false); sleep(100); selectOption(null, destination, "Buy 10", false); } Link to comment Share on other sites More sharing options...