Update autosave interval on journal menu close

This commit is contained in:
Eddoursul 2024-01-22 23:42:34 +01:00
parent 01e66e9f57
commit db6dd31c9b
2 changed files with 17 additions and 3 deletions

View File

@ -17,7 +17,11 @@ Event OnUpdate()
Actor PlayerREF = Game.GetForm(0x14) as Actor Actor PlayerREF = Game.GetForm(0x14) as Actor
If PlayerREF.IsInCombat() || PlayerREF.IsOnMount() || PlayerREF.IsSwimming() || ! Game.IsFightingControlsEnabled() || PlayerREF.IsDead() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu") if PlayerREF.IsDead()
return
endif
If PlayerREF.IsInCombat() || PlayerREF.IsOnMount() || PlayerREF.IsSwimming() || ! Game.IsFightingControlsEnabled() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu")
RegisterForSingleUpdate(5) RegisterForSingleUpdate(5)
return return
endif endif
@ -41,16 +45,26 @@ Function UpdateAutoSaveInterval()
UnregisterForUpdate() UnregisterForUpdate()
return return
endif endif
fUpdateTime = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame") fUpdateTime = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
If fUpdateTime <= 0.0 ; just in case If fUpdateTime <= 0.0 ; just in case
fUpdateTime = 30 fUpdateTime = 30.0
EndIf EndIf
RegisterForSingleUpdate(fUpdateTime*60) RegisterForSingleUpdate(fUpdateTime*60)
RegisterForMenu("Journal Menu")
EndFunction EndFunction
Event OnMenuClose(String MenuName)
float fAutosaveEveryXMins = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
if fUpdateTime as int != fAutosaveEveryXMins as int
fUpdateTime = fAutosaveEveryXMins
RegisterForSingleUpdate(fUpdateTime*60)
endif
EndEvent
int iAutosaveIndex = 0 int iAutosaveIndex = 0
float fUpdateTime float fUpdateTime