Multi-key bind with modifier keys function?

Tue Aug 03, 2021 3:54 am

Hey there.

I was wondering if it's possible to make a "multi-key bind" in GZDoom using Windows' modifier keys (Control, Alt, Shift).
So, I have the whole Numpad set from 1 to 9 to spawn specific Doom monsters.
Now, I want to make it so Shift+Numpad from 1 to 9 also spawns different kinds of specific doom monsters.

Is it possible to do so? If so, what is the console command for such?

Re: Multi-key bind with modifier keys function?

Tue Aug 03, 2021 12:51 pm

No. To the input system the modifier keys are just normal keys that are actually all used by default.

Re: Multi-key bind with modifier keys function?

Wed Aug 04, 2021 8:16 am

You can kind of emulate this behavior with a cvar and a few aliases:
shift-key.pk3

CVARINFO:
Code:
user bool shift_pressed = false;

KEYCONF:
Code:
alias +shift_modifier "shift_pressed true"
alias -shift_modifier "shift_pressed false"

alias summon_zombie "summon zombieman"
alias summon_imp    "summon doomimp"
alias summon_zombie_or_imp "test $shift_pressed summon_zombie summon_imp"


How to use:
1. Bind Shift to +shift_modifier command (type bind shift +shift_modifier in console).
2. Bind any key to summon_zombie_or_imp.
3. Now pressing your key with shift summons a zombie, without shift it summons an imp.

Basically, you define a boolean cvar, and set shift to switch this cvar on and off. Then you test this cvar in an alias and select one of two different actions. See CCMDs for more info.

This solution has a couple of drawbacks:
1. You cannot use Shift for anything else.
2. You have to add new aliases to KEYCONF by hand.
You do not have the required permissions to view the files attached to this post.

Re: Multi-key bind with modifier keys function?

Wed Aug 04, 2021 10:43 am

Thanks, I'll try it when I can
I suppose if I want it to be alt instead, I simply change the "bind shift", to "bind alt", right?

Re: Multi-key bind with modifier keys function?

Wed Aug 04, 2021 10:47 am

Yes. You can also rename the cvar and commands to alt_... for clarity, but it will work either way.