dizietemblesssma Posted September 24, 2020 Posted September 24, 2020 I wanted to detect if the MCM menu is open for the hotkeys in my mcm menu. Alternatively to detect that no menu is open. I have the key conflict control in MCM working but I noticed that the actions for the keys still fire when in the menu, I'd like to stop that for when other users with config menus that have key conflict might detect a conflict with my menu keys. I have triedIf code == hotkey && !UI.IsMenuOpen("Main Menu") but once in the MCM menu the main menu is closed and I don't see anything else useful here:https://www.creationkit.com/index.php?title=UI_Script diziet
dylbill Posted September 24, 2020 Posted September 24, 2020 Instead use if (!Utility.IsInMenuMode()) UI.IsMenuOpen checks for a specific menu, while the above is for all menus. I think it checks though if the game is paused, so it could conflict with a mod like Skyrim Souls, which un-pauses the game during some menus.
IsharaMeradin Posted September 24, 2020 Posted September 24, 2020 (edited) This is a safety process block I developed for one of my mods. It helps to determine when it is safe to process the key press. You are more than welcome to use it. Probably requires SKSE but not 100% certain on that. Bool Function SafeProcess() If (!Utility.IsInMenuMode()) \ && (!UI.IsMenuOpen("Dialogue Menu")) \ && (!UI.IsMenuOpen("Console")) \ && (!UI.IsMenuOpen("Crafting Menu")) \ && (!UI.IsMenuOpen("MessageBoxMenu")) \ && (!UI.IsMenuOpen("ContainerMenu")) \ && (!UI.IsTextInputEnabled()) ;IsInMenuMode to block when game is paused with menus open ;Dialogue Menu check to block when dialog is open ;Console check to block when console is open - console does not trigger IsInMenuMode and thus needs its own check ;Crafting Menu check to block when crafting menus are open - game is not paused so IsInMenuMode does not work ;MessageBoxMenu check to block when message boxes are open - while they pause the game, they do not trigger IsInMenuMode ;ContainerMenu check to block when containers are accessed - while they pause the game, they do not trigger IsInMenuMode ;IsTextInputEnabled check to block when editable text fields are open Return True Else Return False EndIf EndFunction EDIT: In case it is not clear the return value of the safety process block needs to be true in order to allow the key press to be processed. Edited September 24, 2020 by IsharaMeradin
dizietemblesssma Posted September 24, 2020 Author Posted September 24, 2020 Thankyou everyone, I shall try each of these:) diziet
ArrowFX Posted September 27, 2020 Posted September 27, 2020 This is a safety process block I developed for one of my mods. It helps to determine when it is safe to process the key press. You are more than welcome to use it. Probably requires SKSE but not 100% certain on that. Bool Function SafeProcess() If (!Utility.IsInMenuMode()) \ && (!UI.IsMenuOpen("Dialogue Menu")) \ && (!UI.IsMenuOpen("Console")) \ && (!UI.IsMenuOpen("Crafting Menu")) \ && (!UI.IsMenuOpen("MessageBoxMenu")) \ && (!UI.IsMenuOpen("ContainerMenu")) \ && (!UI.IsTextInputEnabled()) ;IsInMenuMode to block when game is paused with menus open ;Dialogue Menu check to block when dialog is open ;Console check to block when console is open - console does not trigger IsInMenuMode and thus needs its own check ;Crafting Menu check to block when crafting menus are open - game is not paused so IsInMenuMode does not work ;MessageBoxMenu check to block when message boxes are open - while they pause the game, they do not trigger IsInMenuMode ;ContainerMenu check to block when containers are accessed - while they pause the game, they do not trigger IsInMenuMode ;IsTextInputEnabled check to block when editable text fields are open Return True Else Return False EndIf EndFunction EDIT: In case it is not clear the return value of the safety process block needs to be true in order to allow the key press to be processed. Thanks for the example script <3
Glanzer Posted April 10, 2021 Posted April 10, 2021 This is a safety process block I developed for one of my mods. It helps to determine when it is safe to process the key press. You are more than welcome to use it. Probably requires SKSE but not 100% certain on that. THANK YOU!!!
Glanzer Posted January 26, 2023 Posted January 26, 2023 I know this is an old topic, but I am still using this code and I also added to it to make it compatible with Skyrim Souls. Here's the updated code: Bool Function SafeProcess() If (!Utility.IsInMenuMode()) \ && (!UI.IsMenuOpen("Dialogue Menu")) \ && (!UI.IsMenuOpen("Console")) \ && (!UI.IsMenuOpen("Crafting Menu")) \ && (!UI.IsMenuOpen("MessageBoxMenu")) \ && (!UI.IsMenuOpen("ContainerMenu")) \ && (!UI.IsMenuOpen("InventoryMenu")) \ && (!UI.IsMenuOpen("BarterMenu")) \ && (!UI.IsTextInputEnabled()) ;IsInMenuMode to block when game is paused with menus open ;Dialogue Menu check to block when dialog is open ;Console check to block when console is open - console does not trigger IsInMenuMode and thus needs its own check ;Crafting Menu check to block when crafting menus are open - game is not paused so IsInMenuMode does not work ;MessageBoxMenu check to block when message boxes are open - while they pause the game, they do not trigger IsInMenuMode ;ContainerMenu check to block when containers are accessed - while they pause the game, they do not trigger IsInMenuMode ;InventoryMenu check to block when inventory is open - when used with Skyrim Souls ;BarterMenu check to block when buy items in shop - when used with Skyrim Souls ;IsTextInputEnabled check to block when editable text fields are open Return True Else Return False EndIfEndFunction
Recommended Posts