Announcement

Collapse
No announcement yet.

SLIC2 Builtin variables

Collapse
X
Collapse
  •  

  • SLIC2-Builtins

    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 array
    • 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 array
    • 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 array
    • 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[0].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
    • player.civ_name_plural
    • player.civ_name_singular
    • player.country_name
    • player.leader_name
    • player.he
    • player.him
    • player.his
    • player.he_cap
    • player.him_cap
    • player.his_cap
    • player.sir
    • player.sir_cap


    Army array
    • army.owner - the army's owner
    • army.location - the army's location
    • army.size - the number of units in the army


    Location array
    • 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 array
    • advance.type - the AdvanceDB index
    • advance.name - the advance's name, only useful for string replacements.


    Action array
    • 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 array
    • 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[0] in a KillUnit event handler, making it accessible to the script through value[0].value


    Building array
    • building.name - the building's name
    • building.type - the BuildingDB index


    Wonder Array
    • wonder.name - the wonder's name
    • wonder.type - the WonderDB index


    UnitRecord array
    • 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 array
    • gold.value - an amount of gold.


    Good array
    • good.name - the good's name.


    BACK TO MODIFICATION INDEX PAGE


    Attached Files
      Posting comments is disabled.

    Article Tags

    Collapse

    Latest Articles

    Collapse

    • EditPlus: updated SLIC-definitions, new CTP2-DB-definitions
      by BureauBert
      Why not get back to CTP2-modding just to enjoy the luxury of syntax highliting in EditPlus?
      • for SLIC (Locutus' SLIC-definitions file updated for CTP2 AE)
      • for CTP2 AE database files (a brand new definitions file)
      I will keep updating both files as long as the Source Code Project is going on with the Information I can find in the AE Modding Wiki (or somewhere else, but preferably there). The EditPlus definitions for CTP2 AE database structures are currently supporting all files in \default...
      January 29, 2011, 18:53
    • SLIC2 Table of Contents
      by Martin Gühmann
      SLIC2 scripting language
      SLIC2 is a C-like language that "moves" many things behind CTP2. By Activision * Go

      SLIC2 Events
      This is a complete listing of SLIC2 events. By Activision * Go

      SLIC2 Function Reference Refe...
      November 29, 2010, 16:32
    • SLIC2-Scripting-Language
      by Martin Gühmann
      Original Author: Joe Rumsey
      Date: December 13, 2000

      This is the SLIC2 scripting language refference.

      Contents

      ...
      November 26, 2010, 20:07
    • SLIC2-Events
      by Martin Gühmann

      This is a complete listing of events. Some of these are not safe to use from SLIC. A few are just plain obsolete and do not do anything useful. Events with arguments prefaced by GEA_ cannot be generated from SLIC, but can be triggered on.


      ...
      November 20, 2010, 21:14
    • SLIC2-Builtins
      by Martin Gühmann

      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).

      ...
      November 19, 2010, 21:57
    • SLIC2-Functions
      by Martin Gühmann
      Following is an alphabetical list of every function available for use in SLIC scripts in Call to Power II.


      VOID Abort()
      Causes the current message to not be displayed. The code following an Abort() is still executed, however. Example:

      messagebox 'Msgbox'
      {
      Abort();
      AddGold(g.player, 100);
      }

      //No message will appear when 'Msgbox' is called, and the player will receive 100 gold.


      ...
      November 19, 2010, 21:29
    Working...
    X