Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // method for walking rstile[] paths, since walkpathmm isnt working for me
- public void walkPath(RSTile path[])
- {
- int a = 0;
- for (int f = 1; f < path.length; ++f)
- {
- if (logDebug)
- log("[Debug] Calculating tile to start with.");
- if (f == (path.length - 1))
- continue;
- if (distanceBetween(getMyPlayer().getLocation(), path[f]) < distanceBetween(getMyPlayer().getLocation(), path[f + 1])
- && distanceBetween(getMyPlayer().getLocation(), path[f]) < distanceBetween(getMyPlayer().getLocation(), path[f - 1]))
- {
- if (logDebug)
- log("[Debug] Switching nearest tile to: (" + path[f].getX() + ", " + path[f].getY() + ")");
- a = f;
- }
- }
- for (int i = a; i < path.length; ++i)
- {
- if (logDebug)
- log("[Debug] Walking to next tile in path: (" + path[i].getX() + ", " + path[i].getY() + ")");
- walkTileMM(path[i], 0, 0);
- if (logDebug)
- log("[Debug] Doing while statement (distBetween player and tile)");
- while (distanceBetween(path[i], getMyPlayer().getLocation()) > 3)
- {
- if (!getMyPlayer().isMoving())
- {
- wait(random(200, 500));
- walkTileMM(path[i], 0, 0);
- wait(random(200, 500));
- }
- wait(random(500, 1000));
- }
- if (logDebug)
- log("[Debug] While statement broken, player must be < 3 dist to tile");
- }
- }
Add Comment
Please, Sign In to add comment