SLIC Function Reference

Back to main
This is an alphabetical list of every function available in SLIC scripts for Civilization: Call to Power.

Functions marked with (1.1) were not present until version 1.1.

  • VOID Abort()(Messages only)
    Causes the current message to not be displayed. The code code following an Abort() is still executed however.

  • VOID Accept()(Messages only)
    Accepts the diplomatic request associated with this message.

  • VOID AcceptTradeBid()(Messages only)
    Accepts the trade bid associated with this message

  • VOID AcceptTradeOffer(index)(Messages only)
    Accepts the trade offer associated with this message

  • VOID AddCity(builtinwithcity)
    Adds a city to the current context.

  • VOID AddCityByIndex(owner, index)
    Adds the player's nth city to the context.

  • VOID AddExpelOrder(unit, location)
    Tells the unit to expel another unit at the given location (must be adjacent, must be expellable, the unit being given the order must be able to expel units, etc.)

  • VOID AddGoods(city)
    Add all the goods in the city's radius to the context.

  • (1.1) VOID AddMovement(unit, amount)
    Give unit an additional amount movement points (will be removed at the end of the turn if not used).

  • VOID AddOrder(unit, location)
    Tell the given unit to execute the order that was previously set in the context. See also SetOrder

  • INT AddPops(city, count)
    Increase the population of the given city by count.

  • VOID AddUnit(unit)
    Add a unit to the context.

  • INT AllUnitsCanBeExpelled(location)
    return true if all of the units at the location can be expelled. Returns false if there are no units there.

  • VOID AttachRobot(index)
    Cause the given player to be taken over by an AI player

  • VOID Attract(ldlname)
    Draw a highlight box around the named UI component.

  • VOID BreakAgreement(agreement_index)
    Break a diplomatic agreement which is set in the context.

  • VOID BreakAlliance(player)
    Break an alliance between player.1 and and the given player.

  • VOID BreakLeaveOurLands()
    Break a stop trespassing agreement between player.1 and player.2

  • VOID BreakNoPiracy()
    Break a no piracy agreement between player.1 and player.2

  • INT BuildingType(building)
    Return the building database index of the named building (building is a quoted string corresponding to the name in improve.txt)

  • VOID Caption(caption)
    Unimplementd

  • VOID CaptureCity(player, city)
    Unimplemented

  • VOID CaptureRegion(player, region)
    Unimplemented

  • (1.1) VOID CatchUp()
    Cause the graphics system to synchronize with the game's internal state (fast forward unit moves, for example)

  • VOID ChangeRegardLevel(player1, (delta)level, player2)
    Unimplemented

  • INT Cities(player)
    Returns the number of cities the player has.

  • INT CitiesRank(player)
    Returns the ranking of the player by number of cities (1 being the highest)

  • INT CityCollectingGood(city, good)
    Return the amount of a particular good being collected in the city (excluding goods being brought in via trade)

  • INT CityHasBuilding(city, building)
    Return true if the city has a building of the given type. building is a quoted string corresponding to the name in improve.txt.

  • VOID ClearBuildQueue(city)
    Remove all items from the build queue of the given city.

  • VOID ClearOrders(unit)
    Clear the unit's army's orders.

  • INT ControlsRegion(player, (ID)region)
    True if the given player is the only player who owns tiles in the region (not necessarily all the tiles in the region)

  • INT CreateCity(owner, nearlocation, distance[, savecity])
    Create a city belonging to owner, at approximately distance tiles away from nearlocation. If a city variable is passed in to savecity, it will contain the newly created city after this function returns.

  • INT CreateCoastalCity(owner, nearlocation, distance[, savecity])
    Same as CreateCity, but always finds a square next to ocean.

  • VOID CreateUnit(owner, type, nearlocation, distance[, saveunit])
    Create a unit of the given type belonging to owner approximately distance tiles from nearlocation. If a unit variable is passed in as saveunit, it will contain the newly create unit after this function returns.

  • VOID DeactivateTutorial()
    Turn off the tutorial.

  • VOID DemandWarFromAllies(demandingplayer, againstplayer)
    Send a diplomatic request demanding that all allies of demanding player declare war on againstplayer.

  • (1.1) VOID Deselect()
    Cause the currently selected unit/city/resource to be deselected.

  • VOID DetachRobot(index)
    Turn the AI off for the given player.

  • VOID DisableChooseResearch()
    The choose research dialog is disabled for the tutorial player.

  • VOID DisableClose()(Messages only)
    Disallow closing this message from the UI.

  • VOID DisableMessageClass(class)
    Cause all messages of the given class to not be displayed.

  • VOID DisableScreensButton()
    Disable the screens button.

  • VOID DisableTileImprovementButton()
    Disable the tile improvements button.

  • VOID DisbleTrigger('trigger_id')
    Disable the named trigger.

  • VOID DoAutoUnload()
    Do not use this.

  • VOID DoCannotAffordMaintenance()
    Does nothing.

  • VOID DoCannotAffordSupport()
    Does nothing.

  • VOID DoCertainRevolution()
    Does nothing.

  • VOID DoCityWillStarve()
    Does nothing.

  • VOID DoFreeSlaves()
    Frees the slaves in city.1. Only works if that city was captured this turn.

  • VOID DoLandInOcean()
    Does nothing.

  • VOID DoOutOfFuel()
    Does nothing.

  • VOID DoPillageOwnLand()
    Causes unit.1 to pillage, even if it belongs to the player who owns the tile it's standing on.

  • VOID DoSellImprovement()
    Does nothing.

  • VOID DoYouWillBreakRoute()
    Does nothing.

  • VOID DontAcceptTradeOffer(index)
    Reject a trade offer.

  • VOID DontSave()(Messages only)
    If this is a tutorial message, don't save it in the tutorial history.

  • VOID Duration(turns)
    Kill this message automatically in n turns.

  • VOID EnableChooseResearch()
    Reenable the choose research dialog for the tutorial player.

  • VOID EnableCloseClass(player, class)
    Enable closing of all messages belonging to class, if it was disabled previously.

  • VOID EnableCloseMessage(player, messagename)
    Enable closing of all messages from the named object.

  • VOID EnableMessageClass(class)
    Enable messages belonging to class.

  • VOID EnableScreensButton()
    Enable the screens button.

  • VOID EnableTileImprovementButton()
    Enable the tile improvements button.

  • VOID EnableTrigger('trigger_id')
    Enable the named trigger.

  • VOID EndTurn()
    End this turn.

  • (1.1) VOID ExecuteAllOrders()
    Cause all units to execute queued up orders.

  • VOID ExitToShell()
    Exit to the main screen.

  • VOID ExtractLocation(location, locationvar)
    Get a location from built in variable and put it in locationvar.

  • VOID EyeDropdown(starting index, builtin variable with list)(Messages only)
    Put a dropdown box on the message.

  • VOID EyePoint(location[, player, messageid])
    Put an eyepoint on the message. If player and messageid are passed, call that message when the eyepoint is clicked.

  • INT FindCoastalCity(player, cityvar)
    Find a city next to the ocean and put it in cityvar. Returns 0 if no coastal cities are found.

  • VOID FinishBuilding(city)
    Finish building a settler that was stopped because building it will disband the city.

  • (1.1) VOID Flood(stage)
    Cause a global flood. Stage specifies the effects, stage 0 is somewhat less drastic than later stages.

  • VOID ForceRegard(ofPlayer, forPlayer, toRegard)
    Force the regard ofPlayer forPlayer toRegard.

  • INT GameOver(player, reason)
    End the game for the given player. reason can be either 1 or 2, 1 meaning the player won, 2 meaning they lost.

  • INT GeographicRank(player)
    The rank of the player according to how much land they own, 1 being the most.

  • VOID GetMessageClass(player, index)
    Get the class of message #index belonging to player.

  • INT GetNearestWater(location, locationvar)
    Get the location of the nearest ocean square to location, putting the result in locationvar. Also returns the distance in patched version.

  • VOID GetRandomNeighbor(location, newlocation)
    Get a random square adjacent to location and put it in newlocation.

  • (1.1) VOID GodMode(onoff)
    Turn God mode on (onoff = 1) or off (onoff = 0) (the equivalent of the Show Map button in the editor).

  • INT GoldRank(player)
    Get the rank of the player in terms of how much gold they have. 1 being the highest rank.

  • INT GoodCount(city, type)
    Count the number of goods of a particular type in the city's radius.

  • INT GoodCountTotal(city)
    Count the number of goods of all types in the city's radius.

  • INT GoodType(good_name)
    Turn a named good into a good index.

  • INT GoodVisibutik(city, type)
    Doesn't work.

  • VOID GrantAdvance(player, advance)
    Give the player the advance specified.

  • INT HasAdvance(player, advance_name)
    Return true if the player has the advance.

  • INT HasPop(owner, location)
    Return true if owner has a worker at location.

  • INT HasRiver(location)
    return true if there's a river at location.

  • INT HasSameGoodAsTraded(player)
    A somewhat confusing function.

  • INT IsActiveDefender(unit)
    True if the unit is capable of active defense.

  • INT IsBombardingUnit(unit)
    True if the unit is capable of bombarding.

  • INT IsCitySelected()
    True if the player has a city selected.

  • INT IsCleric(unit)
    True if the unit is a cleric.

  • INT IsContinentBiggerThan(location, size)
    True if the continent at location has at least size squares.

  • INT IsCounterBombardingUnit(unit)
    True if the unit is capable of counter bombarding.

  • INT IsDiplomat(unit)
    True if the unit is a diplomat.

  • INT IsFlankingUnit(unit)
    Obsolete.

  • INT IsHostile(player1, player2)
    Obsolete.

  • INT IsHumanPlayer(player)
    True if player is not an AI player.

  • INT IsInRegion(location, (ID)region)
    True if location is within the given region.

  • INT IsInZOC(player, location)
    True if player has Zone of Control over location.

  • INT IsPlayerAlive(player)
    True if player is still in the game.

  • INT IsSecondRowUnit(unit)
    Obsolete.

  • INT IsSlaver(unit)
    True if the unit is a slaver.

  • INT IsSpaceCity(city)
    True if the city is in space.

  • INT IsSpaceUnit(unit)
    True if the unit is capable of moving in space.

  • INT IsUnderseaCity(city)
    True if the city is in the ocean.

  • INT IsUnitSelected()
    True if the player has a unit selected.

  • INT IsWonderType(wonder, (string)type)
    True if wonder is named type.

  • INT IsWormholeProbe(unit)
    True if the unit is a wormhole probe.

  • VOID Kill()(Messages only)
    Kills this message, only works inside buttons. (Use Abort() instead outside a button)

  • VOID KillClass(class)
    Kills all messages of the given class.

  • VOID KillEyepointMessage()
    When a message is called from an eyepoint, kill the original message with this function.

  • VOID KillMessages(objectname)
    Kill all messages from the named object.

  • VOID KillUnit(unit)
    Kill the unit.

  • INT KnowledgeRank(player)
    Rank of the player in terms of number of advances.

  • VOID LeaveRegion(player, region)
    Unimplemented.

  • VOID LibraryAdvance(int)
  • VOID LibraryBuilding(int)
  • VOID LibraryConcept(int)
  • VOID LibraryGovernment(int)
  • VOID LibraryTerrain(int)
  • VOID LibraryTileImprovement(int)
  • VOID LibraryUnit([unit|int])
  • VOID LibraryWonder(int)
    All of the above functions open the great library to the appropriate page.

  • VOID LoadGame(name)
    Load the named game. Must have been saved from SLIC with SaveGame.

  • VOID Message(player, 'message_id')

    Run the messagebox or alertbox named 'message_id' with player as the recipient.

  • VOID MessageAll('message_id')

    Run the messagebox or alertbox named 'message_id' with every player as a recipient.

  • VOID MessageAllBut(player, 'message_id')
    Run the messagebox or alertbox named 'message_id' with everyone but player as a recipient.

  • VOID MessageClass(int)(Messages only)
    Set the current message to the given class.

  • VOID MessageType(message_type)
    Set the icon for the current message.

  • INT MilitaryRank(player)
    The rank for the given player in terms of strength of military units.

  • VOID OpenCity()
    Open the city status screen.

  • VOID OpenCityTab()
    Set the control panel to the city tab.

  • VOID OpenCiv()
    Open the civ status screen.

  • VOID OpenCivTab()
    Set the control panel to the civ tab.

  • VOID OpenDiplomacy()
    Open the diplomacy screen.

  • VOID OpenInfo()
    Open the info screen.

  • VOID OpenLaborTab()
    Open the labor tab.

  • VOID OpenMaxTab()
    Open the max tab.

  • VOID OpenOptions()
    Open the options screen.

  • VOID OpenProductionTab()
    Open the production tab.

  • VOID OpenScience()
    Open the science screen.

  • VOID OpenThroneRoom()
    Open the throne room.

  • VOID OpenTrade()
    Open the trade screen.

  • VOID OpenUnit()
    Open the unit status screen.

  • (1.1) VOID Ozone()
    Cause an ozone depletion event.

  • VOID PlantGood(location)
    Add a special resource at location.

  • VOID PlaySound(soundname)
    Play a sound.

  • INT PlayerCityCount(player)
    Return how many cities the player has.

  • INT PopulationRank(player)
    Rank of the player in terms of total population.

  • (1.1) INT Preference(prefname)
    Read the value of the given preference (from userprofile.txt/profile.txt). E.G. Preference("Pollution") will return 1 if pollution is enabled for this game, 0 otherwise.

  • VOID QuitToLobby()
    Quit to the network lobby in a network game.

  • INT Random(range)
    Return a random number from 0 to range.

  • INT RegardLevel(player1, player2)
    Return player 1's regard toward player 2.

  • VOID Reject()
    Reject a diplomatic request from the context.

  • VOID RejectTradeBid()
    Reject a trade bid from the context.

  • VOID Research()
    Obsolete

  • VOID SaveGame(name)
    Save a game with the given name.

  • VOID SendTradeBid()
    Obsolete

  • (1.1) VOID SetCity(index, city)
    Set city.index to city. Useful to access the attributes of a city stored in a TypeCity variable. E.G. SetCity(1, myCityVariable) will cause city.1 to be the unit stored in myCityVariable.

  • (1.1) VOID SetCityByIndex(index, player, cityindex)
    Set cityindex to player's cityindexth city. Useful for looping through all of a player's cities for example.

  • VOID SetGovernment(index)(Messages only)
    Set the recipient's government to the given type.

  • (1.1) VOID SetLocation(index, locationvar)
    Set location.index to locationvar.

  • (1.1) VOID SetOrder(index, order)
    Set an order in the context to the given order. (As of patch 1.1, only an index of 1 is actually useful). Once an order has been set, it can be issued to a unit with AddOrder.

  • VOID SetPlayer(index, player)
    Set player.<index> to player.

  • (1.1) INT SetPreference(prefname, value)
    Set the value of a boolean or integer variable to value. E.G. SetPreference("UnitAnim", 1) will turn unit animations on.

  • VOID SetResearching(player, what)
    Set the player to research what.

  • VOID SetScience(player, level)
    Set the player's science level to level.

  • VOID SetTimerGranularity(gran)
    Set SLIC's timer mechanism to check timers every gran seconds. 1 second is the best granularity possible. The default is 5 seconds.

  • (1.1) VOID SetUnit(index, unit)
    Set unit.index to unit. Useful to access the attributes of a unit stored in a TypeUnit variable. E.G. SetUnit(1, myUnitVariable) will cause unit.1 to be the unit stored in myUnitVariable.

  • (1.1) VOID SetUnitByIndex(index, player, unitindex)
    Set unit.index to player's unitindexth unit. Useful for looping through all of a player's units for example.

  • VOID Show()
    Open this message immediately instead of showing just an icon.

  • INT SpaceRank(player)
    The rank of this player in terms of space ownership.

  • VOID StartTimer(index, duration)
    Start timer index, set to expire in duration seconds. trigger 'foo' when (timer.<index>) {...} to tell when this timer has expired.

  • VOID StopTimer(int)
    Stop the given timer.

  • VOID Surrender(player)
    Unimplemented.

  • VOID Terraform(location, terrain)
    Change location into a different terrain type.

  • INT TerrainType(location)
    Return the terrain type of the location.

  • VOID Title(stringid)(Messages only)
    Set the title of a message.

  • INT TradePoints(player)
    Return how many caravans the player has.

  • INT TradeRank(player)
    The player's rank in terms of number of trade routes.

  • INT TradeRoutes(player)
    Return how many trade routes the player has.

  • INT UnderseaRank(player)
    The player's rank in terms of undersea cities.

  • INT UnitType(unitname)
    Return the DB index of the named unit. The name must be in quotes. E.G. UnitType("UNIT_SETTLER")

  • INT UnitCount(player, type)
    Return a count of how many units of a given type the player has.

  • INT UnitHasFlag(unit, (ID)flag)
    Return true if the given unit has the specified flag (flags are the same as in units.txt. NOTE: a few flags may not work with this function.)

  • INT UnitsInCell(location)
    Return the number of units in the cell.

  • VOID UseDirector()(Messages only)
    Queue this message up via the animation system instead of displaying it immediately. Useful to synchronize messages with other things happening on screen.
  • Author: Joe Rumsey
    Date: April 1, 1999
    Last Update: May 10, 1999
    Back to Civilization: Call to Power