yfoo Posted February 16, 2018 Share Posted February 16, 2018 How do you get the GrandExchange.Box that the below method uses to buy an item. buyItem(int itemId, java.lang.String searchTerm, int price, int quantity) Is there another way of doing it that is not (python-like psuedocode) for box in geBoxes: if box.getItemID == correctItemID: return box return null Thanks. Quote Link to comment Share on other sites More sharing options...
Chris Posted February 16, 2018 Share Posted February 16, 2018 (edited) private GrandExchange.Box getBox(){ for (GrandExchange.Box box : GrandExchange.Box.values()) { if (getGrandExchange().getItemId(box) == correctItemID) return box; } return null; } Edited February 16, 2018 by Chris 1 Quote Link to comment Share on other sites More sharing options...
flewis Posted February 16, 2018 Share Posted February 16, 2018 Just thought I'd add this code in, this will test if the item has been brought in a specific box in the GE so if you have any waiting involved you can use this code to check if the buy has completed. // Tests to see if box one is being used or not if (getGrandExchange().getStatus(GrandExchange.Box.BOX_1) != GrandExchange.Status.EMPTY) { log("Box 1 of the Grand Exchange is not empty..."); sleep(random(2000, 3000)); // Tests to see if box 1 is finished if (grandExchange.getAmountRemaining(GrandExchange.Box.BOX_1) == 0) { log("Item 1 has finished in GE box 1..."); } } Also I used 'getAmountRemaining' because all the other methods were not working for me in the new update. -Flewis Quote Link to comment Share on other sites More sharing options...