February 16, 20187 yr 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.
February 16, 20187 yr private GrandExchange.Box getBox(){ for (GrandExchange.Box box : GrandExchange.Box.values()) { if (getGrandExchange().getItemId(box) == correctItemID) return box; } return null; } Edited February 16, 20187 yr by Chris
February 16, 20187 yr 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
Create an account or sign in to comment