enderalse/source/scripts/_00e_enderalmcm.psc

181 lines
7.8 KiB
Plaintext
Raw Normal View History

Scriptname _00E_EnderalMCM extends SKI_ConfigBase
{This script handles all kinds of MCM menu options for Enderal}
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnPageReset(string page)
If _00E_ConfigMenu_Meditate == None
_00E_ConfigMenu_Meditate = Game.GetFormFromFile(0x00046D98, "Skyrim.esm") as Message
EndIf
If _00E_FS_IsForgottenStoriesActivated == None
_00E_FS_IsForgottenStoriesActivated = Game.GetFormFromFile(0x0004320E, "Skyrim.esm") as GlobalVariable
EndIf
; adding options to rebind new key options: 1) Hero menu 2) meditation 3) Phasmalist summon apparition 4) Horseflute
SetCursorFillMode(TOP_TO_BOTTOM)
AddHeaderOption(_00E_ConfigMenu_Keybindings.GetName())
iKeyID = self.AddKeyMapOption(_00E_ConfigMenu_OpenHeroMenu.GetName(), iHeroMenuKeymap, 0)
iKeyMeditateID = self.AddKeyMapOption(_00E_ConfigMenu_Meditate.GetName(), Player.iMeditateKeycode, 0)
If _00E_FS_IsForgottenStoriesActivated.GetValueInt() == 1
iKeyID02 = self.AddKeyMapOption(_00E_FS_ConfigMenu_Phasmalist_Teleport.GetName(), iFSPhasmalistTeleportKeymap, 0)
iKeyMountID = self.AddKeyMapOption(_00E_FS_ConfigMenu_Mount_Teleport.GetName(), iFSMountTeleportKeymap, 0)
EndIf
; adding gameplay options to enable / disable: 1) read aloud books 2) videos skip
AddHeaderOption(_00E_ConfigMenu_GameplayOptions.GetName())
toggleOID_ReadAloudBooks = AddToggleOption(_00E_ConfigMenu_DisableReadAloudBooks.GetName(), _00E_DisableReadAloudBooks.GetValue() != 0)
toggleOID_VideoSkip = AddToggleOption(_00E_ConfigMenu_VideoSkip.GetName(), _00E_VideoSkip.GetValue() != 0)
SetCursorPosition(1)
; adding other options to disable / enable: 1) menu tutorials 2) crafting tutorials 3) skill tutorials 4) quest tutorials 5) other tutorials
AddHeaderOption(_00E_ConfigMenu_OtherOptions.GetName())
toggleOID_MenuTutorials = AddToggleOption(_00E_ConfigMenu_DisableMenuTutorials.GetName(), _00E_DisableMenuTutorials.GetValue() != 0)
toggleOID_CraftingTutorials = AddToggleOption(_00E_ConfigMenu_DisableCraftingTutorials.GetName(), _00E_DisableCraftingTutorials.GetValue() != 0)
toggleOID_SkillTutorials = AddToggleOption(_00E_ConfigMenu_DisableSkillTutorials.GetName(), _00E_DisableSkillTutorials.GetValue() != 0)
toggleOID_QuestTutorials = AddToggleOption(_00E_ConfigMenu_DisableQuestTutorials.GetName(), _00E_DisableQuestTutorials.GetValue() != 0)
toggleOID_OtherTutorials = AddToggleOption(_00E_ConfigMenu_DisableOtherTutorials.GetName(), _00E_DisableOtherTutorials.GetValue() != 0)
EndEvent
; this event is responsible for assigning new keys, and passes the information to the respecitive scripts that registers for the key
Event OnOptionKeyMapChange(int option, int keyCode, string conflictControl, string conflictName)
If option == iKeyID
iHeroMenuKeymap = keyCode
self.SetKeyMapOptionValue(iKeyID, iHeroMenuKeymap, false)
Player.SetHeroMenuKey(iHeroMenuKeymap)
ElseIf option == iKeyMeditateID
self.SetKeyMapOptionValue(iKeyMeditateID, keyCode, false)
Player.SetMeditateKey(keyCode)
ElseIf option == iKeyID02
iFSPhasmalistTeleportKeymap = keyCode
self.SetKeyMapOptionValue(iKeyID02, iFSPhasmalistTeleportKeymap, false)
controlQuest.ChangeTeleportKey(iFSPhasmalistTeleportKeymap)
ElseIf option == iKeyMountID
iFSMountTeleportKeymap = keyCode
self.SetKeyMapOptionValue(iKeyMountID, iFSMountTeleportKeymap, false)
_00E_HorseFlute_New.SetMountTeleportKey(iFSMountTeleportKeymap)
EndIf
EndEvent
Event OnOptionSelect(int option)
If option == toggleOID_MenuTutorials
ChangeCheckbox(toggleOID_MenuTutorials, _00E_DisableMenuTutorials)
ElseIf option == toggleOID_CraftingTutorials
ChangeCheckbox(toggleOID_CraftingTutorials, _00E_DisableCraftingTutorials)
ElseIf option == toggleOID_SkillTutorials
ChangeCheckbox(toggleOID_SkillTutorials, _00E_DisableSkillTutorials)
ElseIf option == toggleOID_QuestTutorials
ChangeCheckbox(toggleOID_QuestTutorials, _00E_DisableQuestTutorials)
ElseIf option == toggleOID_OtherTutorials
ChangeCheckbox(toggleOID_OtherTutorials, _00E_DisableOtherTutorials)
ElseIf option == toggleOID_ReadAloudBooks
ChangeCheckbox(toggleOID_ReadAloudBooks, _00E_DisableReadAloudBooks)
ElseIf option == toggleOID_VideoSkip
ChangeCheckbox(toggleOID_VideoSkip, _00E_VideoSkip)
EndIf
EndEvent
; this event displays additional information when the mouse hovers over the different options
; the information is located in the Language_Translate.txt
Event OnOptionHighlight(int option)
If option == iKeyID
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == iKeyMeditateID
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == iKeyID02
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == iKeyMountID
SetInfoText("$ConfigMenuKeyInfo")
ElseIf option == toggleOID_MenuTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_CraftingTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_SkillTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_QuestTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_OtherTutorials
SetInfoText("$ConfigMenuTutorialsInfo")
ElseIf option == toggleOID_ReadAloudBooks
SetInfoText("$ConfigMenuReadAloudBooksInfo")
ElseIf option == toggleOID_VideoSkip
SetInfoText("$ConfigMenuVideoSkipInfo")
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
; function to control all checkbox changes
Function ChangeCheckbox(Int optionId, GlobalVariable optionValue)
Int newValue = ((optionValue.GetValueInt() == 0) as int)
SetToggleOptionValue(optionId, newValue)
optionValue.SetValueInt(newValue)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
_00E_Game_SkillmenuSC Property Player Auto
int iKeyID
Int iKeyMeditateID
int iKeyID02
int iKeyMountID
;int iMeditateKeycode = 21
int iHeroMenuKeymap = 35
int iFSPhasmalistTeleportKeymap = 34
int iFSMountTeleportKeymap = 38
int toggleOID_MenuTutorials
int toggleOID_CraftingTutorials
int toggleOID_SkillTutorials
int toggleOID_QuestTutorials
int toggleOID_OtherTutorials
int toggleOID_ReadAloudBooks
int toggleOID_VideoSkip
Message Property _00E_ConfigMenu_Keybindings Auto
Message Property _00E_ConfigMenu_OtherOptions Auto
Message Property _00E_ConfigMenu_GameplayOptions Auto
Message Property _00E_ConfigMenu_OpenHeroMenu Auto
Message Property _00E_ConfigMenu_Meditate Auto
Message Property _00E_FS_ConfigMenu_Phasmalist_Teleport Auto
Message Property _00E_FS_ConfigMenu_Mount_Teleport Auto
Message Property _00E_ConfigMenu_DisableMenuTutorials Auto
Message Property _00E_ConfigMenu_DisableCraftingTutorials Auto
Message Property _00E_ConfigMenu_DisableSkillTutorials Auto
Message Property _00E_ConfigMenu_DisableQuestTutorials Auto
Message Property _00E_ConfigMenu_DisableOtherTutorials Auto
Message Property _00E_ConfigMenu_DisableReadAloudBooks Auto
Message Property _00E_ConfigMenu_VideoSkip Auto
_FS_Phasmalist_ControlQuest Property controlQuest Auto
_00E_Horseflute_SC Property _00E_HorseFlute_New Auto
GlobalVariable Property _00E_FS_IsForgottenStoriesActivated Auto
GlobalVariable Property _00E_DisableMenuTutorials Auto
GlobalVariable Property _00E_DisableCraftingTutorials Auto
GlobalVariable Property _00E_DisableSkillTutorials Auto
GlobalVariable Property _00E_DisableQuestTutorials Auto
GlobalVariable Property _00E_DisableOtherTutorials Auto
GlobalVariable Property _00E_DisableReadAloudBooks Auto
GlobalVariable Property _00E_VideoSkip Auto