Make KeyBindings.GetKeysForCommand(...) Static

Moderator: GZDoom Developers

Post Reply
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Make KeyBindings.GetKeysForCommand(...) Static

Post by AFADoomer »

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?
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make KeyBindings.GetKeysForCommand(...) Static

Post by Nash »

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)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Make KeyBindings.GetKeysForCommand(...) Static

Post by Graf Zahl »

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.
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Make KeyBindings.GetKeysForCommand(...) Static

Post by AFADoomer »

Just wanted to follow up on this and clarify... This won't help Nash's problem, but wasn't an outright [No], correct?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Make KeyBindings.GetKeysForCommand(...) Static

Post by Graf Zahl »

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.
User avatar
AFADoomer
Posts: 1324
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: Make KeyBindings.GetKeysForCommand(...) Static

Post by AFADoomer »

Ugh, I completely missed that when I was looking through the code. Thanks!
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”