Guest User

Untitled

a guest
Jul 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. // method for walking rstile[] paths, since walkpathmm isnt working for me
  2. public void walkPath(RSTile path[])
  3. {
  4. int a = 0;
  5. for (int f = 1; f < path.length; ++f)
  6. {
  7. if (logDebug)
  8. log("[Debug] Calculating tile to start with.");
  9. if (f == (path.length - 1))
  10. continue;
  11. if (distanceBetween(getMyPlayer().getLocation(), path[f]) < distanceBetween(getMyPlayer().getLocation(), path[f + 1])
  12. && distanceBetween(getMyPlayer().getLocation(), path[f]) < distanceBetween(getMyPlayer().getLocation(), path[f - 1]))
  13. {
  14. if (logDebug)
  15. log("[Debug] Switching nearest tile to: (" + path[f].getX() + ", " + path[f].getY() + ")");
  16. a = f;
  17. }
  18. }
  19. for (int i = a; i < path.length; ++i)
  20. {
  21. if (logDebug)
  22. log("[Debug] Walking to next tile in path: (" + path[i].getX() + ", " + path[i].getY() + ")");
  23. walkTileMM(path[i], 0, 0);
  24. if (logDebug)
  25. log("[Debug] Doing while statement (distBetween player and tile)");
  26. while (distanceBetween(path[i], getMyPlayer().getLocation()) > 3)
  27. {
  28. if (!getMyPlayer().isMoving())
  29. {
  30. wait(random(200, 500));
  31. walkTileMM(path[i], 0, 0);
  32. wait(random(200, 500));
  33. }
  34. wait(random(500, 1000));
  35. }
  36. if (logDebug)
  37. log("[Debug] While statement broken, player must be < 3 dist to tile");
  38. }
  39. }
Add Comment
Please, Sign In to add comment