Announcement

Collapse
No announcement yet.

SLIC2 Events

Collapse
X
Collapse
  •  

  • SLIC2-Events

    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.




    How to use events from SLIC:

    To add a handler for a named event:

    HandlEvent(EventName) 'HandlerName' [pre | post]
    {
    // Your code here
    }

    Example:

    location_t location_of_death;
    // ...
    // set location_of_death to some square first
    // ...
    // This handler will kill every unit that enters a preset location of death
    HandleEvent(MoveUnits) 'MyMoveHandler' post
    {

    if(army[0].location == location_of_death)
    {

    int_t u;
    for(u = 0; u < army[0].size; u++)
    {

    unit_t unit;
    GetUnitFromArmy(army[0], u, unit);
    Event:KillUnit(unit, 0, -1);
    }
    }
    }

    The priority of the handler can be either pre or post. A "pre" handler runs before the in-game code, a "post" handler runs afterwards. Note that for some events, some arguments may contain invalid data by the time a post handler is called. (For example, in a KillUnit post handler, the unit will already be dead).




    To generate an event from SLIC:

    Event:EventName(arguments)

    Example (also see above):
    Event:KillUnit(unit, 0, -1);

    Generates a KillUnit event for the specified unit. Note that events always execute ASYNCHRONOUSLY. The event is added to a queue, and is executed only after all events added before it have finished executing. So in the above example, the units do not actually die until after the handler has finished executing.




    The complete listing of all events
    • int_t denotes an integer argument that corresponds to a player. Ints and players are mostly interchangeable in SLIC, they are listed specially here for clarity.
    • int_t is a direction argument. The range is from 0-7.

    • MoveOrder(army_t, GEA_Path, location_t, int_t)
      Give a pathed move order to an army
    • MoveToOrder(army_t, int_t)
      Give a single square move order to an army
    • MovePathOrder(army_t, location_t)
      Give a move order to an army, creates a new path
    • SleepOrder(army_t)
      Put an army to sleep
    • UnloadOrder(army_t, location_t)
      Tell an army to unload its cargo
    • MoveUnloadOrder(army_t, GEA_Path, location_t, int_t)
      Army moves then unloads
    • EntrenchOrder(army_t)
      Entrench an army
    • DetrenchOrder(army_t)
      Detrench an army
    • DisbandArmyOrder(army_t)
      Disband an army
    • GroupOrder(army_t)
      Group other units in the square into the army
    • GroupUnitOrder(army_t, unit_t)
      Group specified unit into the army
    • UngroupOrder(army_t)
      Ungroup an army
    • ParadropOrder(army_t, location_t)
      Drop an army from a plane
    • InvestigateCityOrder(army_t, location_t)
      Army invesigates city
    • NullifyWallsOrder(army_t, location_t)
      Army nullifies walls
    • StealTechnologyOrder(army_t, location_t)
      Army steals technology
    • InciteRevolutionOrder(army_t, location_t)
      Army incites a revolution
    • AssassinateRulerOrder(army_t, location_t)
      Army assasinates a ruler
    • InvestigateReadinessOrder(army_t, location_t)
      Army investigates readiness
    • BombardOrder(army_t, location_t)
      Army bombards
    • FranchiseOrder(army_t, location_t)
      Army franchises
    • SueOrder(army_t, location_t)
      Army sues
    • SueFranchiseOrder(army_t)
      Army sues franchise
    • ExpelOrder(army_t, location_t)
      Army expels
    • EstablishEmbassyOrder(army_t, location_t)
      Army establishes embassy
    • AdvertiseOrder(army_t, location_t)
      Army advertises
    • PlantNukeOrder(army_t, location_t)
      Army plants a nuke
    • SlaveRaidOrder(army_t, location_t)
      Army slave raids
    • EnslaveSettlerOrder(army_t, location_t)
      Army enslaves a settler
    • UndergroundRailwayOrder(army_t, location_t)
      Army frees slaves
    • InciteUprisingOrder(army_t, location_t)
      Army incites slave uprising
    • BioInfectOrder(army_t, location_t)
      Army bio infects
    • PlagueOrder(army_t, location_t)
      Army inflicts a plague
    • NanoInfectOrder(army_t, location_t)
      Army nano infects
    • ConvertCityOrder(army_t, location_t)
      Army converts a city
    • ReformCityOrder(army_t)
      Army reforms a city
    • SellIndulgencesOrder(army_t, location_t)
      Army sells indulgences
    • SoothsayOrder(army_t, location_t)
      Army says sooth. "Sooth!" says Army, "Sooth!"
    • CloakOrder(army_t)
      Army cloaks
    • UncloakOrder(army_t)
      Army uncloaks
    • RustleOrder(army_t, location_t)
      Army rustles
    • CreateParkOrder(army_t, location_t)
      Army creates a park
    • CreateRiftOrder(army_t, location_t)
      Army creates a rift
    • PillageOrder(army_t)
      Army pillages
    • InjoinOrder(army_t, location_t)
      Army injoins
    • UseSpaceLadderOrder(army_t)
      Army climbs a space ladder
    • AirliftOrder(army_t, location_t)
      Army airlifts
    • DescendOrder(army_t)
      Army Descends
    • ThrowPartyOrder(army_t, location_t)
      Army gets down and boogies
    • PirateOrder(army_t)
      Army dons an eyepatch and parrot and plunders a trade route
    • GetExpelledOrder(army_t, location_t, int_t)
      This army gets expelled
    • SettleOrder(army_t)
      This army settles
    • BoardTransportOrder(army_t)
      Move this army into a transport in the same cell.
    • LaunchOrder(army_t, location_t)
      Give a space launch order to this army
    • TargetOrder(army_t, location_t)
      Give a nuclear missile a target
    • ClearTargetOrder(army_t)
      Clear a nuclear missile's target
    • CityRiot(city_t)
      A city riots
    • CalcScores(int_t)
      Recalculate a player's scores
    • CaptureCity(city_t, int_t, int_t)
      Make a city change hands
    • MoveArmy(army_t, int_t, int_t, int_t, location_t)
      Move an army one square
    • ContactMade(int_t, int_t)
      Contact between two players established
    • ClearOrders(army_t)
      Clear an army's orders
    • FinishAttack(army_t, location_t)
      An army attacks someone
    • FinishMove(army_t, int_t, location_t, int_t)
      The last stage of an army moving before the MoveUnits event
    • CantMoveYet(army_t, int_t, location_t)
      Added when an army tries to move but is out of move points
    • MoveUnits(army_t, location_t, location_t)
      An army always moves on this event, no more legality checks at this point
    • MoveIntoTransport(army_t, location_t)
      Move an army into a transport (or several transports)
    • Battle(army_t, location_t)
      An army attacks a location
    • BattleAftermath(army_t, location_t, unit_t, unit_t, int_t, int_t, int_t)
      Clean up the battlefield
    • KillUnit(unit_t, int_t, int_t)
      Kill a unit
    • KillCity(city_t, int_t, int_t)
      Kill a city
    • LaunchUnit(unit_t, location_t)
      Launch this unit into space
    • Reentry(army_t)
      Bring this army back to earth
    • SetTarget(unit_t, city_t)
      Give a nuclear missile (unit) a target
    • ClearTarget(unit_t)
      Clear a nuclear missile's target
    • BeginTurn(int_t, int_t)
      Begin a player's turn
    • WormholeTurn(int_t)
      Begin wormhole turn
    • PlayerPatience(int_t)
      Begin player patience
    • PeaceMovement(int_t)
      Begin player peace movement
    • PollutionTurn(int_t)
      Begin player pollution
    • BeginTurnAllCities(int_t)
      Player event before cities begin turn
    • BeginTurnProduction(int_t)
      Begin player production
    • BeginTurnSupport(int_t)
      Begin player support phase
    • BeginTurnImprovements(int_t)
      Begin player improvements phase
    • BeginTurnAgreements(int_t)
      Begin player diplomatic agreements phase
    • ResetAllMovement(int_t)
      Reset all unit movement points
    • AttemptRevolt(int_t)
      Make cities revolt as needed
    • BeginTurnEndGame(int_t)
      Begin endgame processing phase
    • BeginTurnGovernment(int_t)
      Handle government changes
    • FinishBeginTurn(int_t)
      Last event in player begin turn phase
    • FinishBuildPhase(int_t)
      Cities will have added all their build events when this fires
    • StartMovePhase(int_t)
      Added at the end of the primary cb for FinishBuildPhase
    • ProcessUnitOrders(int_t)
      Added by StartMovePhaseEvent, needed to come later
    • AIFinishBeginTurn(int_t)
      Also from StartMovePhaseEvent
    • UnitBeginTurnVision(unit_t, int_t)
      Begin vision phase for enemy units
    • BeginTurnUnit(unit_t)
      Begin turn for own unit
    • CityTurnPreProduction(city_t)
      Early begin turn phase, before production
    • CityBeginTurn(city_t)
      Main city begin turn event
    • CityBeginTurnVision(city_t, int_t)
      Vision phase for enemy cities
    • BeginTurnArmy(army_t)
      Begin turn for own army
    • BuildUnit(city_t, int_t)
      Add a unit to a city's queue
    • BuildBuilding(city_t, int_t)
      Add a building to a city's queue
    • BuildWonder(city_t, int_t)
      Add a wonder to a city's queue
    • BuildFront(city_t)
      Try to build the first thing in a city's queue
    • CreateUnit(int_t, location_t, city_t, int_t, int_t [, unit_t])
      Create a unit
    • ZeroProduction(city_t)
      Set a city's stored production to 0
    • Settle(army_t [, int_t])
      Found a city with a settler
    • CreateCity(int_t, location_t, int_t, int_t [, city_t])
      Create a city (first int is cause, second int is unit type that settled (-1 if not from unit)
    • CreateImprovement(int_t, location_t, int_t, int_t)
      Start building a terrain improvement
    • ImprovementAddTurn(GEA_Improvement)
      Add a turn to an improvement
    • ImprovementComplete(GEA_Improvement [, location_t] [, int_t] [, int_t])
      An improvement is complete. Location, owner, and type filled in after completion
    • PopToCity(GEA_Pop)
      Move a pop to it's home city
    • PopToField(GEA_Pop, location_t)
      Move a pop to a new location
    • MakePop(city_t [, int_t])
      Create a pop
    • KillPop(city_t)
      Remove a pop
    • CityInfluenceChanged(city_t, int_t)
      Triggered when city influence radius changes (city,delta).
    • GrantAdvance(int_t, int_t, int_t)
      Give a player an advance
    • SendGood(int_t, city_t, city_t)
      Send a good from one city to another
    • TradeBid(int_t, int_t, city_t, city_t)
      Bid on a foreign good
    • KillTradeRoute(GEA_TradeRoute, int_t)
      Kill a trade route
    • SetPiratingArmy(GEA_TradeRoute, army_t)
      Set army pirating trade route
    • CreatedArmy(army_t)
      An empty army was created
    • AddUnitToArmy(unit_t, army_t, int_t)
      Insert a unit into an army
    • FinishUnload(army_t, army_t, location_t)
      Finish the unload process for an army
    • SetUnloadMovement(army_t)
      Take away the army's move points after an unload (Except CanBeachAssault units)
    • SetUnloadMovementUnit(unit_t)
      Take a unit's movement points away after an unload.
    • FinishUprising(city_t, army_t, int_t)
      Finish a slave uprising
    • CleanupUprising(army_t, city_t)
      Really finish a slave uprising
    • GiveMap(int_t, int_t)
      Give map from first player to second player
    • GiveCity(city_t, int_t)
      Give a city to a foreign player
    • SleepUnit(unit_t)
      Put a unit to sleep
    • WakeUnit(unit_t)
      Wake a unit
    • EntrenchUnit(unit_t)
      Entrench a unit
    • DetrenchUnit(unit_t)
      Detrench a unit
    • WakeArmy(army_t)
      Wake all units in an army
    • DisplayInvestigationWindow(unit_t, city_t)
      Display the investigate city window
    • InciteRevolutionUnit(unit_t, city_t)
      Unit incites a revolution
    • SubGold(int_t, int_t)
      Subtract gold from player
    • AddGold(int_t, int_t)
      Add gold to player
    • AssassinateRulerUnit(unit_t, city_t)
      Unit bombs cabinet
    • MakeFranchise(unit_t, city_t, int_t)
      Add a franchise to a city
    • Teleport(army_t, location_t)
      Army teleports
    • PlantNukeUnit(unit_t, city_t)
      Unit planted a nuke
    • SlaveRaidCity(unit_t, city_t)
      Unit raids a city for slaves
    • Lawsuit(army_t, unit_t, location_t)
      Sue an army
    • RemoveFranchise(army_t, unit_t, city_t)
      Sue a franchise
    • ExpelUnits(army_t, location_t)
      Army expelling units
    • NukeCityUnit(unit_t, city_t)
      A unit nukes a city
    • NukeLocationUnit(unit_t, location_t)
      A unit nukes something else
    • NukeCity(city_t, int_t)
      The actual event that nukes a city
    • EnslaveSettler(army_t, unit_t, unit_t)
      Enslave a settler
    • UndergroundRailwayUnit(unit_t, city_t)
      Free slaves from city
    • InciteUprisingUnit(unit_t, city_t)
      Incite a slave uprising
    • EstablishEmbassyUnit(unit_t, city_t)
      Attempt to establish an embassy
    • EstablishEmbassy(int_t, int_t)
      Actually establish an embassy
    • ThrowPartyUnit(unit_t, city_t)
      Attempt to throw a party
    • ThrowParty(int_t, int_t)
      Actually throw a party
    • BioInfectCityUnit(unit_t, city_t)
      Unit infects city
    • BioInfectCity(city_t, int_t)
      City gets infected
    • PlagueCityUnit(unit_t, city_t)
      Unit plagues a city
    • PlagueCity(city_t, int_t)
      City gets plagues
    • NanoInfectCityUnit(unit_t, city_t)
      Unit nanoinfects city
    • NanoInfectCity(city_t, int_t)
      City gets nanoinfected
    • ConvertCityUnit(unit_t, city_t)
      Unit converts city
    • ConvertCity(city_t, int_t, int_t)
      City actually converted
    • ReformCityUnit(unit_t, city_t)
      Unit reforms city
    • UnconvertCity(city_t)
      City is reformed
    • IndulgenceSaleMade(unit_t, city_t)
      Indulgence sale made
    • AddHappyTimer(city_t, int_t, int_t, int_t)
      Cause a timed amount of happiness or unhappiness
    • CreateParkUnit(unit_t, city_t)
      Unit creates a park
    • CreatePark(city_t, int_t)
      City becomes a park
    • CutImprovements(location_t)
      Pillage terrain improvements
    • PillageUnit(unit_t)
      Unit pillages
    • InjoinUnit(unit_t, city_t)
      Unit injoins city
    • InjoinCity(city_t, int_t)
      City is injoined
    • CreateBuilding(city_t, int_t)
      Create a building
    • CreateWonder(city_t, int_t)
      Create a wonder
    • RunCombat(army_t, location_t, int_t, int_t)
      Run one round of combat
    • StartCombat(army_t, location_t)
      Start a battle
    • BuyFront(city_t)
      Rush buy an item in a city
    • SellBuilding(city_t, int_t)
      Sell a building from a city
    • BorderIncursion(int_t, int_t)
      Occurs when army first crosses foreign border.
    • BorderPullout(int_t, int_t)
      Occurs when army leaves foreign border.
    • ComputeMotivations(int_t)
      Determine fears and desires
    • ReactionMotivation(int_t, int_t)
      Find new proposals motivated as reactions to game events
    • FearMotivation(int_t, int_t, int_t)
      Find new proposal for fear motivation
    • DesireMotivation(int_t, int_t, int_t)
      Find new proposal for desire motivation
    • NewProposal(int_t, int_t)
      A new proposal ha sbeen made.
    • Threaten(int_t, int_t)
      A player has been threatened.
    • Counter(int_t, int_t)
      A proposal has been countered.
    • Reject(int_t, int_t)
      A proposal has been rejected.
    • Accept(int_t, int_t)
      A proposal has been accepted.
    • ResponseReady(int_t, int_t)
      Notify world that a diplomatic response is ready
    • NewProposalReady(int_t, int_t)
      Notify world that a new proposal is ready
    • ContinueDiplomacy(int_t, int_t)
      Decide if sender should make a new proposal.
    • ToggleInitiative(int_t, int_t)
      Initiative passes to party currently without initiative.
    • InitStrategicState(int_t)
      Initialize strategic state
    • NextStrategicState(int_t)
      Determine next strategic state
    • InitDiplomaticState(int_t, int_t)
      Initialize Diplomatic state
    • NextDiplomaticState(int_t, int_t)
      Determine next diplomatic state
    • StartNegotiations(int_t)
      After computing motivations, select new proposals
    • BeginScheduler(int_t)
      Match all armies with goals.
    • ProcessMatches(int_t, int_t)
      Perform one pass through match list, executing matches.
    • NewNegotiationEvent(int_t, int_t)
      A new negotiation history event has been added
    • DisbandUnit(unit_t)
      Disband one unit
    • DisbandCity(city_t)
      Disband one city
    • TimerExpired(int_t)
      Triggered when a timer expires.
    • ArmyClicked(army_t)
      Triggered when the user clicks an army with the mouse.
    • ArmySelected(army_t)
      Triggered when the user selects an army.
    • ArmyDeselected(army_t)
      Triggered when the user deselects an army.
    • CityClicked(city_t)
      Triggered when the user clicks a city with the mouse.
    • CitySelected(city_t)
      Triggered when the user selects a city.
    • CityDeselected(city_t)
      Triggered when the user deselects a city.
    • AccomplishFeat(int_t, int_t)
      Someone has accomplished a feat (int = feat DB index)
    • MADLaunch(unit_t)
      A targetted launches towards its target.
    • BuildingRemoved(city_t, int_t)
      Triggered when a building is removed.
    • WonderRemoved(city_t, int_t)
      Triggered when a wonder is removed.
    • NetworkTurnSync(int_t)
      Process the start of a turn for this player
    • EndAIClientTurn(int_t)
      Used in automated testing only
    • EnterAge(int_t, int_t)
      Player enters a new age.
    • KillTile(location_t)
      A map tile dies (turns to polluted)
    • ActivateAllUnits(location_t)
      Detrench/wake all units at location
    • BeginTurnExecute(army_t)
      Call ExecuteOrders on an Army for a begin turn (normally AI only)
    • KillPlayer(int_t, int_t, int_t)
      A player has died (all cities gone)
    • EndTurn(int_t)
      End a player's turn.
    • VictoryMoveOrder(army_t, location_t)
      The move into an attacked square after winning a battle
    • OpenInitialCityInterface(city_t)
      Generated when a city is initialized, after all population is added.


    BACK TO MODIFICATION INDEX PAGE
    Attached Files
      Posting comments is disabled.

    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\gamedata and \default\aidata. I will see how much I can do for the string files, but I intend to integrate at least some highliting support for editing the Great Library. Personally, I like browsing the textfiles with syntax highliting -- I can see clearly now .

      I will eventually post updates here (not too frequently though).

      Please don't hesitate to post your suggestions and complaints .

      Installation:
      • Requires: EditPlus
      • copy the zipped files into the EditPlus program folder
      • open EditPlus, open the menu Tools > Preferences
      • go to "Settings and Syntax"
      • hit the "Add" button
      • for SLIC enter a description like "SLIC", file extension "slc", the syntax file is "slic.stx", the auto completion file is "slic.acp" and the function pattern file is "slic.ctl"
      • for the database defintions enter a description like "CTP2 DB", the file extension is "txt" (which might be a bit annoying if you use EditPlus for other textfiles and if you frequently use words like "InvaderMovementRegardCost" in your notes ), there is just a syntax file "ctpdb.stx"
      ...
      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
      Reference of the SLIC2 Functions. By Activision * Go

      SLIC2 Built-in variable types
      There is one builtin "variable" and a number of builtin variable arrays available in SLIC2. This document contains a complete reference of the data that can be extracted from these types. By Activision * Go


      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