API:GetMapTextPoints
From RoR Wiki
UI Lua API · Map functions
Version: WAR 1.4.8
Returns the text labels (place names) to draw on the map currently shown in a map window.
points = GetMapTextPoints(mapDisplayName)
Arguments
- mapDisplayName
string– Name of a MapDisplay window set up with CreateMapInstance.
Returns
- points
table– Array of text points, indexed from 1. Nothing is returned if the window is not a known map window or its map has no text data.
Each entry:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Id of the label text. The stock UI looks it up with GetStringFromTable("MapTextPoints", id).
|
font |
string |
Font name; the stock UI passes it to LabelSetFont.
|
red, green, blue |
number |
Text colour. |
align |
string |
Alignment. The stock UI checks for "center" and "right" and treats anything else as left.
|
x, y |
number |
Map coordinates of the label. Convert them with MapGetPointForCoordinates. |
Details
- The data comes from the client's map data for the map the window is showing.
- If the client's map data is not loaded, the function returns nothing.
- Exactly one argument must be passed.
Errors
None besides the generic Invalid Parameters message when the argument is missing or not a string.
Example
From default/ea_worldmapwindow/source/zoneview.lua:
local mapDisplay = "EA_Window_WorldMapZoneViewMapDisplay"
local textPointData = GetMapTextPoints( mapDisplay )
for pointIndex, textPoint in ipairs(textPointData)
do
local textPointWindow = "TextPoint_"..currentZoneId.."_"..pointIndex
local x, y = MapGetPointForCoordinates(mapDisplay, textPoint.x, textPoint.y)
...
CreateWindowFromTemplate(textPointWindow, "MapTextPoint", mapDisplay)
WindowAddAnchor(textPointWindow, "topleft", mapDisplay, relPoint, x, y)
LabelSetFont(textPointWindow, textPoint.font, WindowUtils.FONT_DEFAULT_TEXT_LINESPACING)
LabelSetTextColor(textPointWindow, textPoint.red, textPoint.green, textPoint.blue)
LabelSetTextAlign(textPointWindow, align)
LabelSetText(textPointWindow, GetStringFromTable("MapTextPoints", textPoint.id))
end
