Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. /**
  2. * @Author Fall3n
  3. *
  4. * If moving, waits to arrive to a specified distance of your destination.
  5. *
  6. * @param dist - waits until reached this distance. If < 0; waits until the
  7. * destination is visible on the screen.
  8. * @param timeout - the max amount of time to wait.
  9. * @return True if reached the distance to your destination.
  10. */
  11. private boolean waitToGetClose(int dist, int timeout) {
  12. long start = System.currentTimeMillis();
  13. if(!waitToMove(random(800,1400))) {
  14. return false;
  15. }
  16. while (System.currentTimeMillis() - start < timeout) {
  17. if(dist >= 0) {
  18. if(walking.getDestination() != null) { //If destination == null; You're there/It's unreachable.
  19. try {
  20. if (calc.distanceTo(walking.getDestination()) <= dist) {
  21. return true;
  22. }
  23. } catch (Exception e) {
  24. log.severe("Failed to get destination.");
  25. }
  26. } else {
  27. return true;
  28. }
  29. } else {
  30. if(walking.getDestination() != null) { //If destination == null; You're there/It's unreachable.
  31. try {
  32. if (calc.tileOnScreen(walking.getDestination())) {
  33. return true;
  34. }
  35. } catch (Exception e) {
  36. log.severe("Failed to get destination.");
  37. }
  38. } else {
  39. return true;
  40. }
  41. }
  42. sleep(100);
  43. }
  44. return false;
  45. }
  46.  
  47.  
  48. private void randomStuff(RSTile[] path) {
  49. if(random(0,25) == random(0,25)) {
  50. walking.walkPathMM(path, 1, 1);
  51. }
  52. if(random(0,10) == random(0,10)) {
  53. mouse.moveRandomly(100);
  54. }
  55. if(random(0,15) == random(0,15)) {
  56. camera.setAngle(random(0,360));
  57. }
  58. if(random(0,15) == random(0,15)) {
  59. game.openTab(random(0,17));
  60. sleep(random(300,1000));
  61. game.openTab(Game.TAB_INVENTORY);
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement