Catalogue of Python Functions, by Solver

Included by me, from Solver's post on Apolyton.

Key

Object Retrieval:

  • Includes function calls that grabs an object of some type (e.g. a player object, a unit object, etc.) related to the title.

Info:

  • Includes function calls that gets information of some type about the title.

Assignment:

  • Includes function calls that assign a value to a parameter related to the title.

Action:

  • Includes function calls that 'do something' related to the title.

top

General Game

Object Retrieval:

  • CyGlobalContext().getGame() - Returns (obj) the active Game instance.
  • CyGlobalContext().getActivePlayer() - Returns (obj) the Player instance of the active player.
  • CyGlobalContext().getCivilizationInfo(int CivID) - Returns (obj) the CivilizationInfo instance associated with 'CivID'.
  • CyGlobalContext().getLeaderHeadInfo(int LeaderID) - Returns (obj) LeaderHeadInfo instance associated with 'LeaderID'.
  • CyGlobalContext().getEngine() - Returns (obj) the current Engine instance.
  • CyGlobalContext().getMissionInfo(int MissionID) - Returns (obj) the MissionInfo instance associated with 'MissionID'.
  • CyGlobalContext().getActionInfo(int ActionID) - Returns (obj) the ActionInfo instance associated with 'ActionID'.
  • CyGlobalContext().getCivicInfo(int CivicID) - Returns (obj) the CivicInfo instance associated with 'CivicID'.
  • CyGlobalContext().getCivicOptionInfo(int CivicID - Returns (obj) [unknown]. (Appears to be very similar to getCivicInfo)
  • CyGlobalContext().getEmphasizeInfo(int EmphasizeID) - Returns (obj) EmphasizeInfo instance associated with 'EmphasizeID'.
  • CyGlobalContext().getEraInfo(int EraID) - Returns error: No Python class registered for C++ class CvEraInfo.
  • CyGlobalContext().getGoodyInfo(int GoodyID) - Returns (obj) GoodyInfo instance associated with 'GoodyID'.
  • CyGlobalContext().getHandicapInfo(int HandicapID) - Returns (obj) HandicapInfo instance associated with 'HandicapID'.

Info:

  • CyGame().getGameTurn() - Returns (int) the current game turn (starting with 0).
  • CyGame().getGameTurnTime() - Returns (int) AD or BC year (negatives for BC).
  • CyGame().getNumGameTurnActive() - Returns (int) the number of turns played in this current session?
  • CyGame().getNumHumanGameTurnActive() - Returns (int) the number of turns played by a human in this current session?
  • CyGame().getTotalPopulation() - Returns (int) the total world population.
  • CyGame().getVictory() - Returns (int) victory type ID of the kind of victory achieved? (-1 means no victory yet)
  • CyGame().getHandicapType() - Returns (int) the difficulty level (0 being Beginner).
  • CyGame().getStartEra() - Returns (int) the Era ID the game started in (0 being Ancient).
  • CyGlobalContext().getMAX_CIVIC_OPTIONS() - Returns (int) the number of categories of civics available? (5 in testing)
  • CyGlobalContext().getMIN_ANIMAL_STARTING_DISTANCE() - Returns (int) the closest an animal can spawn to a unit/visible tile. (Default is 2)
  • CyGlobalContext().getMIN_BARBARIAN_STARTING_DISTANCE() - Returns (int) the closest a barb can spawn to a unit/visible tile. (Default is 2)
  • CyGlobalContext().getMIN_BARBARIAN_CITY_STARTING_DISTANCE() - Returns (int) the closest a barb city can spawn to a unit/visible tile. (Default is 2)
  • CyGlobalContext().getEventTypes(int EventID) - Returns (string) event name associated with 'EventID'. (e.g. ENTEVENT_DEFAULT or ENTEVENT_MOVE)
  • CyGame().getGameSpeedType() - Returns (int) Game speed (0 fast, 1 normal, 2 epic?).
  • CyGame().isSpeedMode() - Returns (bool) whether or not the game is in Speed Mode. (What is that?)
  • CyGame().isNone(obj Game) - Returns (bool) whether or not the instance 'Game' is valid (not sure how a modder might use this one).
  • CyGame().isDebugMode() - Returns (bool) whether or not the game is in debug mode.
  • CyGame().isInWorldBuilderMode() - Returns (bool) whether or not the game is in World Builder mode.
  • CyGame().isMultiplayer() - Returns (bool) whether or not the game is a Multiplayer game.
  • CyGlobalContext().getInvisibleTypes(int InvisibleID) - Returns (string) the name of the invisibility type associated with .InvisibleID'. (Only one functioning now is 0, which returns INVISIBLE_SUBMARINE)
  • CyGlobalContext().getGOODY_DIE_SIDES() - Returns (int) the number of goody hut outcomes there are. (Default is 20)
  • CyGlobalContext().getFlavorTypes(int FlavorID) - Returns (string) the name of the FlavorType associated with 'FlavorID'. (e.g. 0 returns FLAVOR_MILITARY and 1 returns FLAVOR_RELIGION)
  • CyGlobalContext().getBASE_ANARCHY_LENGTH() - Returns (int) the number of turns of anarchy automatically added onto each set of anarchy. (0 in testing)
  • CyGame().getName() - Returns (string) the Name of [unknown]. (Seems to return the name of the player/host's civilization leader, at least in SP games; e.g. "Frederick")
  • CyGlobalContext().getMAX_AUTOSAVES() - Returns (int) the maximum number of autosaves to keep. (Default is 5)
  • CyGame().getNumAIGameTurnActive() - Returns (int) [unknown].
  • CyGame().getNumFreeBonuses(int BonusID) - Returns (int) [unknown].
  • CyGlobalContext().getMAX_SELECTION_LIST_SIZE() - Returns (int) [unknown]. (6 in testing)
  • CyGlobalContext().getMAX_YIELD_STACK() - Returns (int) [unknown]. (5 in testing)
  • CyGlobalContext().getMOVE_DENOMINATOR() - Returns (int) [unknown]. (60 in testing)
  • CyGlobalContext().getMOVE_EFFECT_LENGTH() - Returns (int) [unknown]. (3 in testing)
  • CyGlobalContext().getCIV4_VERSION() - Returns (int) the version number. (Patch v#)

Assignment:

  • CyGame().setName(string Name) - Makes [unknown] set to 'Name'. (Doesn't change the name of any of the players in the game)

Action:

  • CyGame().toggleBonusMode() - Makes bonus resources either appear or disappear.
  • CyGame().toggleCityInfoMode() - Makes city Name/food/production labels on the map either appear or disappear.
  • CyGame().toggleShowUnitsMode() - Makes unit flags and health bars, etc. either appear or disappear. (This is an odd one… you'd think it would make the units themselves either appear or disappear)
  • CyGame().toggleUnitInfoMode() - Makes unit health bars, etc. either appear or disappear. Only seems to work if you already have Health bars and enabled in the options menu.
  • CyGame().viewCity() - Seems to do nothing (from the console).

top

Economics

Object Retrieval:

  • CyGlobalContext().getCommerceInfo(int CommerceID) - Returns (obj) CommerceInfo instance associated with 'CommerceID'.
  • CyGlobalContext().getHurryInfo(int HurryID) - Returns (obj) HurryInfo instance associated with 'HurryID'.

Info:

  • CyGlobalContext().getINITIAL_TRADE_ROUTES() - Returns (int) the initial amount of trade routes given to each city when built. (Default is 1)
  • CyGlobalContext(0.getMAX_TRADE_ROUTES() - Returns (int) the maximum number of trade routes a city can have. (Default is 8)
  • CyGlobalContext().getMAX_DISTANCE_CITY_MAINTENANCE() - Returns (int) the maximum amount a city can have in maintenance due to distance. (Default is 20)
  • CyGlobalContext().getFOOD_CONSUMPTION_PER_POPULATION() - Returns (int) the amount of food eaten by each citizen. (Default is 2)
  • CyGlobalContext().getCOMMERCE_PERCENT_CHANGE_INCREMENTS() - Returns (int) [unknown]. (10 in testing)
  • CyGlobalContext().getFRESH_WATER_HEATLH_CHANGE() - [sic] Returns (int) the amount of health given by building a city next to a source of fresh water. (Default is 2)
  • CyGlobalContext().getBASE_CITY_GROWTH_THRESHOLD() - Returns (int) the amount of food necessary to grow (I think) - default is 20.
  • CyGlobalContext().getCITY_GROWTH_MULTIPLIER() - Returns (int) [unknown]. (Was 2 in testing)
  • CyGlobalContext().getCONSCRIPT_POPULATION_COST() - Returns (int) the number of population points removed from a city to conscript a unit. (Default is 1)

Assignment:

Action:

top

Player

Object Retrieval:

Info:

  • CyGame().getNumCivPlayers() - Returns (int) number of players in the game (not including barbs).
  • CyGame().getActiveCivilizationType() - Returns (int) civ ID of the active player's civilization.
  • CyGame().getActivePlayerIdx() - Returns (int) player ID of the active player.
  • CyGame().getBarbarianPlayer() - Returns (int) player ID of the barbs.
  • CyGlobalContext().getBARBARIAN_CIVILIZATION() - Returns (int) the civilization of the Barbs (unique, I think - 19).
  • CyGlobalContext().getBARBARIAN_HANDICAP() - Returns (int) the barb difficulty level (0 being Beginner - which I think is the default here).
  • CyGlobalContext().getAI_HANDICAP() - Returns (int) the AI difficulty level (0 being Beginner).
  • CyGame().getNumHumanPlayers() - Returns (int) number of human players in the game.
  • CyGame().getNumNonHumanPlayers() - Returns (int) number of NON human players.
  • CyGame().getPlayerRank(int PlayerID) - Returns (int) the rank of the 'PlayerID'.
  • CyGame().getRankPlayer(int PlayerID) - Returns (int) the rank of the 'PlayerID'.
  • CyGame().getPlayerScore(int PlayerID) - Returns (int) the 'PlayerID's score.
  • CyGame().getLastPlayerRank(int PlayerID) - Returns (int) the 'PlayerID's score on the last turn (?).

Assignment:

  • CyGame().setActivePlayer(int PlayerID) - Makes 'PlayerID' the active player; seems to be buggy.
  • CyGame().setWinner(int PlayerID) - Makes 'PlayerID' the winning player.

Action:

top

Team

Object Retrieval:

Info:

  • CyGame().isTeamGame() - Returns (bool) whether or not the game has multiple players on each team.
  • CyGame().getNumTeams() - Returns (int) number of teams in the game (including barbs).
  • CyGame().getBarbarianTeam() - Returns (int) team ID of the barbs.
  • CyGame().getNumCivTeams() - Returns (int) number of teams with ACTUAL civs (not including barbs).
  • CyGame().getRankTeam(int TeamID) - Returns (int) the rank of the 'TeamID'.
  • CyGame().getTeamRank(int TeamID) - Returns (int) the rank of the 'TeamID'.
  • CyGame().getTeamScore(int TeamID) - Returns (int) the 'TeamID's score.
  • CyGame().getWinner() - Returns (int) the player ID of the winning team? (-1 if there is no winner)

Assignment:

Action:

top

City

Object Retrieval:

  • CyGlobalContext().getBuildInfo(int BuildID) - Returns (obj) BuildInfo instance associated with 'BuildID'.
  • CyGame().getHolyCity(int Religion) - Returns (obj) holy City instance of type 'Religion'.
  • CyGlobalContext().getCityAssetInfo(int CityID) - Returns (obj) CityAssetInfo instance associated with 'CityID'?
  • CyGlobalContext().getCityArtInfo(int CityID) - Returns (obj) CityArtInfo instance associated with 'CityID'?

Info:

  • CyGame().getNumCities() - Returns (int) the total number of cities in the game.
  • CyGlobalContext().getINITIAL_CITY_POPULATION() - Returns (int) the initial city size when built for all cities. (Default is 1)
  • CyGlobalContext().getINITIAL_CITY_MAINTENANCE() - Returns (int) the initial amount of maintenance for all cities. (Default is 0)
  • CyGlobalContext().getGREAT_PEOPLE_THRESHOLD() - Returns (int) the amount of GP points necessary to spawn a GP. (Default is 50)
  • CyGlobalContext().getGREAT_PEOPLE_THRESHOLD_INCREASE() - Returns (int) the amount of GP points increase necessary to get another GP? (Default is 100)
  • CyGlobalContext().getMIN_CITY_RANGE() - Returns (int) the fewest number of tiles that must be between two cities. (Default is 2)
  • CyGlobalContext().getMAX_CULTURE_RANGE() - Returns (int) the farthest a city's culture can reach? (6 in testing)
  • CyGlobalContext().getFREE_CITY_CULTURE() - Returns (int) [unknown]. (2 in testing)
  • CyGlobalContext().getFREE_CITY_ADJACENT_CULTURE() - Returns (int) [unknown]. (1 in testing)
  • CyGlobalContext().getCULTURE_FACTOR() - Returns (int) the exponential increase necessary to increase cultural borders? (Default is 10)
  • CyGlobalContext().getDIRTY_POWER_HEATLH_CHANGE() - [sic] Returns (int) the amount
  • CyGlobalContext().getCITY_HEAL_RATE() - Returns (int) the amount units heal when in a city? (Was 20 in testing)
  • CyGlobalContext().getCITY_PLOTS_DIAMETER() - Returns (int) [unknown]. (Was 0 in testing)
  • CyGlobalContext().getCITY_PLOTS_RADIUS() - Returns (int) [unknown]. (Was 2 in testing)
  • CyGlobalContext().getCITY_SEE_FROM_CHANGE() - Returns (int) [unknown]. (Was 0 in testing)

Assignment:

Action:

top

Unit

Object Retrieval:

Info:

  • CyGlobalContext().getCommandTypes(int CommandID) - Returns (string) the string associated with 'CommandID'. (Example: COMMAND_PROMOTION or COMMAND_UPGRADE)
  • CyGame().isSpecialUnitValid(int UnitID) - Returns (int? bool?) whether or not 'UnitID' is a valid unit? (Spies?)

Assignment:

  • CyGame().makeSpecialUnitValid(int UnitID) - Makes 'UnitID' a valid unit.

Action:

top

Religion

Object Retrieval:

  • CyGame().getHolyCity(int Religion) - Returns (obj) Holy City of type 'Religion'.

Info:

  • CyGame().isReligionFounded(int ReligionID) - Returns (bool) whether or not 'ReligionID' has been founded yet (exists in any city).
  • CyGame().getReligionLevels(int ReligionID) - Returns (int) the number of cities that have 'ReligionID'?
  • CyGlobalContext().getFOUND_RELIGION_CITY_RAND() - Returns (int) [unknown]. (10 in testing)

Assignment:

Action:

top

Map

Object Retrieval:

  • CyGlobalContext().getMap() - Returns (obj) the current Map instance.
  • CyGlobalContext().getLandscape() - Returns (obj) the current Landscape instance.
  • CyGlobalContext().getFeatureInfo(int FeatureID) - Returns (obj) FeatureInfo instaance associated with 'FeatureID'.
  • CyGlobalContext().getBonusInfo(int BonusID) - Returns (obj) BonusInfo instance associated with the 'BonusID'.
  • CyGlobalContext().getBonusClassInfo(int BonusClassID) - Returns (obj) BonusClassInfo instance associated with the 'BonusClassID'.
  • CyGame().getMapRand() - Returns (obj) [unknown].

Info:

  • CyGlobalContext().getFeatureTypeForString(string FeatureName) - Returns (int) the ID of 'FeatureName'. (e.g. FEATURE_FOREST returns 4)
  • CyGlobalContext().getMAX_PLOT_LIST_SIZE() - Returns (int) [unknown]. (11 in testing)
  • CyGame().getMapRandNum() - Returns (int) [unknown].
  • CyGlobalContext().getHIGHLANDS_SEE_FROM_CHANGE() - Returns (int) the amount of extra tiles seen when on a highlands tile? (Default is 1)
  • CyGlobalContext().getHIGHLANDS_SEE_THROUGH_CHANGE() - Returns (int) [unknown]. (Default is 1)
  • CyGlobalContext().getBonusTypeForString(string BonusType) - Returns (int) the Bonus Type ID of the string you input - follows the format of "BONUS_HORSE".
  • CyGlobalContext().getBonusClassTypeForString(string BonusClass) - Returns (int) the Bonus Class ID of the string you input - follows the format of "BONUSCLASS_GENERAL" and "BONUSCLASS_METAL".
  • CyGlobalContext().getHOME_PLOT() - Returns (int) [unknown]. (Default is 0)

Assignment:

Action:

top

Building

Object Retrieval:

  • CyGlobalContext().getBuildingInfo(int BuildingID) - Returns (obj) instance of BuildingInfo associated with 'BuildingID'.
  • CyGlobalContext().getBuildingClassInfo(int BuildingClassID) - Returns (obj) instance of BuildingClassInfo associated with 'BuildingClassID'.
  • CyGlobalContext().getBuildingArtInfo(int BuildingID) - Returns (obj) instance of ArtInfo associated with 'BuildingID'.

Info:

  • CyGame().getBuildingClassCount(int BuildingClass) - Returns (int) the number of buildings of type 'BuildingClass' in the game for all players.
  • CyGame().getBuildingClassPrereqBuilding(int BuildingClass, int PrereqID) - Returns (int) the prerequisite building ID of 'BuildingClass' slot 'PrereqID'.
  • CyGame().isBuildingClassMaxedOut(int BuildingClass, int ?) - Returns (bool) whether or not the maximum instances of 'BuildingClass' are present. ? is an argument I'm not sure the function of.

Assignment:

top

Technology

Info:

  • CyGame().getKnownTechNumTeams(int TechID) - Returns (int) the number of teams that know 'TechID'? (Testing results confusing)
  • CyGlobalContext().getBASE_RESEARCH_RATE() - Returns (int) [unknown]. (2 in testing)
  • CyGlobalContext().getNUM_AND_TECH_PREREQS() - Returns (int) [unknown]. (4 in testing)

Assignment:

top

Diplomacy

Object Retrieval:

Info:

  • CyGlobalContext().getMemoryTypes(int MemoryID) - Returns (string) the name of the AI Memory type associated with 'MemoryID'. (0 returns MEMORY_DECLARED_WAR and 1 returns MEMORY_RAZED_CTY and 2 returns MEMORY_CONTACTED_US)
  • CyGlobalContext().getDiplomacyPowerTypes(int PowerID) - Returns (string) the name name of the power relation between civs associated with 'PowerID'. (e.g. "DIPLOMACYPOWER_WEAKER" or "DIPLOMACYPOWER_EQUAL")
  • CyGlobalContext().getDiploCommentTypes(int CommentID) - Returns (string) the name of the diplo comment associated with 'CommentID'. (e.g. "AI_DIPLOCOMMENT_FIRST_CONTACT" or "AI_DIPLOCOMMENT_REFUSE_TO_TALK")
  • CyGlobalContext().getAIDiploCommentTypes(int CommentID) - Returns (string) the name of the AI diplo comment associated with 'CommentID'.
  • CyGlobalContext().getAttitudeTypes(int AttitudeID) - Returns (string) the name of the different types of AI attitudes (e.g. ATTITUDE_FURIOUS) associated with the 'AttitudeID'.

Assignment:

Action:

top

Combat

Object Retrieval:

Info:

  • CyGlobalContext().getMAX_HIT_POINTS() - Returns (int) the amount of hit points units have at full strength. (Default is 100)
  • CyGlobalContext().getFRIENDLY_HEAL_RATE() - Returns (int) the amount of damage healed in friendly territory per turn? (15 in testing)
  • CyGlobalContext().getNEUTRAL_HEAL_RATE() - Returns (int) the amount of damage healed in neutral territory per turn? (10 in testing)
  • CyGlobalContext().getENEMY_HEAL_RATE() - Returns (int) the amount of damage healed in enemy territory per turn? (5 in testing)
  • CyGlobalContext().getCOMBAT_DAMAGE() - Returns (int) the amount of damage done in combat? (30 in testing)
  • CyGlobalContext().getAIR_COMBAT_DAMAGE() - Returns (int) the amount of damage done in air combat? (30 in testing).
  • CyGlobalContext().getHIGHLANDS_EXTRA_DEFENSE() - Returns (float) the extra strength modifier given to units being attacked on highlands. (Default is 0.20000000298)
  • CyGlobalContext().getAMPHIB_ATTACK_MODIFIER() - Returns (float) a fraction that amphibious attacks are multiplied by with units that don't have the Amphibious promotion (-0.5 right now).
  • CyGlobalContext().getBARBARIAN_ATTACK_EXPERIENCE_MODIFIER() - Returns (int) the fraction * 100 modifier for experience against barbs (-25 right now, meaning -25%).
  • CyGlobalContext().getBARBARIAN_DEFENSE_EXPERIENCE_MODIFIER() - Returns (int) the fraction * 100 modifier for experience against barbs (-25 right now, meaning -25%).
  • CyGlobalContext().getCOMBAT_DIE_SIDES() - Returns (int) the multiplier for random numbers when used in combat? (1000 in testing)

Assignment:

Action:

top

Interface

Object Retrieval:

  • CyGlobalContext().getLeaderheadArtInfo(int LeaderID) - Returns (obj) LeaderheadArtInfo instance associated with 'LeaderID'.
  • CyGlobalContext().getInterfaceArtInfo(int InterfaceID) - Returns (obj) InterfaceArtInfo instance associated with 'InterfaceID'.
  • CyGlobalContext().getImprovementArtInfo(int ImpID) - Returns (obj) ImprovementArtInfo instance associated with 'ImpID'.
  • CyGlobalContext().getFeatureArtInfo(int FeatureID) - Returns (obj) FeatureArtInfo instance associated with 'FeatureID'.
  • CyGlobalContext().getMiscArtInfo(int MiscArtID) - Returns (obj) MiscArtInfo instance assocaited with 'MiscArtID'.

Info:

  • CyGlobalContext().getLanguageTypes(int LanguageID) - Returns (string) the name of the language associated with 'LanguageID'. (e.g. 0 returns LANGUAGE_ENGLISH and 1 returns LANGUAGE_FRENCH)
  • CyGlobalContext().getFunctionTypes(int FunctionID) - Returns (string) the name of the FunctionType associated with 'FunctionID'. (e.g. 0 returns FUNC_NOINTERP and 1 returns FUNC_LINKEY - don't ask me what these mean!)
  • CyGame().getCloseView() - Returns (int) [unknown].
  • CyGlobalContext().getControlTypes(int ControlID) - Returns (string) of the Control Type associated with 'ControlID'. (e.g. "CONTROL_NEXTCITY" or "CONTROL_FORCEENDTURN")
  • CyGame().getSymbolID(int ID) - Returns (int) the ID of ?
  • CyGame().getSyncRand() - Returns (obj) Random object?
  • CyGame().getSyncRandNum(int ?, string ?) - Returns (int) [unknown].
  • CyGame().isCloseViewBars() - Returns (int) [unknown].
  • CyGame().isCloseViewUnits() - Returns (int) [unknown].
  • CyGlobalContext().getDYING_PAUSE() - Returns (int) [unknown]. (8 in testing… I have no clue what this does. It may belong in the Unit section but until I get more info on it it goes to General)

Assignment:

Action:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License