Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:MapGetParentMap

From RoR Wiki

UI Lua API · Map functions
Version: WAR 1.4.8

Returns the map one level above a given map, for example the pairing map that contains a zone.

parent = MapGetParentMap(mapLevel, mapNumber)

Arguments

mapLevel
number – Level of the map, a GameDefs.MapLevel value.
mapNumber
number – Number of the map at that level, for example a zone id for GameDefs.MapLevel.ZONE_MAP.

Returns

parent
table – The parent map, or nothing if the map is unknown or has no parent.
Key Type Meaning
mapLevel number Level of the parent map.
mapNumber number Number of the parent map.

Details

  • If the client's map data is not loaded, the function returns nothing.
  • The argument check names the wrong function: if an argument is missing or not a number, the Invalid Parameters message names MapGetChildMaps.
  • The function needs at least two arguments and only reads the last two.

Errors

None besides the generic Invalid Parameters message (see Details).

Example

From default/ea_worldmapwindow/source/worldmapwindow.lua:

function EA_Window_WorldMap.ZoomOut()
    local parentMap = MapGetParentMap(EA_Window_WorldMap.currentLevel, EA_Window_WorldMap.currentMap)

    if (parentMap ~= nil and parentMap.mapLevel ~= nil and parentMap.mapNumber ~= nil) then
        EA_Window_WorldMap.SetMap(parentMap.mapLevel, parentMap.mapNumber)
    end
end

From default/easystem_glyphdisplay/source/glyphdisplay.lua:

local parentMap = MapGetParentMap( GameDefs.MapLevel.ZONE_MAP, zoneId )
if parentMap ~= nil and parentMap.mapNumber < GameData.ExpansionMapRegion.FIRST and parentMap.mapNumber > 0
then
    return true
end

See also