Jump to content

[Mod] Close menus on ESC


Recommended Posts

I didn't find any mods that do this and it took me a while to figure out how to do it, since menus code is a hot mess. Just change scripts/game/gui/menus/commonMenu.ws like this:

1. Make 'shouldSkipHub' class field

2. In 'OnHideChildMenu' function replace condition (!m_hubEnabled) with (!m_hubEnabled || shouldSkipHub)

3. Same with 'ChildRequestCloseMenu' function, but also add return after CloseMenu() call

 

Example in attachment. Do not want to bother posting mod with such a small change, but if anyone wants to do it - go ahead.

 

P.S. Will only close menu if you opened it with hotkey. If you came from hub - it will go back to hub, so it won't mess with gamepad controls.

Edited by Demoniko
Link to comment
Share on other sites

I wish there was a mod that made the on screen "Esc" text for certain screens (like when reading a Notice Board) interactive so you can click it with the mouse and close the screen... instead of having to reach all the way across to the other side of the kb and actually push Escape.

Link to comment
Share on other sites

I wish there was a mod that made the on screen "Esc" text for certain screens (like when reading a Notice Board) interactive so you can click it with the mouse and close the screen... instead of having to reach all the way across to the other side of the kb and actually push Escape.

Sorry, I'm not sure I understand what you mean. Like this?

https://www.youtube.com/watch?v=ljfgxg2s4Cs

It's how default UI works right now.

Edited by Demoniko
Link to comment
Share on other sites

Sorry, not Notice Boards, but certain "view" interactive locations, such as reading a notice on a tree, or the names of a shop, blacksmith, etc.

File scripts/game/gui/menus/posterMenu.ws. At the end of event OnConfigUI() function add theInput.RegisterListener( this, 'OnCloseMenu', 'ClosePoster' ); then in event OnClosingMenu() add theInput.UnregisterListener( this, 'ClosePoster' ); before restoring context, then in the input.settings file add IK_E=(Action=ClosePoster) or other key that you want to use to close menu in EMPTY_CONTEXT section. Making it an actual button would take much more work and is not worth it. I attached modified script file, you just need to add keybinding to input.settings.

 

P.S. And I thought W2 scripts code was bad. W3 scripts are such a mess full of black magic, dirty hacks, copy pasted code, implicit calls through god knows what system, overengineered systems that it kills all my desire to work on mods for it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...