Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetCityRatingForCityId

From RoR Wiki
Revision as of 19:43, 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 · RvR functions
Version: WAR 1.4.8

Returns the rating (rank) of a capital city.

rating = GetCityRatingForCityId(cityId)

Arguments

cityId
number – City id, for example GameData.CityId.EMPIRE, GameData.CityId.CHAOS or GameData.Player.City.id.

Returns

rating
number – The stored rating of the city. Nothing if the rating is 0 or the client has no rating for that city.

Details

  • A rating of 0 returns nothing, not 0. Code that compares the result directly with a number, as MapUtils does (rating <= cityRating), raises a Lua error in that case. Use local rating = GetCityRatingForCityId(id) or 0.
  • The value is read from a table the client keeps; nothing is requested from the server.
  • The function takes exactly one argument.

Errors

None besides the generic Invalid Parameters message when the argument is missing or not a number.

Example

From default/easystem_utils/source/maputils.lua: one star per city rank:

local cityRating = GetCityRatingForCityId( cityId )

for rating = 1, GameDefs.NUM_CITY_RANKS
do
    local showStar = rating <= cityRating
    WindowSetShowing( windowName.."Star"..rating, showStar )

See also