Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @Author Fall3n
- *
- * If moving, waits to arrive to a specified distance of your destination.
- *
- * @param dist - waits until reached this distance. If < 0; waits until the
- * destination is visible on the screen.
- * @param timeout - the max amount of time to wait.
- * @return True if reached the distance to your destination.
- */
- private boolean waitToGetClose(int dist, int timeout) {
- long start = System.currentTimeMillis();
- if(!waitToMove(random(800,1400))) {
- return false;
- }
- while (System.currentTimeMillis() - start < timeout) {
- if(dist >= 0) {
- if(walking.getDestination() != null) { //If destination == null; You're there/It's unreachable.
- try {
- if (calc.distanceTo(walking.getDestination()) <= dist) {
- return true;
- }
- } catch (Exception e) {
- log.severe("Failed to get destination.");
- }
- } else {
- return true;
- }
- } else {
- if(walking.getDestination() != null) { //If destination == null; You're there/It's unreachable.
- try {
- if (calc.tileOnScreen(walking.getDestination())) {
- return true;
- }
- } catch (Exception e) {
- log.severe("Failed to get destination.");
- }
- } else {
- return true;
- }
- }
- sleep(100);
- }
- return false;
- }
- private void randomStuff(RSTile[] path) {
- if(random(0,25) == random(0,25)) {
- walking.walkPathMM(path, 1, 1);
- }
- if(random(0,10) == random(0,10)) {
- mouse.moveRandomly(100);
- }
- if(random(0,15) == random(0,15)) {
- camera.setAngle(random(0,360));
- }
- if(random(0,15) == random(0,15)) {
- game.openTab(random(0,17));
- sleep(random(300,1000));
- game.openTab(Game.TAB_INVENTORY);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement