MovementAPI
Walk to a tile, and read run energy, run and stamina.
ClassRLPlugins API
public class MovementAPIwalkToWorldPoint(…) sends one walk click, as if you clicked that tile on the minimap; the game finds the path. Check isMoving() or your position on later ticks and click again only when you need a new destination.
Example
private static final WorldPoint FOUNTAIN = new WorldPoint(3212, 3428, 0);
@Subscribe
public void onGameTick(GameTick tick) {
if (!GameAPI.isLoggedIn() || MovementAPI.isMoving()) {
return;
}
if (PlayerEx.getLocal().getWorldPoint().distanceTo(FOUNTAIN) > 2) {
MovementAPI.walkToWorldPoint(FOUNTAIN);
}
}Members
Static methods
- booleancanPathTo(WorldPoint)
Checks if there is a path from the local player's world point to the target world point.
- booleancanPathTo(WorldPoint, WorldPoint)
Checks if there is a path from the current world point to the target world point.
- voidcardinalWalk(WorldPoint)
Walks in cardinal directions (N, S, E, W) towards the target world point until a reachable point is found.
- voidcardinalWalk(WorldArea, int)
Walks in cardinal directions (N, S, E, W) away from the target world area until a reachable point is found.
- booleanclickCurrentTile()
Sends one exact current-tile walk action.
- WorldPointgetDestinationWorldPoint()
Gets the destination world point of the player.
- WorldPointgetPredictedNextTickLocation()
Predicts one queued movement tick toward the known destination using the player's collision view.
- WorldPointgetPredictedNextTickLocation(boolean)
Honors the Ctrl modifier recorded for the active walk click, which reverses walk/run.
- intgetRunEnergy()
Your run energy.
- booleanisMoving()
Whether you are walking to a tile you have not reached yet.
- booleanisRunEnabled()
Whether run is switched on.
- booleanstaminaInEffect()
Whether a stamina potion is active.
- voidtoggleRun()
Toggles the run orb.
- voidwalk(int, int)
Compatibility alias for legacy callsites.
- voidwalkAproxWorldPoint(WorldPoint, int)
Walks to a random point within the specified radius of the given world point.
- voidwalkRelativeToWorldPoint(int, int)
Walks to a point relative to the player's current world position.
- booleanwalkTowards(WorldPoint)
Walks towards the specified world point, if the distance is greater than 100, it will walk to a point 100 units away in the direction of the target.
- voidwalkToWorldPoint(WorldPoint)
Walks to a tile.
- voidwalkToWorldPoint(WorldPoint, boolean)
Walks to the specified world point.
- voidwalkToWorldPoint(int, int)
Walks to a tile on your current plane.
- voidwalkToWorldPoint(int, int, boolean)
Walks to a world position. The last value says whether Ctrl is held for the click.
canPathTo(WorldPoint)static
public static boolean canPathTo(WorldPoint target)Checks if there is a path from the local player's world point to the target world point.
Parameters
target- The target world point.
Returns
True if there is a path, false otherwise.
canPathTo(WorldPoint, WorldPoint)static
public static boolean canPathTo(WorldPoint current, WorldPoint target)Checks if there is a path from the current world point to the target world point.
Parameters
current- The current world point.
target- The target world point.
Returns
True if there is a path, false otherwise.
cardinalWalk(WorldPoint)static
public static void cardinalWalk(WorldPoint target)Walks in cardinal directions (N, S, E, W) towards the target world point until a reachable point is found.
Parameters
target- The target world point to walk towards.
cardinalWalk(WorldArea, int)static
public static void cardinalWalk(WorldArea target, int distance)Walks in cardinal directions (N, S, E, W) away from the target world area until a reachable point is found.
Parameters
target- The target world area to walk away from.
distance- The distance to walk away from the target area.
clickCurrentTile()static
public static boolean clickCurrentTile()Sends one exact current-tile walk action.
Unlike normal pathing this does not discard a destination equal to the local tile. It is intended for a strictly idle owner that needs a harmless in-game activity pulse.
Returns
True when the current-tile action was dispatched.
getDestinationWorldPoint()static
public static WorldPoint getDestinationWorldPoint()Gets the destination world point of the player.
Returns
The destination world point of the player, or null if none.
getPredictedNextTickLocation()static
public static WorldPoint getPredictedNextTickLocation()Predicts one queued movement tick toward the known destination using the player's collision view.
Running advances two successive tiles. Returns null without a player, or the current tile when movement, destination or collision data is unavailable; it does not infer an interaction target.
getPredictedNextTickLocation(boolean)static
public static WorldPoint getPredictedNextTickLocation(boolean controlClick)Honors the Ctrl modifier recorded for the active walk click, which reverses walk/run.
Parameters
controlClick- Control click.
getRunEnergy()static
public static int getRunEnergy()Your run energy.
Returns
Run energy from 0 to 100.
isMoving()static
public static boolean isMoving()Whether you are walking to a tile you have not reached yet.
Returns
true while the game has a walk destination that is not your tile.
isRunEnabled()static
public static boolean isRunEnabled()Whether run is switched on.
Returns
true when run is on.
staminaInEffect()static
public static boolean staminaInEffect()Whether a stamina potion is active.
Returns
true while the stamina effect lasts.
toggleRun()static
public static void toggleRun()Toggles the run orb.
walk(int, int)static
public static void walk(int worldX, int worldY)Compatibility alias for legacy callsites.
Parameters
worldX- World x.
worldY- World y.
walkAproxWorldPoint(WorldPoint, int)static
public static void walkAproxWorldPoint(WorldPoint worldPoint, int radius)Walks to a random point within the specified radius of the given world point.
Parameters
worldPoint- The world point to walk to.
radius- The radius around the world point to walk to.
walkRelativeToWorldPoint(int, int)static
public static void walkRelativeToWorldPoint(int offsetX, int offsetY)Walks to a point relative to the player's current world position.
Parameters
offsetX- The x offset from the player's current position.
offsetY- The y offset from the player's current position.
walkTowards(WorldPoint)static
public static boolean walkTowards(WorldPoint worldPoint)Walks towards the specified world point, if the distance is greater than 100, it will walk to a point 100 units away in the direction of the target.
Parameters
worldPoint- The world point to walk towards.
Returns
True if the player is within 100 units of the target, false otherwise.
walkToWorldPoint(WorldPoint)static
public static void walkToWorldPoint(WorldPoint worldPoint)Walks to a tile.
The same as walkToWorldPoint(int, int) with the point's X and Y.
Parameters
worldPoint- The tile to walk to. Its plane is ignored: you walk on your current plane.
walkToWorldPoint(WorldPoint, boolean)static
public static void walkToWorldPoint(WorldPoint worldPoint, boolean ctrlDown)Walks to the specified world point.
Compatibility overload that preserves ctrl modifier behavior.
Parameters
worldPoint- The world point to walk to.
ctrlDown- Whether control is pressed.
walkToWorldPoint(int, int)static
public static void walkToWorldPoint(int worldX, int worldY)Walks to a tile on your current plane.
Sends one walk click; the game finds the path. Nothing happens if you already stand on the tile or are already walking to it.
Parameters
worldX- World X coordinate of the tile.
worldY- World Y coordinate of the tile.
- Pick a tile in the area around you. Walk a long trip in steps.
MovementAPI.walkToWorldPoint(3212, 3428);walkToWorldPoint(int, int, boolean)static
public static void walkToWorldPoint(int worldX, int worldY, boolean ctrlDown)Walks to a world position. The last value says whether Ctrl is held for the click.
Parameters
worldX- World x.
worldY- World y.
ctrlDown- Ctrl down.
Also allowed
Every class has these, as in plain Java.
equals, toString