There is one builtin "variable" and a number of builtin variable arrays available in SLIC. This document contains a complete reference of the data that can be extracted from these types. Note that for types supported as user types, all the members of these variables can be accessed in user variables as well. For example, the builtin unit array has a member named owner, which means that any variable of type unit_t also has a member named owner. Member data is accessed using standard c style dot notation. The one plain builtin variable is named "g" and contains three members:
- g.year - the current round
- g.year_str - the current year in string form. Only useful in string replacements.
- g.player - the current player The rest of the builtins come in arrays, which are filled in when an event handler is called (but can also have values assigned by script code).
- unit.owner - the unit's owner
- unit.location - the unit's location
- unit.type - the unit's database index
- unit.hp - the unit's remaining hit points
- unit.valid - true if the unit still exists, false otherwise
- unit.name - the unit's name, only useful in string replacements
- city.owner - the city's owner
- city.location - the city's location
- city.name - the city's name. Only useful in string replacements
- city.population - the city's population (as displayed on the map, not the *10,000 count)
- city.happiness - the city's happiness rounded to an integer
- city.netcitygold - How much gold the city produced this turn
- city.goldfromtraderouts - How much gold the city got from trade routes this turn
- city.building - a string of what the city is building. Only useful in string replacements.
- city.buildingtime - how long until the city completes whatever it's building
- city.buildqueuelength - how many items are in the city's build queue.
- player.owner - An integer version of the player.
- player.cities - Number of cities the player owns
- player.units - Number of units the player owns
- player.militaryunits - Number of military (attack greater than 0) the player owns
- player.armies - Number of armies the player owns
- player.totalpopulation - Total population of all cities owned by the player
- player.totalpollution - Total pollution produced by the player
- player.capital - The player's capital city (assign to a city variable first to use, e.g. myCapital = player.capital)
- player.largestcity - The player's largest city.
- player.researching - What advance the player is researching, in string form
- player.militarystate - The player's military state in string form, Only useful for string replacements
- player.leaderperonality - The player's personality in string form.
- player.govttype - The player's government in string form.
- player.publicworkstax - The player's public works tax setting
- player.publicworkslevel - The amount of public works stored
More string members
- army.owner - the army's owner
- army.location - the army's location
- army.size - the number of units in the army
- location.location - in some cases, using a location variable directly as a location may fail, but you can always use location.location.
- location.x - the location's x coordinate
- location.y - the location's y coordinate.
- advance.type - the AdvanceDB index
- advance.name - the advance's name, only useful for string replacements.
- action.text - the text of this action. Actions are a special type used to pass certain strings into messages that don't otherwise fit into a defined type.
- action.name - a synonym for action.text.
- value.value - Events that have plain integer arguments pass their values through the value array. For example, KillUnit has a cause parameter that will be filled in in value in a KillUnit event handler, making it accessible to the script through value.value
- building.name - the building's name
- building.type - the BuildingDB index
- wonder.name - the wonder's name
- wonder.type - the WonderDB index
- unitrecord.name - the unit type's name
- unitrecord.attack - the unit type's attack value
- unitrecord.defense - the unit type's defense value
- unitrecord.cost - the production cost of the unit type
- unitrecord.ranged - the unit type's ranged attack value
- unitrecord.movement - the unit type's move points
- gold.value - an amount of gold.
- good.name - the good's name.
Civ2 military advisor: "No complaints, Sir!"