WorldPoint

Build a tile and do arithmetic on it.

Methods
27
Fields
3

Getting one

player:tile()
player:trueTile()
WorldPoint.new(…)

Methods

MethodReturnsDescription
getX()numberWorld x.
getY()numberWorld y.
getPlane()numberThe plane, 0 being ground level.
dx(number)WorldPointThis point moved dx tiles east; the add wraps at 32 bits.
dy(number)WorldPointThis point moved dy tiles north; the add wraps at 32 bits.
dz(number)WorldPointThis point moved dz planes up. Not clamped to 0-3.
distanceTo(WorldPoint)number(WorldPoint, WorldPoint) -> number: The Chebyshev distance to other, or 2147483647 when the planes differ.
distanceTo(WorldArea)number
distanceTo2D(WorldPoint)numberThe Chebyshev distance to other, ignoring the plane.
getRegionID()numberThe id of the 64x64 region holding this tile: x >> 6 << 8 | y >> 6.
getRegionX()numberThe x within the region, 0-63.
getRegionY()numberThe y within the region, 0-63.
toWorldArea()WorldAreaThe 1x1 area of this tile.
isInArea(...WorldArea)booleanWhether any of the areas contains this tile. Pass the areas as arguments, or one array of them.
isInArea2D(...WorldArea)booleanWhether any of the areas contains this tile, ignoring planes.
isInScene(Client)booleanWhether this tile is on the player's plane and in the loaded scene (deprecated). Pass the client global; it reads the running callback's…
equals(any)booleanWhether other is the same tile. == answers the same.
hashCode()numberA hash of x, y and plane.
toString()stringWorldPoint(x=3200, y=3200, plane=0). tostring(wp) answers the same.
new(number, number, number)WorldPointThe tile x, y on plane: vector(x, y, plane).
fromCoord(number)WorldPointA tile from a packed Jagex coordinate, plane << 28 | x << 14 | y.
fromRegion(number, number, number, number)WorldPointThe tile at regionX, regionY in region regionId.
getMirrorPoint(WorldPoint, boolean)WorldPointThe same tile in a mirrored region's other copy (Prifddinas); any other tile unchanged.
fromLocal(Client, LocalPoint)WorldPointThe tile holding local, on its world view's plane. Pass the client global. Raises with no scene loaded (the client's plane cannot be re…
fromLocalInstance(Client, LocalPoint)WorldPoint(Client, LocalPoint) -> WorldPoint: The tile holding local with instancing undone: in an instance, the template tile it was copied from…
fromLocalInstance(Client, LocalPoint, number)WorldPoint
fromLocalInstance(Scene, LocalPoint, number)WorldPoint
fromLocalMainWorld(Client, LocalPoint)WorldPoint?The real-world tile holding local, whichever world view it is in: a point on a boat through its entity's transformToMainWorld first, an…
fromScene(Client, number, number, number)WorldPoint(Client, number, number, number) -> WorldPoint: Scene tile to world tile, against the top-level world view.
fromScene(WorldView, number, number, number)WorldPoint
toLocalInstance(Client, WorldPoint){WorldPoint}(Client, WorldPoint) -> {WorldPoint}: Every scene tile that is a copy of this template tile (an instance can use one chunk several times)…
toLocalInstance(Scene, WorldPoint){WorldPoint}
toLocalInstance(WorldView, WorldPoint){WorldPoint}

Fields

FieldTypeDescription
xnumberWorld x: Luau's own vector component read, the same number as getX().
ynumberWorld y: Luau's own vector component read, the same number as getY().
znumberThe plane: Luau's own vector component read, the same number as getPlane().

Returned by

