Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Customized order for dropping items


    century
     Share

    Recommended Posts

    Firstly, a word of thanks for distractionslasso, and Xephy for the amazing support and help along the way. Thank you. I am where I am because of you.

     

    While working on a human-like system for dropping an inventory of items, I ended up writing this helper method. The idea is that you give the helper method the ID's of the items to be dropped and the order in which they'll be dropped. By supplying just the IDs, you won't accidentally drop any valuables; there is no unintended or unwanted behavior. By having the flexibility of providing your own pattern, you'll be able to implement some advanced patterns. 

     

    Personally, I'll be using the "Drunken Walk" Algorithm for generating the drop paths. There are many maze algorithms for you to choose from. Alternatively, it would certainly be acceptable to have a few hard coded drop paths.

     

    Here is an example of a drop path that you could use:

    int dropOrder[] = {0,1,2,3,7,6,5,4,8,9,10,11,15,14,13,12,16,17,18,19,23,22,21,20,24,25,26,27};

    JN4xpAU.jpg

     

    Here's the method:

    public void dropOnlyThese (Integer[] droppables, int[] dropOrder) {
    	// the grid construction should be in your constructor.
    	// this is for the sake of example
    	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 = getMouse();
    	Instance instance = getClient().getInstance();
    	Canvas canvas = instance.getCanvas();
    	Inventory inventory = getInventory();
    	
    	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(250); // randomize & speed this up
    		} 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);
    }
    

    And example usage:

    Integer[] droppables = {11328, 11330, 11332}; // Leaping trout, salmon, sturgeon
    int dropOrder[] = {0,1,2,3,7,6,5,4,8,9,10,11,15,14,13,12,16,17,18,19,23,22,21,20,24,25,26,27};
    dropOnlyThese(droppables, dropOrder);

     I hope many of you can make good use of this. How would you generate the drop pattern?

    Link to comment
    Share on other sites

    • 1 year later...
    • 1 month later...
    • 11 months later...
    • 1 month later...
    On 9/1/2017 at 8:44 PM, century said:

     

    I think the users will thank me at the end of the day when this feature reduces their ban rates.

    I know this post is dead, but this day has come!
    Thank you sir.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.