Pazyryk
Deity
- Joined
- Jun 13, 2008
- Messages
- 3,584
As far as I know that is the only reason it might not be writable. The game engine creates this db (and path if needed) or overwrites the existing one whenever you start a new game. And overwrites it again (I think) on game load (or at least the data is cleaned out, in any case).I don't know if either method would actually clear the table if the database was not writable for some reason (open in a database viewer, for example.)
But if it can't write, or doesn't find anything on load, then you probably want a terminal error anyway, don't you? Maybe it depends on how extensively you depend on that persisted data. For Éa, there is no recovery if the Lua data isn't there for some reason. (And anyway, it's only me the modder that is likely to make the mistake of having that db open in a viewer.)
Yeah, I've been editing text in OP. I only recently implemented the dll mod to add a GameSave event. But I still think there may be easier and better ways to implement the Lua-only game save hack. There are a whole lot of (entirely undocumented) Events fired by the game engine. Some are worth testing:
ExitToMainMenu --I'm not sure if this fires when you exit game to the real main menu or if it fires when you go to the game menu that appears when you click Esc or Menu in the top panel. If the later, then this would be a better way to knock off both "menu saves" (quick and regular) that you get to via this menu. (The keyboard shortcuts cntr-S and F11 are easy enough to intercept as shown in OP.)
AIProcessingEndedForPlayer -- Perhaps this fires at the end of the barb turn before the autosave (assuming player has default PostTurnAutosaves = 0 in their config file)? If so, then running TableSave from that (after testing current player = 63) would work and solve a major problem.
There might be some other useful Event to use, but these have to be tested empirically (since they are all fired from the exe that we don't have source code for). Here's the full set:
Spoiler :
AbortCombatSim, ActivePlayerTurnEnd, ActivePlayerTurnStart, AddPopupTextEvent, AddUnitMoveHexRangeHex, AdvisorDisplayHide, AdvisorDisplayShow, AfterModsActivate, AfterModsDeactivate, AILeaderMessage, AIProcessingEndedForPlayer, AIProcessingStartedForPlayer, AIProcessingStepChanged, AnimationSamplingChanged, AppInitComplete, AudioAdvanceCurrentPlaylistTrack, AudioDebugChangeMusic, AudioPlay2DSound, AudioRewindCurrentPlaylistTrack, AudioVolumeChanged, BeforeModsActivate, BeforeModsDeactivate, BuildingLibrarySwap, CameraProjectionChanged, CameraStartPitchingDown, CameraStartPitchingUp, CameraStartRotatingCCW, CameraStartRotatingCW, CameraStopPitchingDown, CameraStopPitchingUp, CameraStopRotatingCCW, CameraStopRotatingCW, CameraViewChanged, ChangeGameState, CityDestroyedRazedClearedAndSalted, CityHandleCreated, CityRuinsCreated, ClearDiplomacyTradeTable, ClearHexHighlights, ClearHexHighlightStyle, ClearUnitMoveHexRange, ConnectedToNetworkHost, DisplayMovementIndicator, DontRecordCommandStreams, DragCamera, EndCombatSim, EndGameShow, EndTurnBlockingChanged, EndTurnTimerUpdate, EndUnitMoveHexRange, Event_ToggleTradeRouteDisplay, EventOpenOptionsScreen, EventPoliciesDirty, ExitToMainMenu, FloodplainCreated, FrontEndPopup, GameMessageChat, GameOptionsChanged, GameplayAlertMessage, GameplayFX, GameplaySetActivePlayer, GameViewTypeChanged, GenericWorldAnchor, GlobalUnitScale, GoldenAgeEnded, GoldenAgeStarted, GoToPediaHomePage, GraphicsOptionsChanged, GreatWallCreated, HexFOWStateChanged, HexYieldMightHaveChanged, InitCityRangeStrike, InterfaceModeChanged, KeyUpEvent, LandmarkLibrarySwap, LanguageChanging, Leaderboard_ScoresDownloaded, LeavingLeaderViewMode, LoadScreenClose, LocalMachineAppUpdate, LocalMachineUnitPositionChanged, MarshCreated, MarshRemoved, MinimapClickedEvent, MinimapTextureBroadcastEvent, MultiplayerConnectionComplete, MultiplayerConnectionFailed, MultiplayerGameAbandoned, MultiplayerGameHostMigration, MultiplayerGameInvite, MultiplayerGameLastPlayer, MultiplayerGameLaunched, MultiplayerGameListClear, MultiplayerGameListComplete, MultiplayerGameListUpdated, MultiplayerGamePlayerDisconnected, MultiplayerGamePlayerUpdated, MultiplayerHotJoinCompleted, MultiplayerHotJoinStarted, MultiplayerJoinRoomAttempt, MultiplayerJoinRoomComplete, MultiplayerJoinRoomFailed, MultiplayerPingTimesChanged, MultiplayerProfileDisconnected, MultiplayerProfileFailed, NaturalWonderRevealed, NewGameTurn, NotificationActivated, NotificationAdded, NotificationRemoved, NotifyAILeaderInGame, OpenInfoCorner, OpenPlayerDealScreenEvent, ParticleEffectReloadRequested, ParticleEffectStatsRequested, ParticleEffectStatsResponse, PlayerChoseToLoadGame, PlayerChoseToLoadMap, PlayerVersionMismatchEvent, PreGameDirty, RandomSeedSet, RecordCommandStreams, RemotePlayerTurnEnd, RemotePlayerTurnStart, RemoveAllArrowsEvent, RequestYieldDisplay, RestartGame, RiverTileAdded, RunCombatSim, SearchForPediaEntry, SequenceGameInitComplete, SerialEventBuildingSizeChanged, SerialEventCameraBack, SerialEventCameraCenter, 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, SerialEventEspionageScreenDirty, SerialEventExitCityScreen, SerialEventFeatureCreated, SerialEventFeatureDestroyed, SerialEventForestCreated, SerialEventForestRemoved, SerialEventGameDataDirty, SerialEventGameInitFinished, SerialEventGameMessagePopup, SerialEventGameMessagePopupProcessed, SerialEventGameMessagePopupShown, SerialEventGreatWorksScreenDirty, SerialEventHexCultureChanged, SerialEventHexDeSelected, SerialEventHexGridOff, SerialEventHexGridOn, SerialEventHexHighlight, SerialEventHexSelected, SerialEventImprovementCreated, SerialEventImprovementDestroyed, SerialEventImprovementIconCreated, SerialEventImprovementIconDestroyed, SerialEventInfoPaneDirty, SerialEventJungleCreated, SerialEventJungleRemoved, SerialEventLeaderToggleDebugCam, SerialEventLeagueScreenDirty, SerialEventMouseOverHex, SerialEventQueueFlushed, SerialEventRawResourceCreated, SerialEventRawResourceDestroyed, SerialEventRawResourceIconCreated, SerialEventRawResourceIconDestroyed, SerialEventResearchDirty, SerialEventRoadCreated, SerialEventRoadDestroyed, SerialEventScoreDirty, SerialEventScreenShot, SerialEventScreenShotTaken, SerialEventStartGame, SerialEventTerrainDecalCreated, SerialEventTerrainOverlayMod, SerialEventTest, SerialEventTestAnimations, SerialEventToggleBridgeState, SerialEventTurnTimerDirty, SerialEventUnitCreated, SerialEventUnitDestroyed, SerialEventUnitDestroyedInCombat, SerialEventUnitFacingChanged, SerialEventUnitFlagSelected, SerialEventUnitInfoDirty, SerialEventUnitMove, SerialEventUnitMoveToHexes, SerialEventUnitSetDamage, SerialEventUnitTeleportedToHex, SerialEventUpdateAllHexCulture, ShowAttackTargets, ShowHexYield, ShowMovementRange, ShowPlayerChangeUI, SpawnArrowEvent, SpecialTileAdded, SpecificCityInfoDirty, StartUnitMoveHexRange, StateMachineDumpStates, StateMachineRequestStates, StrategicViewStateChanged, SystemUpdateUI, TaskListUpdate, TeamMet, TechAcquired, ToggleDisplayUnits, ToolTipEvent, UIPathFinderUpdate, UnitActionChanged, UnitDataEdited, UnitDataRequested, UnitDebugFSM, UnitEmbark, UnitFlagUpdated, UnitGarrison, UnitHandleCreated, UnitHexHighlight, UnitLibrarySwap, UnitMarkThreatening, UnitMemberCombatStateChanged, UnitMemberCombatTargetChanged, UnitMemberOverlayAdd, UnitMemberOverlayMessage, UnitMemberOverlayRemove, UnitMemberOverlayShowHide, UnitMemberOverlayTargetColor, UnitMemberPositionChanged, UnitMoveQueueChanged, UnitNameChanged, UnitResetAnimationState, UnitSelectionChanged, UnitSelectionCleared, UnitShouldDimFlag, UnitStateChangeDetected, UnitTypeChanged, UnitVisibilityChanged, UserRequestClose, VisibilityUpdated, WallCreated, WarStateChanged, WonderCreated, WonderEdited, WonderRemoved, WonderStateChanged, WonderTogglePlacement, WonderTypeChanged, WorldMouseOver