1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

LUA Events

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Bhruic, Sep 29, 2010.

  1. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    This should be a complete list of the various Events.XX that you can hook into. Wanted a list for myself, figured others might be interested as well.

    AppInitComplete
    CameraViewChanged
    CameraProjectionChanged
    AnimationSamplingChanged
    DontRecordCommandStreams
    RecordCommandStreams
    CityHandleCreated
    UnitHandleCreated
    UnitTypeChanged
    WonderTypeChanged
    WonderStateChanged
    WonderTogglePlacement
    ToggleDisplayUnits
    GlobalUnitScale
    LandmarkLibrarySwap
    UnitLibrarySwap
    BuildingLibrarySwap
    SequenceGameInitComplete
    StateMachineDumpStates
    StateMachineRequestStates
    StrategicViewStateChanged
    SerialEventHexSelected
    SerialEventHexDeSelected
    SerialEventMouseOverHex
    SerialEventTest
    SerialEventTestAnimations
    SerialEventStartGame
    SerialEventCameraBack
    SerialEventCameraStartMovingBack
    SerialEventCameraStopMovingBack
    SerialEventCameraForward
    SerialEventCameraStartMovingForward
    SerialEventCameraStopMovingForward
    SerialEventCameraLeft
    SerialEventCameraStartMovingLeft
    SerialEventCameraStopMovingLeft
    SerialEventCameraRight
    SerialEventCameraStartMovingRight
    SerialEventCameraStopMovingRight
    CameraStartRotatingCW
    CameraStopRotatingCW
    CameraStartRotatingCCW
    CameraStopRotatingCCW
    CameraStartPitchingUp
    CameraStopPitchingUp
    CameraStartPitchingDown
    CameraStopPitchingDown
    SerialEventCameraIn
    SerialEventCameraOut
    SerialEventCameraSetCenterAndZoom
    SerialEventScreenShot
    SerialEventHexGridOn
    SerialEventHexGridOff
    SerialEventHexHighlight
    SerialEventHexCultureChanged
    ClearHexHighlights
    ClearHexHighlightStyle
    SerialEventTerrainOverlayMod
    SerialEventTerrainDecalCreated
    SerialEventEraChanged
    SerialEventCityCreated
    CityRuinsCreated
    SerialEventCityCaptured
    SerialEventCityDestroyed
    SerialEventCityCultureChanged
    SerialEventCityPopulationChanged
    SerialEventCitySetDamage
    SerialEventEnterCityScreen
    SerialEventExitCityScreen
    SerialEventBuildingSizeChanged
    EventOpenOptionsScreen
    SerialEventCityContinentChanged
    SerialEventRoadCreated
    SerialEventRoadDestroyed
    SerialEventFeatureCreated
    SerialEventFeatureDestroyed
    SerialEventRawResourceCreated
    SerialEventRawResourceDestroyed
    SerialEventRawResourceIconCreated
    SerialEventRawResourceIconDestroyed
    SerialEventImprovementCreated
    SerialEventImprovementDestroyed
    SerialEventImprovementIconCreated
    SerialEventImprovementIconDestroyed
    SerialEventForestCreated
    SerialEventForestRemoved
    SerialEventJungleCreated
    SerialEventJungleRemoved
    SerialEventUnitCreated
    SerialEventUnitDestroyed
    UnitVisibilityChanged
    UnitHexHighlight
    SerialEventUnitSetDamage
    UnitActionChanged
    UnitEmbark
    UnitGarrison
    UnitShouldDimFlag
    UnitMarkThreatening
    SerialEventUnitMoveToHexes
    SerialEventUnitMove
    SerialEventUnitTeleportedToHex
    SerialEventUnitFacingChanged
    UnitSelectionChanged
    UnitSelectionCleared
    UnitFlagUpdated
    UnitDataEdited
    UnitDataRequested
    UnitDebugFSM
    GameOptionsChanged
    GraphicsOptionsChanged
    SerialEventLeaderToggleDebugCam
    SerialEventUnitFlagSelected
    SerialEventGameMessagePopup
    SerialEventGameMessagePopupShown
    SerialEventGameMessagePopupProcessed
    SerialEventDawnOfManShow
    SerialEventDawnOfManHide
    HexFOWStateChanged
    GameplayAlertMessage
    InterfaceModeChanged
    HexYieldMightHaveChanged
    ExitToMainMenu
    NotificationAdded
    NotificationRemoved
    NotificationActivated
    ActivePlayerTurnStart
    ActivePlayerTurnEnd
    RemotePlayerTurnEnd
    TechAcquired
    PlayerChoseToLoadGame
    PlayerChoseToLoadMap
    UIPathFinderUpdate
    DisplayMovementIndicator
    NotifyAILeaderInGame
    AILeaderMessage
    TeamMet
    WarStateChanged
    SerialEventCityScreenDirty
    SerialEventCityInfoDirty
    SerialEventCityHexHighlightDirty
    EventPoliciesDirty
    SerialEventInfoPaneDirty
    SerialEventUnitInfoDirty
    SerialEventGameDataDirty
    SerialEventTurnTimerDirty
    SerialEventResearchDirty
    SerialEventEndTurnDirty
    SerialEventScoreDirty
    SpecificCityInfoDirty
    ClearDiplomacyTradeTable
    ShowMovementRange
    ShowAttackTargets
    SpawnArrowEvent
    RemoveAllArrowsEvent
    AdvisorDisplayShow
    AdvisorDisplayHide
    EndGameShow
    TaskListUpdate
    EndTurnTimerUpdate
    AddPopupTextEvent
    MultiplayerConnectionComplete
    MultiplayerConnectionFailed
    MultiplayerJoinRoomAttempt
    MultiplayerJoinRoomComplete
    MultiplayerJoinRoomFailed
    MultiplayerGameLaunched
    MultiplayerProfileDisconnected
    MultiplayerProfileFailed
    MultiplayerGameListClear
    MultiplayerGameListUpdated
    MultiplayerGameListComplete
    MultiplayerGamePlayerUpdated
    MultiplayerGameAbandoned
    ConnectedToNetworkHost
    PreGameDirty
    MultiplayerGamePlayerDisconnected
    SearchForPediaEntry GoToPediaHomePage
    GameplaySetActivePlayer
    GameMessageChat
    OpenPlayerDealScreenEvent
    OpenInfoCorner
    NaturalWonderRevealed
    GameplayFX
    UnitMoveQueueChanged
    FrontEndPopup
    GenericWorldAnchor
    LoadScreenClose
    InitCityRangeStrike
    LocalMachineUnitPositionChanged
    LocalMachineAppUpdate
    UnitStateChangeDetected
    UnitHexHighlight
    AudioDebugChangeMusic
    AudioVolumeChanged
    ParticleEffectReloadRequested
    ParticleEffectStatsRequested
    ParticleEffectStatsResponse
    KeyUpEvent
    ToolTipEvent
    VisibilityUpdated
    UnitMemberOverlayAdd
    UnitMemberOverlayRemove
    UnitMemberOverlayShowHide
    UnitMemberOverlayMessage
    UnitMemberOverlayTargetColor
    UnitMemberPositionChanged
    UnitMemberCombatTargetChanged
    UnitMemberCombatStateChanged
    ClearUnitMoveHexRange
    StartUnitMoveHexRange
    AddUnitMoveHexRangeHex
    EndUnitMoveHexRange
    AudioPlay2DSound
    RequestYieldDisplay
    ShowHexYield
    LanguageChanging
    ModDownloadStarted
    ModDownloadComplete
    InstalledModsUpdated
    BeforeModsActivate
    AfterModsActivate
    BeforeModsDeactivate
    AfterModsDeactivate
    MinimapClickedEvent
    MinimapTextureBroadcastEvent
    RunCombatSim
    EndCombatSim
    DragCamera
    SystemUpdateUI
    WorldMouseOver
    UserRequestClose
    LeavingLeaderViewMode

    Bh
     
  2. CrazyAce

    CrazyAce Prince

    Joined:
    Jun 16, 2004
    Messages:
    396
    Location:
    I'm here, soon to be there.
    Nice, now can you do one for XML?
     
  3. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,539
    Gender:
    Male
    Location:
    Canberra, Australia
    Or if you what them alphabetically which may not be perfect either because of all the "SerialEvent" and "MultiplayerGame" prefixes.

    AppInitComplete
    ActivePlayerTurnEnd
    ActivePlayerTurnStart
    AddPopupTextEvent
    AddUnitMoveHexRangeHex
    AdvisorDisplayHide
    AdvisorDisplayShow
    AfterModsActivate
    AfterModsDeactivate
    AILeaderMessage
    AnimationSamplingChanged
    AudioDebugChangeMusic
    AudioPlay2DSound
    AudioVolumeChanged
    BeforeModsActivate
    BeforeModsDeactivate
    BuildingLibrarySwap
    CameraProjectionChanged
    CameraStartPitchingDown
    CameraStartPitchingUp
    CameraStartRotatingCCW
    CameraStartRotatingCW
    CameraStopPitchingDown
    CameraStopPitchingUp
    CameraStopRotatingCCW
    CameraStopRotatingCW
    CameraViewChanged
    CityHandleCreated
    CityRuinsCreated
    ClearDiplomacyTradeTable
    ClearHexHighlights
    ClearHexHighlightStyle
    ClearUnitMoveHexRange
    ConnectedToNetworkHost
    DisplayMovementIndicator
    DontRecordCommandStreams
    DragCamera
    EndCombatSim
    EndGameShow
    EndTurnTimerUpdate
    EndUnitMoveHexRange
    EventOpenOptionsScreen
    EventPoliciesDirty
    ExitToMainMenu
    FrontEndPopup
    GameMessageChat
    GameOptionsChanged
    GameplayAlertMessage
    GameplayFX
    GameplaySetActivePlayer
    GenericWorldAnchor
    GlobalUnitScale
    GraphicsOptionsChanged
    HexFOWStateChanged
    HexYieldMightHaveChanged
    InitCityRangeStrike
    InstalledModsUpdated
    InterfaceModeChanged
    KeyUpEvent
    LandmarkLibrarySwap
    LanguageChanging
    LeavingLeaderViewMode
    LoadScreenClose
    LocalMachineAppUpdate
    LocalMachineUnitPositionChanged
    MinimapClickedEvent
    MinimapTextureBroadcastEvent
    ModDownloadComplete
    ModDownloadStarted
    MultiplayerConnectionComplete
    MultiplayerConnectionFailed
    MultiplayerGameAbandoned
    MultiplayerGameLaunched
    MultiplayerGameListClear
    MultiplayerGameListComplete
    MultiplayerGameListUpdated
    MultiplayerGamePlayerDisconnected
    MultiplayerGamePlayerUpdated
    MultiplayerJoinRoomAttempt
    MultiplayerJoinRoomComplete
    MultiplayerJoinRoomFailed
    MultiplayerProfileDisconnected
    MultiplayerProfileFailed
    NaturalWonderRevealed
    NotificationActivated
    NotificationAdded
    NotificationRemoved
    NotifyAILeaderInGame
    OpenInfoCorner
    OpenPlayerDealScreenEvent
    ParticleEffectReloadRequested
    ParticleEffectStatsRequested
    ParticleEffectStatsResponse
    PlayerChoseToLoadGame
    PlayerChoseToLoadMap
    PreGameDirty
    RecordCommandStreams
    RemotePlayerTurnEnd
    RemoveAllArrowsEvent
    RequestYieldDisplay
    RunCombatSim
    SearchForPediaEntry GoToPediaHomePage
    SequenceGameInitComplete
    SerialEventBuildingSizeChanged
    SerialEventCameraBack
    SerialEventCameraForward
    SerialEventCameraIn
    SerialEventCameraLeft
    SerialEventCameraOut
    SerialEventCameraRight
    SerialEventCameraSetCenterAndZoom
    SerialEventCameraStartMovingBack
    SerialEventCameraStartMovingForward
    SerialEventCameraStartMovingLeft
    SerialEventCameraStartMovingRight
    SerialEventCameraStopMovingBack
    SerialEventCameraStopMovingForward
    SerialEventCameraStopMovingLeft
    SerialEventCameraStopMovingRight
    SerialEventCityCaptured
    SerialEventCityContinentChanged
    SerialEventCityCreated
    SerialEventCityCultureChanged
    SerialEventCityDestroyed
    SerialEventCityHexHighlightDirty
    SerialEventCityInfoDirty
    SerialEventCityPopulationChanged
    SerialEventCityScreenDirty
    SerialEventCitySetDamage
    SerialEventDawnOfManHide
    SerialEventDawnOfManShow
    SerialEventEndTurnDirty
    SerialEventEnterCityScreen
    SerialEventEraChanged
    SerialEventExitCityScreen
    SerialEventFeatureCreated
    SerialEventFeatureDestroyed
    SerialEventForestCreated
    SerialEventForestRemoved
    SerialEventGameDataDirty
    SerialEventGameMessagePopup
    SerialEventGameMessagePopupProcessed
    SerialEventGameMessagePopupShown
    SerialEventHexCultureChanged
    SerialEventHexDeSelected
    SerialEventHexGridOff
    SerialEventHexGridOn
    SerialEventHexHighlight
    SerialEventHexSelected
    SerialEventImprovementCreated
    SerialEventImprovementDestroyed
    SerialEventImprovementIconCreated
    SerialEventImprovementIconDestroyed
    SerialEventInfoPaneDirty
    SerialEventJungleCreated
    SerialEventJungleRemoved
    SerialEventLeaderToggleDebugCam
    SerialEventMouseOverHex
    SerialEventRawResourceCreated
    SerialEventRawResourceDestroyed
    SerialEventRawResourceIconCreated
    SerialEventRawResourceIconDestroyed
    SerialEventResearchDirty
    SerialEventRoadCreated
    SerialEventRoadDestroyed
    SerialEventScoreDirty
    SerialEventScreenShot
    SerialEventStartGame
    SerialEventTerrainDecalCreated
    SerialEventTerrainOverlayMod
    SerialEventTest
    SerialEventTestAnimations
    SerialEventTurnTimerDirty
    SerialEventUnitCreated
    SerialEventUnitDestroyed
    SerialEventUnitFacingChanged
    SerialEventUnitFlagSelected
    SerialEventUnitInfoDirty
    SerialEventUnitMove
    SerialEventUnitMoveToHexes
    SerialEventUnitSetDamage
    SerialEventUnitTeleportedToHex
    ShowAttackTargets
    ShowHexYield
    ShowMovementRange
    SpawnArrowEvent
    SpecificCityInfoDirty
    StartUnitMoveHexRange
    StateMachineDumpStates
    StateMachineRequestStates
    StrategicViewStateChanged
    SystemUpdateUI
    TaskListUpdate
    TeamMet
    TechAcquired
    ToggleDisplayUnits
    ToolTipEvent
    UIPathFinderUpdate
    UnitActionChanged
    UnitDataEdited
    UnitDataRequested
    UnitDebugFSM
    UnitEmbark
    UnitFlagUpdated
    UnitGarrison
    UnitHandleCreated
    UnitHexHighlight
    UnitHexHighlight
    UnitLibrarySwap
    UnitMarkThreatening
    UnitMemberCombatStateChanged
    UnitMemberCombatTargetChanged
    UnitMemberOverlayAdd
    UnitMemberOverlayMessage
    UnitMemberOverlayRemove
    UnitMemberOverlayShowHide
    UnitMemberOverlayTargetColor
    UnitMemberPositionChanged
    UnitMoveQueueChanged
    UnitSelectionChanged
    UnitSelectionCleared
    UnitShouldDimFlag
    UnitStateChangeDetected
    UnitTypeChanged
    UnitVisibilityChanged
    UserRequestClose
    VisibilityUpdated
    WarStateChanged
    WonderStateChanged
    WonderTogglePlacement
    WonderTypeChanged
    WorldMouseOver

    I am having designers block so looking for documentation I can do :)
     
  4. Zetetic Apparat

    Zetetic Apparat Warlord

    Joined:
    Jul 19, 2006
    Messages:
    276
    Are these lists semi-useless without knowing the format of the callbacks?
     
  5. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    I've linked to here from the Lua/UI Reference on the modiki; unfortunately I'm not sure how I want to do that section so the only thing there is that link, but it's a start.
     
  6. MerakSpielman

    MerakSpielman Warlord

    Joined:
    Oct 27, 2005
    Messages:
    217
    If you want to design a UI from scratch, it's useful to know what functions exist for getting data out of the game engine. A little trial and error won't hurt anybody.
     
  7. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    Why should we waste our time doing that?
    All that is needed is for Firaxis to release the information they already got that we are missing to get on with some more serious modding. :)
     
  8. Cope

    Cope Chieftain

    Joined:
    Sep 30, 2010
    Messages:
    35
    Until Firaxis releases some more info the easiest thing to do is probably to find an example of the event in the .lua files with Windows Grep.
     
  9. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Documenting 100k+ lines of code takes time.

    Bhruic, how did you compile this list?
     
  10. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    Do you really think that they have been working with the code all along without having documented the structure of the various incomming/outgoing parameters for/from the various functions for internal use?!

    In any case then we don't need detailed 'documentation' - just a list of what parameters each functions takes and delivers ... and if they haven't had a list like that ready for months then I am surprised the game is working at all.
     
  11. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Yes. Have you ever seen the Civ4 Source Code? 0 Documentation.

    Last time, they wrote a script to do that, but that was months after Civ4 was out.
     
  12. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    @Afforess:
    I can only assume that you never actually worked on any major group effort programming project or if you have (but never kept a shared and constantly updated reference list of parameters for all functions among the group members) you now have the answer as to why it was such a painfull process.

    It can pose enough problems if you don't keep such a list for your own personal use as a solo programmer, but it is the source of all evil if you don't keep such a list when several people are working on the same project - and Murphy's Law often apply here.

    Also, you don't keep such a list within the actual code anyway (the odd brief comments for later debugging aside).

    But even if we assume that Firaxis does not already have such a list, then compiling the various Civ5 equiliants of the Civ4 "Interface" code files would take less than an hour - and it would give us the parameters required for each function. If they were furthermore willing to spend a few more hours then they could easily add a brief detail on the format of the objects returned by the few functions that return object data.
     
  13. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    I don't see your point. I'm not arguing against documentation, and I too want the full documentation for civ5. I was simply informing you of firaxis's past actions.
     
  14. CyberChrist

    CyberChrist You caught my attention

    Joined:
    Dec 6, 2001
    Messages:
    1,424
    Location:
    The Matrix
    My point is just that it would take little to no effort on Firaxis' part to deliver the information we need to get properly started on using LUA for mods - and doing so would save us from having to waste time on making blind calls to the DLL trying to uncover the structure by trial and error.
     
  15. Bhruic

    Bhruic Emperor

    Joined:
    Nov 15, 2005
    Messages:
    1,457
    I ran a disassembler on the executable. I also picked up all of the available function calls, but there are too many of those to be able to post nicely. Hopefully someone from Firaxis will post them all on the wiki so that I don't have to. :)

    Bh
     
  16. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    Bhruic, even a messy list of function calls would be nice to see. It's good material for trial and error.
     
  17. ArgentumStudios

    ArgentumStudios Warlord

    Joined:
    Sep 18, 2010
    Messages:
    122
    Location:
    Utah, US
    There are 1105 exported functions in the core dll. Most don't map 1:1 with the Lua API, but I can post them if people really want to see them. I am working on a project that should give us a better reference into the actual Lua API that I am hoping to have done in the next day or two.
     
  18. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Yes please. I was able to successfully able to guess a new function call for my first modcomp, but it took me ages to figure everything out. Even just a text file with a giant list would be fine. ;)
     
  19. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    thanks Bhruic!

    is there a list for game objects functions such as Player, City etc?
     
  20. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Lol, there was a Lua API included in Modbuddy all along. I found it in "C:\Program Files (x86)\Steam\steamapps\common\sid meier's civilization v sdk\ModBuddy\Help"
     

Share This Page