ScripterS 0 Share Posted December 6, 2021 Used to have a snippet saved of how i interacted with inv slots for cleaning herbs e.t.c but this is about 4 years old. Was having trouble getting the Mouse functionality to work looking at the docs: Any ideas appreciated - also I have issues with docs as all old methods are deprecated. Struggling to walk through new versions of everything? Code below: public void searchOnlyThese (Integer[] droppables, int[] dropOrder) { Rectangle[] invRects = new Rectangle[28]; for (int r = 0; r < invRects.length; r++) { int x = 563 + 42 * (r % 4); int y = 213 + 36 * (r / 4); invRects[r] = new Rectangle(x, y, 42, 36); } Mouse mouse = Mouse; Instance instance = Client.getInstance(); Canvas canvas = instance.getCanvas(); Inventory inventory = Inventory; instance.setKeyboardInputEnabled(true); Mouse.getMouseSettings(); MouseSettings.setSpeed(Calculations.random(7, 11)); // canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_SHIFT, KeyEvent.CHAR_UNDEFINED)); for (int r = 0; r < dropOrder.length; r++) { if (Inventory.getItemInSlot(dropOrder[r]) != null && Arrays.asList(droppables).contains(Inventory.getItemInSlot(dropOrder[r]).getID())) { Mouse.click(invRects[dropOrder[r]]); } try { Thread.sleep(random(60,260)); } catch (InterruptedException e) { e.printStackTrace(); } } // canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), 0, KeyEvent.VK_SHIFT, KeyEvent.CHAR_UNDEFINED)); Mouse.getMouseSettings().resetSpeed(); instance.setKeyboardInputEnabled(false); } Link to comment Share on other sites More sharing options...
ScripterS 0 Author Share Posted December 6, 2021 This instead of looping through a while statement along the lines of while inv contains grimy herb click herb. From memory interaction with a more ahk methodology was better for antiban Link to comment Share on other sites More sharing options...
Axolotl 31 Share Posted December 7, 2021 Not tested but something like this should work for cleaning herbs: private void cleanHerbs() { for(int i = 0; i < 28; i++) { if(Inventory.getItemInSlot(i) != null) { if(Inventory.getItemInSlot(i).getName().contains("Grimy")) { Inventory.getItemInSlot(i).interact(); int inventorySlot = i; sleepUntil(() -> !Inventory.getItemInSlot(inventorySlot).getName().contains("Grimy"), Calculations.random(1500, 2500)); } } } } Link to comment Share on other sites More sharing options...
ScripterS 0 Author Share Posted December 8, 2021 That's nice - thanks. Then I guess you can pass in custom lists for a cleaning order Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.