Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:MapGetPointForCoordinates

From RoR Wiki
Revision as of 19:47, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Map functions
Version: WAR 1.4.8

Converts map coordinates into a position inside a map window, for placing markers on the map.

pointX, pointY = MapGetPointForCoordinates(mapDisplayName, x, y)

Arguments

mapDisplayName
string – Name of a MapDisplay window set up with CreateMapInstance.
x, y
number – Coordinates on the map shown in the window, for example the x/y fields from GetMapTextPoints or objective positions.

Returns

pointX, pointY
number – Position inside the window, relative to its top-left corner. Nothing is returned if either value would be 0 or less.

Details

  • This is the reverse of MapGetCoordinatesForPoint.
  • The stock UI passes the result straight to WindowAddAnchor with a "topleft" anchor on the map window.
  • If the window does not exist or is not a MapDisplay, an error is logged, and the conversion is still attempted with the given name. With an empty name, the window check is skipped.
  • If the client's map data is not loaded, the function returns nothing.
  • The function needs at least three arguments and only reads the last three.

Errors

These are written to the UI log; the call continues.

  • Error in function call 'MapGetPointForCoordinates': Display Window %s does not exist
  • Error in function call 'MapGetPointForCoordinates': Display Window %s is not a MapDisplay

Example

From default/ea_rvrtracker/source/rvrtracker.lua:

local x, y = MapGetPointForCoordinates(mapDisplay, objectivePoint.objPositionX, objectivePoint.objPositionY)

CreateWindowFromTemplate(objectiveTimerWindow, "ObjectiveRvRTrackerTimer", mapDisplay)
WindowAddAnchor(objectiveTimerWindow, "topleft", mapDisplay, "topleft", x, y)

See also