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

    Recommended Posts

    Posted

    Hey guys, trying to wrap my head around tick manipulation in Dreambot.

     

    I've tried to use the Inventory management to product this but it doesn't seem to work - my guess is the delay the built in Inventory actions have. 
    Does anyone have any tips about this? Do i need to do it manually through the Mouse api or the Gui api?

    This is what i tried:
     

            Item knife = Inventory.getRandom("Knife");
            Item teakLogs = Inventory.getRandom("Teak Logs");
                if (knife != null && teakLogs != null) {
                    knife.interact();
                    teakLogs.interact();
                    if (otherAction) {
                        Walking.walk(Players.getLocal().getTile().getRandomized(1));
                    }
                } 
    
    also tried
    
            Item knife = Inventory.getRandom("Knife");
            Item teakLogs = Inventory.getRandom("Teak Logs");
                if (knife != null && teakLogs != null) {
                    knife.useOn(teakLogs);
                    if (otherAction) {
                        Walking.walk(Players.getLocal().getTile().getRandomized(1));
                    }
                }


    Any pointers appreciated!

    Posted

    IDK what otherAction is but the first thing I'd suggest is you might want to use a delay in between interacting. You can use a something like sleepUntil(()->Inventory().isItemSelected(), 300, 1) then sleepUntil(()->!Inventory().isItemSelected(), 300, 1). This might actually not matter but I like to do it after actions just in-case, so it doesn't miss any future actions.

    Next, setting up a timer with the game ticks is essential for tick manipulation. You can get that by Client.getGameTick().

    Next as you stated was delays, not only delays but mouse movement. Depending on mouse speed and how far the mouse is from its destination you can easily miss a tick. To avoid this, you could "hop" the mouse to the points that you need to ensure you hit the target on the exact tick you need. This would be  Mouse.hop(knife.getDestination().getCentralPoint()) then you can knife.interact("Use") or even just Mouse.click(). Your other option would be trying to place the mouse really close to where it has to click BEFORE the tick happens. Here, instead of Mouse.hop(targetPoint) you can use Mouse.move(targetPoint).

    I barely installed/started digging through the API this morning so it might be a little off, but the concept should be solid. I've made a 3 tick barb fisher and granite like 6 months ago on another API so if you have any more questions, I'd be more than happy to help.

    • 4 months later...
    Posted
    do{
    	Inventory.use("Knife");
    	sleep(300,900);
    	Inventory.use("Teak logs");
    	sleep(300,900);
    	Inventory.use(Teak logs);
    	sleep(300,900);
    	Inventory.use("Knife");
    }while(Inventory.contains("Teak logs"));

    Making sure that the sleep timer is set to 1 tick, and a little extra then 1 tick, So if it always takes 300 ms to conduct the transaction of Teak logs to w/e I would 300,900 at random or even less then 900, because Code is spot on with the game tick yet your not. What means is you have to wait for your eyes to see that changed item. yet what you want is to always 1 tick, yet for a player it is impossible to have the same tick rate. Meaning if used sleepUntill(); it will release me when that item has changed, yet the game has not delivered to my eyes of that changed item.

    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
    ×
    ×
    • 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.