Docs · tiles

tiles

12 tiles commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

approachable needs routeAvailable() returns bool
approachable(target: tile) -> bool

Whether the client can get you to this tile, standing on it or beside it. This is the question to ask about a rock, a tree or a bank booth: reachable() asks whether you can stand ON the tile, which is false for every solid object in the game. For an object you already have a handle to, approach(rock) does this and the walking together.

ParameterTypeWhat it does
targetrequired tile the tile you want to get to
Example
if approachable(tile(303, 553)) { walkTo(tile(303, 553)) }
distance returns int
distance(one: tile, other: tile) -> int

Straight-line distance in tiles, truncated. Ignores walls. This is what the nearest- queries sort by, so it is the one to use when a script wants to agree with them.

ParameterTypeWhat it does
onerequired tile the first tile
otherrequired tile the second tile
Example
if distance(tile(303, 553), tile(285, 570)) > 20 { stop }
path needs routeAvailable() returns list<tile>
path(destination: tile) -> list<tile>

The way there, in the order you would walk it. Turn points rather than every tile, the destination last, and empty when there is no way there.

ParameterTypeWhat it does
destinationrequired tile where you want to stand
Example
for corner in path(tile(285, 570)) { walkTo(corner) }
reachable needs routeAvailable() returns bool
reachable(destination: tile) -> bool

Whether the client can find any way to stand on this tile. Says nothing about why not — a wall, a door and a tile outside the loaded region all answer false.

ParameterTypeWhat it does
destinationrequired tile where you want to stand
Example
if reachable(tile(303, 553)) { walkTo(tile(303, 553)) }
routeAvailable returns bool
routeAvailable() -> bool

Whether the client's pathfinder is reachable. False means reachable, steps and path all answer as though nowhere can be walked to.

Example
if not routeAvailable() { stop }
steps needs routeAvailable() returns int
steps(destination: tile) -> int

How many tiles you would have to walk to stand there. Zero when you are already on it, -1 when there is no way at all. This counts tiles walked, not the turn points the client reports.

ParameterTypeWhat it does
destinationrequired tile where you want to stand
Example
if steps(tile(285, 570)) > 20 { stop }
stepsBetween returns int
stepsBetween(one: tile, other: tile) -> int

How many steps apart two tiles are if nothing were in the way, counting a diagonal as one step. Free and often wrong; steps() asks the client's own pathfinder and is always right.

ParameterTypeWhat it does
onerequired tile the first tile
otherrequired tile the second tile
Example
if stepsBetween(tile(303, 553), tile(285, 570)) <= 3 { stop }
tile returns tile
tile(x: int, y: int) -> tile

A position in the world. Always world coordinates, never the client's region-local ones.

ParameterTypeWhat it does
xrequired int how far east, in world coordinates
yrequired int how far north, in world coordinates
Example
walkTo(tile(303, 553))
tileOnScreen needs tilesAvailable() returns bool
tileOnScreen(target: tile) -> bool

Whether that patch of ground is drawn where it could be clicked. This is what decides whether walkTo clicks the ground or falls back to the minimap.

ParameterTypeWhat it does
targetrequired tile the tile to look for
Example
if tileOnScreen(tile(303, 553)) { walkScreen(tile(303, 553)) }
tilesAvailable returns bool
tilesAvailable() -> bool

Whether the hooks that turn a tile into a patch of ground on screen are published. False means tileOnScreen and walkScreen cannot work.

Example
if not tilesAvailable() { stop }
translate returns tile
translate(from: tile, dx: int, dy: int) -> tile

The tile that many squares away.

ParameterTypeWhat it does
fromrequired tile the tile to move from
dxrequired int how far east, negative for west
dyrequired int how far north, negative for south
Example
walkTo(translate(tile(303, 553), 0, 2))
within returns bool
within(one: tile, other: tile, range: int) -> bool

Whether two tiles are that close in a straight line. The same measure distance() uses.

ParameterTypeWhat it does
onerequired tile the first tile
otherrequired tile the second tile
rangerequired int how many tiles apart at most
Example
if within(tile(303, 553), tile(303, 555), 3) { stop }