API:GetCityInstanceId
From RoR Wiki
UI Lua API · Scenario functions
Version: WAR 1.4.8
Returns the instance number of the city the player is in, wrapped in a table.
data = GetCityInstanceId()
Arguments
None.
Returns
- data
table– A table with one field:
| Key | Type | Meaning |
|---|---|---|
instanceId |
number |
City instance number stored by the client. |
Details
- The value is a single number kept by the client; the function does not check whether the player is actually in a city instance. The stock UI only calls it while
GameData.Player.isInSiegeis true. - The result is always a table, never a plain number. Read
data.instanceId.
Errors
None.
Example
From default/ea_scenariosummarywindow/scenariosummarywindow.lua:
if ( GameData.Player.isInSiege )
then
local cityName = GetZoneName( GameData.Player.zone )
local instanceIdData = GetCityInstanceId()
LabelSetText( "ScenarioSummaryWindowScenarioName", GetStringFormat( StringTables.Default.TEXT_CITY_INSTANCE_LABEL, { cityName, instanceIdData.instanceId } ) )