MethodReturnsDescription
Actor.getWorldLocationWorldPointThe server-side tile: the head of the actor's path in its world view, plus that view's base, on its plane. Ahead of where it renders while…
AgilityShortcut.getWorldLocationWorldPoint?This constant's getWorldLocation() value, listed on each constant.
AgilityShortcut.getWorldMapLocationWorldPoint?This constant's getWorldMapLocation() value, listed on each constant.
Client.getHintArrowPointWorldPoint?The tile a coordinate hint arrow points at; nil for any other type.
HazardField.blockedTiles{ WorldPoint }Every tile a group blocks at a tick. For an overlay, not a hot path.
ItemLayer.getWorldLocationWorldPointIts tile's world location.
NpcSimClass.safespots{WorldPoint}Safe tiles within radius (at most 30) of the player, nearest first. With attackRange, only tiles the player can hit a stalled NPC from:…
NpcSimClass.tileAtWorldPoint?Where npc stands at tick (its south-west tile); nil when lost, not simulated, or past the latest rollout. The first of several when the…
NpcSimClass.tilesAt{WorldPoint}Every tile npc may stand on at tick; empty where tileAt is nil.
PathQuery.destinationWorldPoint?Where the route ends (the bank tile for toNearestBank, the target reached for plan), or nil until answered.
PathQuery.startWorldPoint?Where the route begins (for plan, the cheapest of its starts), or nil until a route is found.
PlayerDomain.tileWorldPoint?The tile the local player stands on, in the coordinates of the scene loaded now. Inside an instance this is the instance's tile, the space…
PlayerDomain.trueTileWorldPoint?The tile the local player stands on in the real world: inside an instance, the map tile the instance was copied from.
Projectile.getSourcePointWorldPointThe world tile it starts at.
Projectile.getTargetPointWorldPointThe world tile it ends at.
Reachability.cameFromWorldPoint?The tile stepped from to reach one tile, for walking a path back without holding the whole map.
Reachability.pathTo{ WorldPoint }The full walk to a tile.
Reachability.pathToArea{ WorldPoint }The walk to a tile that fronts an area.
Reachability.pathToward{ WorldPoint }The walk toward a tile: the path to it, or when it cannot be reached the path to the closest tile the flood did reach. pathTo is the one…
Reachability.reachableAdjacentTiles{ WorldPoint }Every reachable tile touching an area -- the tiles to stand on to use it.
Reachability.reachableTileWithinRangeWorldPoint?A tile to stand on to attack an area from within a range.
Reachability.sourceWorldPointThe tile the flood was run from.
Reachability.tilesAtCost{ WorldPoint }Every tile at EXACTLY this step cost -- the ring. tilesWithinCost is the disc.
Reachability.tilesInSight{ WorldPoint }Every tile within a radius that an origin can see.
Reachability.tilesWithinCost{ WorldPoint }Every tile within a step budget of the local player.
ReachClass.blockingTiles{WorldPoint}?The tiles of removable to clear, in walk order, to reach any tile of goals from the player ("next to any vein", "any attack position":…
ReachClass.blockingTilesTo{WorldPoint}?The same, to one target tile, and empty whenever target is reachable by a normal walk.
ReachClass.blockingTilesToArea{WorldPoint}?The same, to any tile of area, and empty whenever one of them is reachable by a normal walk.
SceneDomain.aggressionCenters{ WorldPoint }The current NPC aggression area's safe centers, oldest first: none until the client has calibrated (a teleport or a long run), then one or…
Tile.getWorldLocationWorldPointIts world tile, on its plane (getPlane(): for the tile a bridge hides, the plane it is on, read from the tile itself).
TileObject.getWorldLocationWorldPointThe world tile of the object, against its world view's current base: for a game object the middle of its footprint rounded to the south-wes…
TimedSearch.bestOfWorldPoint?The cheapest reachable tile among several. A longer, safer way round can win, which is the point of asking rather than measuring distance.
TimedSearch.cameFromWorldPoint?The tile stepped from to reach one tile.
TimedSearch.clickTileWorldPoint?The farthest tile on the route whose NATURAL walk still matches the plan: click it and the engine's own pathing follows the route you chose…
TimedSearch.pathTo{ WorldPoint }Landed tiles from the source to a tile, source excluded.
TimedSearch.pathToFull{ WorldPoint }Every tile of the route, landed and passed over. Hazard checks want this one; a two-tile move is lethal if either of its tiles is.
TimedSearch.pathToward{ WorldPoint }The walk toward a tile: the route to it, or when it cannot be reached the route to the closest tile the flood did reach. pathTo is the on…
TimedSearch.sourceWorldPoint?The tile this flood was run from.
WorldArea.toWorldPointWorldPointThe south-west corner.
WorldArea.toWorldPointList{WorldPoint}Every tile, column by column (x outer, y inner), as a 1-based array.
WorldMapIcon.getCoordinateWorldPointThe icon's tile on the map's surface (the region's origin times 64 plus its tile).
WorldMapPoint.getTargetWorldPoint?Where "Focus on" scrolls the map (nil: the point's own tile).
WorldMapPoint.getWorldPointWorldPoint?The tile the image is drawn at.
WorldPointClass.fromCoordWorldPointA tile from a packed Jagex coordinate, plane << 28 | x << 14 | y.
WorldPointClass.fromLocalWorldPointThe tile holding local, on its world view's plane. Pass the client global. Raises with no scene loaded (the client's plane cannot be re…
WorldPointClass.fromLocalInstanceWorldPoint(Client, LocalPoint) -> WorldPoint: The tile holding local with instancing undone: in an instance, the template tile it was copied from…
WorldPointClass.fromLocalMainWorldWorldPoint?The real-world tile holding local, whichever world view it is in: a point on a boat through its entity's transformToMainWorld first, an…
WorldPointClass.fromRegionWorldPointThe tile at regionX, regionY in region regionId.
WorldPointClass.fromSceneWorldPoint(Client, number, number, number) -> WorldPoint: Scene tile to world tile, against the top-level world view.
WorldPointClass.getMirrorPointWorldPointThe same tile in a mirrored region's other copy (Prifddinas); any other tile unchanged.
WorldPointClass.newWorldPointThe tile x, y on plane: vector(x, y, plane).
WorldPointClass.toLocalInstance{WorldPoint}(Client, WorldPoint) -> {WorldPoint}: Every scene tile that is a copy of this template tile (an instance can use one chunk several times)…

Method details

distanceTo

distanceTo: ((WorldPoint, WorldPoint) -> number) & ((WorldPoint, WorldArea) -> number)

(WorldPoint, WorldPoint) -> number: The Chebyshev distance to other, or 2147483647 when the planes differ.

(WorldPoint, WorldArea) -> number: The shortest distance to any tile of other, or 2147483647 when it is on another plane.

getRegionID

getRegionID: (WorldPoint) -> number

The id of the 64x64 region holding this tile: x >> 6 << 8 | y >> 6.

isInArea

isInArea: (WorldPoint, ...WorldArea) -> boolean

Whether any of the areas contains this tile. Pass the areas as arguments, or one array of them.

isInScene

isInScene: (WorldPoint, Client) -> boolean

Whether this tile is on the player's plane and in the loaded scene (deprecated). Pass the client global; it reads the running callback's client.

equals

equals: (WorldPoint, any) -> boolean

Whether other is the same tile. == answers the same.

toString

toString: (WorldPoint) -> string

WorldPoint(x=3200, y=3200, plane=0). tostring(wp) answers the same.

new

new: (number, number, number) -> WorldPoint

The tile x, y on plane: vector(x, y, plane).

fromCoord

fromCoord: (number) -> WorldPoint

A tile from a packed Jagex coordinate, plane << 28 | x << 14 | y.

fromRegion

fromRegion: (number, number, number, number) -> WorldPoint

The tile at regionX, regionY in region regionId.

fromLocal

fromLocal: (Client, LocalPoint) -> WorldPoint

The tile holding local, on its world view's plane. Pass the client global. Raises with no scene loaded (the client's plane cannot be read) and when local's world view is no longer loaded; fromLocalMainWorld answers nil for both.

fromLocalInstance

fromLocalInstance: ((Client, LocalPoint) -> WorldPoint) & ((Client, LocalPoint, number) -> WorldPoint) & ((Scene, LocalPoint, number) -> WorldPoint)

(Client, LocalPoint) -> WorldPoint: The tile holding local with instancing undone: in an instance, the template tile it was copied from. Pass the client global. Raises with no scene loaded (the client's plane cannot be read) and when local's world view is no longer loaded; fromLocalMainWorld answers nil for both, and converts a boat's point too.

(Client, LocalPoint, number) -> WorldPoint: fromLocalInstance on the given plane. Raises as it does.

(Scene, LocalPoint, number) -> WorldPoint: The tile holding localPoint with instancing undone, against scene's own world view: in an instance, the template tile it was copied from; otherwise the tile on plane. A scene whose world view is no longer loaded raises.

fromLocalMainWorld

fromLocalMainWorld: (Client, LocalPoint) -> WorldPoint?

The real-world tile holding local, whichever world view it is in: a point on a boat through its entity's transformToMainWorld first, and instancing undone either way (the template tile an instance's tile was copied from). What to measure from, or test against a zone written in template coordinates. nil when it cannot be told: no scene loaded, local's world view or its entity gone, or a client whose table does not place the entity's fields. Never raises for those, so a per-tick caller needs no guard. The reverse is LocalPoint.fromWorldInstance.

fromScene

fromScene: ((Client, number, number, number) -> WorldPoint) & ((WorldView, number, number, number) -> WorldPoint)

(Client, number, number, number) -> WorldPoint: Scene tile to world tile, against the top-level world view.

(WorldView, number, number, number) -> WorldPoint: Scene tile x, y of world view wv to the world tile on plane: x + wv:getBaseX(), y + wv:getBaseY(). A world view that is no longer loaded raises.

toLocalInstance

toLocalInstance: ((Client, WorldPoint) -> {WorldPoint}) & ((Scene, WorldPoint) -> {WorldPoint}) & ((WorldView, WorldPoint) -> {WorldPoint})

(Client, WorldPoint) -> {WorldPoint}: Every scene tile that is a copy of this template tile (an instance can use one chunk several times); outside an instance the tile itself if the scene holds it. Empty with no scene loaded.

(Scene, WorldPoint) -> {WorldPoint}: Every tile of scene that is a copy of this template tile, ordered by plane, then chunk x, then chunk y; outside an instance the tile itself if it lies in the scene's 104-tile square, whatever its plane (deprecated). Empty when its world view is no longer loaded.

(WorldView, WorldPoint) -> {WorldPoint}: Every tile of world view wv that is a copy of this template tile, ordered by plane, then chunk x, then chunk y; outside an instance the tile itself if wv contains it. Empty when wv is no longer loaded or has no scene.