Xero 2 Share Posted April 3, 2016 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: 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 More sharing options...
Hashtag 8671 Share Posted April 3, 2016 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 More sharing options...
Xero 2 Author Share Posted April 3, 2016 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 More sharing options...
Pug 130 Share Posted April 3, 2016 sleepUntil(() -> Desired event happens, 2500); e.g: sleepUntil(() -> object.isOnScreen(), 2500); Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted April 3, 2016 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.