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
  • Dialogue and SleepUntil Questions


    Xero

    Recommended Posts

    Hello!
     

    For my first script, I'm creating a tutorial island bot. In order to run through the dialogues quickly I use the
     

    getDialogues().clickContinue();
    

    method.
     

    As seen in this photo here:

    666e5a1e4ab0ececedadbc3cc7282999.png

     

    The bot does not know what to do. The code above works for NPCs. 

     

     

     

    Secondly, I want to be able to sleep until my character reaches a desired location. In order to accomplish this, I've done the following:
     

    
    Tile t = treeArea.getRandomTile();
    long startTime = System.currentTimeMillis();
    sleepUntil(() -> this.getLocalPlayer().getTile() == t, 9000);
    long endTime = System.currentTimeMillis();
    log("Player: " + this.getLocalPlayer().getTile() + "Wanted Tile" + t + "Took: " + (endTime - startTime));
    

    However, the code ends up executing for the full 9000ms as opposed to when it actually reaches it's target (Should be around 5000).

     

    Any suggestions?

    Link to comment
    Share on other sites

    I'm not sure but try using .equals not ==

     

    And I think the clickcontinue thingy doesn't work for that because it doesn't look like it's regular dialogue. Try using widgets instead.

    And there is a Timer class that is more useful than getcurrenttimemillis

    Link to comment
    Share on other sites

    Thank you!

    For those who have any similar issues, here's how I coded the solution:
     

    this.getWidgets().getChildWidget(162, 33).interact();
    

    Also I replaced == with equals (Forgot that when not dealing with numbers you have to use this haha).

    Link to comment
    Share on other sites

    sleepUntil(() -> Desired event happens, 2500);

    e.g:

    sleepUntil(() -> object.isOnScreen(), 2500);
    
    Link to comment
    Share on other sites

    this is how I walk

    private void myWalk(Tile tile) {
    		if (getWalking().walk(tile.getRandomizedTile())) {
    			sleep(Calculations.random(1500, 2500));
    			sleepUntil(
    					() -> !getLocalPlayer().isMoving()
    							|| getLocalPlayer().distance(
    									getClient().getDestination()) < Calculations.random(
    									7, 12), Calculations.random(4200, 6000));
    		}
    	}
    
    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

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