Xero 2 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?
Hashtag 9077 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
Xero 2 Author 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).
Pug 130 Posted April 3, 2016 sleepUntil(() -> Desired event happens, 2500); e.g: sleepUntil(() -> object.isOnScreen(), 2500);
Diddy 265 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)); } }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.