Currently , KeyBindings.GetKeysForCommand cannot be run from an event handler.
This leads to hacks like this where cvars are being bastardized to identify the key used to kick off a ZScript event in game. If GetKeysForCommand were made static, it would allow for proper keybinds (to dummy commands that would be looked up in the event handler) to be used instead.
I don't *think* there's a reason that this should be disallowed?
Make KeyBindings.GetKeysForCommand(...) Static
Moderator: GZDoom Developers
Re: Make KeyBindings.GetKeysForCommand(...) Static
I am not sure if OP would solve this problem I'm having, but I REALLY, REALLY need to be able to check for binded keys while in Menus too.
I want the same button that I've bounded to "netevent OpenCharacterStatsMenu" be fireable in both gameplay context and menu context.
With the current limitation, I must press Tab to open the menu (what I bounded it to), and then press Escape to close the menu. Because there's absolutely no way for me to detect a binded keypress while in the menu. Sloppy, sloppy, sloppy!!!
(I have already asked for help on this to ZZYZX and Gutawer, they both confirmed that it's not possible to retrieve the binded keys in menu mode because the key codes are different from the UI input key codes or something like that)
I want the same button that I've bounded to "netevent OpenCharacterStatsMenu" be fireable in both gameplay context and menu context.
With the current limitation, I must press Tab to open the menu (what I bounded it to), and then press Escape to close the menu. Because there's absolutely no way for me to detect a binded keypress while in the menu. Sloppy, sloppy, sloppy!!!
(I have already asked for help on this to ZZYZX and Gutawer, they both confirmed that it's not possible to retrieve the binded keys in menu mode because the key codes are different from the UI input key codes or something like that)
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Make KeyBindings.GetKeysForCommand(...) Static
The menu uses an entirely different mode to access the keyboard so this is simply not possible. (The menu is run in GUI mode whereas the game runs in direct access mode.) Keybinds for those are not exchangeable.
Re: Make KeyBindings.GetKeysForCommand(...) Static
Just wanted to follow up on this and clarify... This won't help Nash's problem, but wasn't an outright [No], correct?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Make KeyBindings.GetKeysForCommand(...) Static
Not needed and not possible. There's two global variables of type 'KeyBindings', one for regular bindings, called Bindings and one for automap bindings called AutomapBindings. You have to access this function through these variables.
Re: Make KeyBindings.GetKeysForCommand(...) Static
Ugh, I completely missed that when I was looking through the code. Thanks!