Interface NavigationAPI
- All Known Subinterfaces:
GameAPI
One script walks at a time
A client has one character, one position, and one server-side action queue that drains a single action per server tick. Two scripts walking the same character therefore cannot both make progress: their per-tile clicks interleave, neither sees the character move toward its own goal, and both re-plan forever from a position neither predicted. So the character is held by one walker at a time:
- A walk request from a script while another script is walking
is refused. It returns immediately without starting anything,
the walk already in progress is left alone, and
getWalkStatus()reports"refused_busy"to the script that was refused. It does not queue and it will not be retried for you — decide in your own script whether to wait and ask again. - Re-targeting your own walk is always allowed: the walk in flight is cancelled and joined, then the new one starts.
walkCancel()only cancels a walk you started. Asking to cancel somebody else's is a no-op, not an error.getWalkStatus()is scoped to the calling script: it reports your walk, or the outcome of your last one — never a sibling script's.- The host, and any
ManagementScriptorchestrating this client, walk with override authority: they may take the character from a script and cancel any walk. This is deliberate — an orchestrator that could not move a character it manages could not do its job.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidInvalidates all cached region collision data.findPath(int toX, int toY) Finds a local A* path between the player and a destination.findPath(int fromX, int fromY, int toX, int toY) Finds a local A* path from a specific origin.findWorldPath(int toX, int toY) Finds a world-scale path without walking it.findWorldPath(int fromX, int fromY, int toX, int toY) Finds a world-scale path from a specific origin without walking it.intReturns the region collision cache size.Returns the walker state for the calling script:walkingwhile its own walk is in flight, otherwise the outcome of its last request —arrived,cancelled,failed,refused_busy, oridleif it has never asked for one.booleanisReachable(int x, int y) Checks if a tile is reachable from the player's current position.booleanisReachable(int x, int y, int maxIterations) Checks if a tile is reachable with a custom iteration limit.voidCancels the walk this script started.default longHow many of the calling script's walk requests have been refused because another script held the character.voidwalkToAsync(int x, int y) Starts a local A* walk to the given tile.default voidwalkWorldPath(int x, int y, int plane) Plane-aware convenience — equivalent towalkWorldPathAsync(x, y, plane).voidwalkWorldPathAsync(int x, int y, int plane) Starts a world-scale walk using HPA*/flat A* with teleport, door, shortcut, and transport support.default voidwalkWorldPathAsync(int x, int y, int plane, boolean exactDestTile) Starts a world-scale walk with exact destination tile control.voidwalkWorldPathAsync(int x, int y, int plane, boolean exactDestTile, WorldPathConfig config) Starts a world-scale walk with full pathfinder configuration.
-
Method Details
-
walkToAsync
void walkToAsync(int x, int y) Starts a local A* walk to the given tile. Returns immediately.Refused, silently and without starting a walk, if another script is already walking this character — check
getWalkStatus()for"refused_busy".- Parameters:
x- target world tile Xy- target world tile Y
-
walkWorldPathAsync
void walkWorldPathAsync(int x, int y, int plane) Starts a world-scale walk using HPA*/flat A* with teleport, door, shortcut, and transport support. Returns immediately.Refused, silently and without starting a walk, if another script is already walking this character — check
getWalkStatus()for"refused_busy".- Parameters:
x- target world tile Xy- target world tile Yplane- target plane (height level)
-
walkWorldPath
default void walkWorldPath(int x, int y, int plane) Plane-aware convenience — equivalent towalkWorldPathAsync(x, y, plane).The no-plane convenience that walks to the local player's current plane lives on
GameAPIbecause it needsgetLocalPlayer(), which isn't part of this navigation surface. -
walkWorldPathAsync
default void walkWorldPathAsync(int x, int y, int plane, boolean exactDestTile) Starts a world-scale walk with exact destination tile control.- Parameters:
x- target world tile Xy- target world tile Yplane- target plane (height level)exactDestTile- iftrue, click the exact destination tile
-
walkWorldPathAsync
Starts a world-scale walk with full pathfinder configuration.Refused, silently and without starting a walk, if another script is already walking this character — check
getWalkStatus()for"refused_busy".- Parameters:
x- target world tile Xy- target world tile Yplane- target plane (height level)exactDestTile- iftrue, click the exact destination tileconfig- pathfinder config overrides, ornullfor defaults
-
walkCancel
void walkCancel()Cancels the walk this script started. A no-op if the walk in progress belongs to another script; the host and management scripts may cancel any walk. -
getWalkStatus
WalkStatus getWalkStatus()Returns the walker state for the calling script:walkingwhile its own walk is in flight, otherwise the outcome of its last request —arrived,cancelled,failed,refused_busy, oridleif it has never asked for one.Never reports a sibling script's walk. The host and management scripts see whichever walk is in progress, whoever started it.
This is a level, so it cannot on its own tell you whether the request you just made was the one refused — an older refusal reads the same. Use
walkRefusalCount()for that.- Returns:
- the walk status
-
walkRefusalCount
default long walkRefusalCount()How many of the calling script's walk requests have been refused because another script held the character.Monotonic and caller-scoped. Read it before a walk request and again after: an increase means that request was refused. This is the reliable way to detect a refusal —
getWalkStatus()reports a level, so a refusal left over from an earlier request is indistinguishable from one caused by this one, and a host or management caller seeswalkingfor whatever walk is in progress rather than its own refusal at all.Implementations that do not track refusals return
0, which simply reads as "never refused".- Returns:
- the refusal count for the calling script, never negative
-
isReachable
boolean isReachable(int x, int y) Checks if a tile is reachable from the player's current position.- Parameters:
x- target world Xy- target world Y- Returns:
trueif the tile is reachable
-
isReachable
boolean isReachable(int x, int y, int maxIterations) Checks if a tile is reachable with a custom iteration limit.- Parameters:
x- target world Xy- target world YmaxIterations- max A* iterations- Returns:
trueif the tile is reachable
-
findPath
Finds a local A* path between the player and a destination.- Parameters:
toX- destination world XtoY- destination world Y- Returns:
- the path result
-
findPath
Finds a local A* path from a specific origin.- Parameters:
fromX- origin world XfromY- origin world YtoX- destination world XtoY- destination world Y- Returns:
- the path result
-
findWorldPath
Finds a world-scale path without walking it.- Parameters:
toX- destination world XtoY- destination world Y- Returns:
- the path result
-
findWorldPath
Finds a world-scale path from a specific origin without walking it.- Parameters:
fromX- origin world XfromY- origin world YtoX- destination world XtoY- destination world Y- Returns:
- the path result
-
getRegionCacheSize
int getRegionCacheSize()Returns the region collision cache size.- Returns:
- the number of cached regions
-
clearRegionCache
void clearRegionCache()Invalidates all cached region collision data.
-