Aliases to bind two actions to one key.
Posted: Thu Oct 01, 2015 10:31 pm
I've made an alias which makes it possible to bind two actions to a single key/button and switching between them by holding down the specified modifier key.
I'm thinking that perhaps someone else than me will find it useful. :)
How it works:
1. Bind a key or button to use as a modifier key.
Example:
2. Bind another key to be used as the multi-action key.
Aliases used in example:
Now, when pressing the 'c' button on the keyboard, it will write "Hi!" to the chat.
And if I hold down the 'k' button and then press 'c' the player will jump and write "WOHOO!" to the chat.
Hope this is to any use! :)
I'm thinking that perhaps someone else than me will find it useful. :)
Code: Select all
alias +keymodifierdown "set x_keyboard_keymod 1"
alias -keymodifierdown "set x_keyboard_keymod 0"
alias keymodifier "test $x_keyboard_keymod %2 %1"
1. Bind a key or button to use as a modifier key.
Example:
Code: Select all
bind k +keymodifierdown
Code: Select all
STRUCTURE: keymodifier <command when not pressed> <command when pressed>
bind c "keymodifier sayhi wohoo"
Code: Select all
alias sayhi "say Hi!"
alias wohoo "say WOHOO!; +jump; wait 1; -jump"
And if I hold down the 'k' button and then press 'c' the player will jump and write "WOHOO!" to the chat.
Hope this is to any use! :)