Global Functions (Civ5): Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
(Bot update)
 
(Bot update)
 
Line 8: Line 8:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
ADDRESOURCETYPE
ADDRESOURCETYPE
Line 282: Line 282:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
COLOR
COLOR
Line 332: Line 332:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
GETDATESTRING
GETDATESTRING
Line 361: Line 361:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
CIVICONHOOKUP
CIVICONHOOKUP
Line 404: Line 404:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
GETCITYSTATESTATUS
GETCITYSTATESTATUS
Line 517: Line 517:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
ADDFEATURES
ADDFEATURES
Line 658: Line 658:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
ADJACENTTOSALTWATER
ADJACENTTOSALTWATER
Line 785: Line 785:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
GETCIVSTATEQUESTSTRING
GETCIVSTATEQUESTSTRING
Line 849: Line 849:
{|cellspacing="4" cellpadding="0" width="100%"  
{|cellspacing="4" cellpadding="0" width="100%"  
|-
|-
| [[File:civ5-16.png|Base game]] || [[File:gk-16.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
| [[File:Civ5-16.png|Base game]] || [[File:GK.png|Gods &amp; Kings]] || || || <code style="visibility:hidden;">___________________________</code>
<!--  
<!--  
TRUNCATESTRING
TRUNCATESTRING

Latest revision as of 15:10, 19 September 2012

This page is a part of the Lua and UI Reference (Civ5).


Built-in functions

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png bool AddResourceType()
Check.png Check.png Star.png Speech.png ChangeBuildingSize(float arg0)
Check.png Check.png Star.png Speech.png FOW_SetAll(FogOfWarModeType fogOfWarType)
Check.png Check.png Star.png Speech.png int getEndTurnTimerLength()
Check.png Check.png Star.png Speech.png table(int => OverlayInfo) GetOverlayLegend()
Check.png Check.png Star.png Speech.png table(InfoCornerID => string) GetStrategicViewIconSettings()
Check.png Check.png Star.png Speech.png table(InfoCornerID => string) GetStrategicViewOverlays()
Check.png Check.png Star.png Speech.png ActionType GetVolumeKnobIDFromName(string arg0)
Check.png Check.png Star.png Speech.png int GetVolumeKnobValue(ActionType musicVolumeKnob)
Check.png Check.png Star.png Speech.png int, int, int GridToWorld(ResourceType gridX, int gridY)
Check.png Check.png Star.png Speech.png Vector3 HexToWorld(Vector2 hexPos)
Check.png Check.png Star.png Speech.png Ice_Reload()
Check.png Check.png Star.png Speech.png bool InStrategicView()
Check.png Check.png Star.png Speech.png Context LookUpControl(string arg0)
Check.png Check.png Star.png Speech.png bool MouseOverStrategicViewResource()
Check.png Check.png Star.png Speech.png bool ProcessStrategicViewMouseClick()
Check.png Check.png Star.png Speech.png ReloadTextures(int arg0, int arg1)
Check.png Check.png Star.png Speech.png ResetAchievements()
Check.png Check.png Star.png Speech.png SaveAudioOptions()
Check.png Check.png Star.png Speech.png SetSelectedCiv()
Check.png Check.png Star.png Speech.png SetStrategicViewIconSetting(int index)
Check.png Check.png Star.png Speech.png SetStrategicViewOverlay(int index)
Check.png Check.png Star.png Speech.png SetVolumeKnobValue(ActionType musicVolumeKnob, int cachedMusicVolumeKnob)
Check.png Check.png Star.png Speech.png StrategicViewShowFeatures(bool isChecked)
Check.png Check.png Star.png Speech.png StrategicViewShowFogOfWar(bool isChecked)
Check.png Check.png Star.png Speech.png TogglePauseGameplay(bool pauseGameplay)
Check.png Check.png Star.png Speech.png ToggleStrategicView()
Check.png Check.png Star.png Speech.png ResourceType, PlayerID ToGridFromHex(float i, float j)
Check.png Check.png Star.png Speech.png Vector2 ToHexFromGrid(Vector2 gridPos)
Check.png Check.png Star.png Speech.png bool UnitMoving(PlayerID player, UnitID unit)
Check.png Check.png Star.png Speech.png Water_SetAmplitude(int waterAmplitude)
Check.png Check.png Star.png Speech.png Water_SetAutoReload(bool waterReload)
Check.png Check.png Star.png Speech.png Water_SetFlowParameters(int waterFlowStrength, int waterNoiseStrength, int waterNoiseScale)
Check.png Check.png Star.png Speech.png Water_SetGradientScale(int waterGradientScale)
Check.png Check.png Star.png Speech.png Water_SetScale(int waterScale)
Check.png Check.png Star.png Speech.png Water_SetSpec(int waterSunSpec, int waterSkySpec)
Check.png Check.png Star.png Speech.png Water_SetSpeed(int waterScrollSpeed)
Check.png Check.png Star.png Speech.png Waves_Reload()


FLuaVector.lua

Those functions are declared in FLuaVector.lua. Use: include("FLuaVector")

Base game Gods & Kings ___________________________
CheckButZero.png CheckButZero.png Star.png Speech.png Vector4 Color(float r, float g, float b, float a)
Check.png Check.png Star.png Speech.png unknown VecAdd(unknown v1, unknown v2)
CheckButZero.png CheckButZero.png Star.png Speech.png unknown VecSubtract(unknown v1, unknown v2)
Check.png Check.png Star.png Speech.png Vector2 Vector2(float i, float j)
Check.png Check.png Star.png Speech.png Vector3 Vector3(float i, float j, float k)
Check.png Check.png Star.png Speech.png Vector4 Vector4(float i, float j = nil, float k = nil, float l = nil)


GameCalendarUtilities.lua

Those functions are declared in GameCalendarUtilities.lua. Use: include("GameCalendarUtilities")

Base game Gods & Kings ___________________________
CheckButZero.png CheckButZero.png Star.png Speech.png string GetDateString(int gameTurn, unknown calendarType, unknown gameSpeedType, int startYear)
Check.png Check.png Star.png Speech.png string GetDefaultYearString(int year)
Check.png Check.png Star.png Speech.png string GetShortDateString(int gameTurn, unknown calendarType, unknown gameSpeedType, int startYear)


IconSupport.lua

Those functions are declared in IconSupport.lua. Use: include("IconSupport")

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png CivIconHookup(PlayerID player, int iconSize, Image iconControl, Image teamColorControl, int shadowIconControl, int alwaysUseComposite, int shadowed)
Check.png Check.png Star.png Speech.png bool IconHookup(int offset, float iconSize, string atlas, Image imageControl, unknown debugPrint = nil)
Check.png Check.png Star.png Speech.png Vector2, string IconLookup(int offset, int iconSize, string atlas)
Check.png Check.png Star.png Speech.png PopulateIconAtlases()
Check.png Check.png Star.png Speech.png bool SimpleCivIconHookup(PlayerID player, int iconSize, Image iconControl)


InfoTooltipInclude.lua

Those functions are declared in InfoTooltipInclude.lua. Use: include("InfoTooltipInclude")

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png string GetCityStateStatus(Player player, PlayerID forPlayer, int war)
Check.png Check.png Star.png Speech.png string GetCultureTooltip(City city)
Cross.png Check.png Star.png Speech.png string GetFaithTooltip(City city)
Check.png Check.png Star.png Speech.png string GetFoodTooltip(City city)
Check.png Check.png Star.png Speech.png string GetGoldTooltip(City city)
Check.png Check.png Star.png Speech.png string GetHelpTextForBuilding(BuildingType building, bool excludeName, bool excludeHeader, bool noMaintenance)
Check.png Check.png Star.png Speech.png string GetHelpTextForImprovement(ImprovementType improvement, bool excludeName, bool excludeHeader, bool noMaintenance)
Check.png Check.png Star.png Speech.png string GetHelpTextForProject(ProjectType project, bool includeRequirementsInfo)
Check.png Check.png Star.png Speech.png string GetHelpTextForUnit(UnitType unit, bool includeRequirementsInfo)
Check.png Check.png Star.png Speech.png string GetMoodInfo(PlayerID otherPlayer)
Check.png Check.png Star.png Speech.png string GetProductionTooltip(City city)
Cross.png Check.png Star.png Speech.png string GetReligionTooltip(City city)
Check.png Check.png Star.png Speech.png string GetScienceTooltip(City city)
Check.png Check.png Star.png Speech.png string GetYieldTooltip(City city, YieldType yieldType, int base, int total, string iconString, string modifiersString)
Check.png Check.png Star.png Speech.png string GetYieldTooltipHelper(City city, YieldType yieldType, string icon)


MapGenerator.lua

Those functions are declared in MapGenerator.lua. Use: include("MapGenerator")

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png AddFeatures()
Check.png Check.png Star.png Speech.png bool AddGoodies()
Check.png Check.png Star.png Speech.png AddLakes()
Check.png Check.png Star.png Speech.png bool AddRivers()
Check.png Check.png Star.png Speech.png bool CanPlaceGoodyAt(ImprovementType improvement, Plot plot)
Check.png Check.png Star.png Speech.png DetermineContinents()
Check.png Check.png Star.png Speech.png DoRiver(Plot startPlot, FlowDirectionType thisFlowDirection = nil, FlowDirectionType originalFlowDirection = nil, int riverID = nil)
Check.png Check.png Star.png Speech.png GenerateCoasts(int args = nil)
Check.png Check.png Star.png Speech.png GenerateMap()
Check.png Check.png Star.png Speech.png GeneratePlotTypes()
Check.png Check.png Star.png Speech.png GenerateTerrain()
Check.png Check.png Star.png Speech.png ... GetCoreMapOptions()
Check.png Check.png Star.png Speech.png FlowDirectionType GetOppositeFlowDirection(FlowDirectionType dir)
Check.png Check.png Star.png Speech.png int GetRiverValueAtPlot(Plot plot)
Check.png Check.png Star.png Speech.png iterator() Plots((void func(table(int => int) t)) sort = nil)
Check.png Check.png Star.png Speech.png SetPlotTypes(table(int => PlotType) plotTypes)
Check.png Check.png Star.png Speech.png SetTerrainTypes(table(int => TerrainType) terrainTypes)
Check.png Check.png Star.png Speech.png func(table(int => int) t)
Check.png Check.png Star.png Speech.png StartPlotSystem()


MapmakerUtilities.lua

Those functions are declared in MapmakerUtilities.lua. Use: include("MapmakerUtilities")

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png int AdjacentToSaltWater(int x, int y)
Check.png Check.png Star.png Speech.png bool CivNeedsCoastalStart(string civType)
Check.png Check.png Star.png Speech.png bool CivNeedsRiverStart(string civType)
Check.png Check.png Star.png Speech.png table(int => bool) GenerateCoastalLandDataTable()
Check.png Check.png Star.png Speech.png table(int => bool), table(int => int) GenerateNextToCoastalLandDataTables()
Check.png Check.png Star.png Speech.png int GetNumStartRegionAvoidForCiv(string civType)
Check.png Check.png Star.png Speech.png int GetNumStartRegionPriorityForCiv(string civType)
Check.png Check.png Star.png Speech.png int, int, table(int => PlayerID), bool, table(int => int), table GetPlayerAndTeamInfo()
Check.png Check.png Star.png Speech.png table(int => PlayerID) GetShuffledCopyOfTable(table(int => int) incoming_table)
Check.png Check.png Star.png Speech.png table(int => int) GetStartRegionAvoidListForCiv_GetIDs(string civType)
CheckButZero.png CheckButZero.png Star.png Speech.png GetStartRegionAvoidListForCiv_GetTypes(unknown civType)
Check.png Check.png Star.png Speech.png table(int => int) GetStartRegionPriorityListForCiv_GetIDs(string civType)
CheckButZero.png CheckButZero.png Star.png Speech.png GetStartRegionPriorityListForCiv_GetTypes(unknown civType)
Check.png Check.png Star.png Speech.png bool, int, table(int => int) IdentifyTableIndex(table(int => PlayerID) incoming_table, PlayerID value)
Check.png Check.png Star.png Speech.png table(int => int) ObtainLandmassBoundaries(AreaID areaID)
Check.png Check.png Star.png Speech.png PrintContentsOfTable(table(int => int) incoming_table)
Check.png Check.png Star.png Speech.png int TestMembership(table(int => PlayerID) table, PlayerID value)


PlotMouseoverInclude.lua

Those functions are declared in PlotMouseoverInclude.lua. Use: include("PlotMouseoverInclude")

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png string GetCivStateQuestString(Plot plot, bool shortVersion)
Check.png Check.png Star.png Speech.png string GetImprovementString(Plot plot)
Check.png Check.png Star.png Speech.png string GetNatureString(Plot plot)
Check.png Check.png Star.png Speech.png string GetOwnerString(Plot plot)
Check.png Check.png Star.png Speech.png string GetResourceString(Plot plot, bool longForm)
Check.png Check.png Star.png Speech.png string GetUnitsString(Plot plot)
Check.png Check.png Star.png Speech.png string GetYieldString(Plot plot)
Check.png Check.png Star.png Speech.png bool IsFeatureSpecial(FeatureType feature)


SupportFunctions.lua

Those functions are declared in SupportFunctions.lua. Use: include("SupportFunctions")

Base game Gods & Kings ___________________________
Check.png Check.png Star.png Speech.png TruncateString(Label control, int resultSize, string longStr, string trailingText = nil)



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.