Aliases to bind two actions to one key.

General discussion of the port and Doom-related chat.
Post Reply
User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

Aliases to bind two actions to one key.

#1

Post by Vincent(PDP) » 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. :)

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"
How it works:
1. Bind a key or button to use as a modifier key.
Example:

Code: Select all

bind k +keymodifierdown
2. Bind another key to be used as the multi-action key.

Code: Select all

STRUCTURE: keymodifier <command when not pressed> <command when pressed>

bind c "keymodifier sayhi wohoo"
Aliases used in example:

Code: Select all

alias sayhi "say Hi!"
alias wohoo "say WOHOO!; +jump; wait 1; -jump"
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! :)
Last edited by Vincent(PDP) on Thu Oct 01, 2015 10:38 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
Slim
Zandrone
Posts: 1112
Joined: Sat Mar 16, 2013 7:11 am
Location: Zero Space
Clan: Can't fit it in here
Clan Tag: -=FSR=-
Contact:

RE: Aliases to bind two actions to one key.

#2

Post by Slim » Fri Oct 02, 2015 1:06 am

Pretty cool there, before I read this I misinterpreted this as a toggle bind. My bad.
Image

"Your childish antics grow tiring. If you dare to fight me, then I accept your challenge: Anytime, anywhere." - Zero, Megaman X5
Spoiler: Quotes (Open)
5:54 PM - Slim: you're complaining about something so small that
5:54 PM - Lance: so? we do that all the time
5:55 PM - Lance: we're a bunch of losers complaining at a bar minus the bar
Spoiler: Galactus tried evading (Open)
Image

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Aliases to bind two actions to one key.

#3

Post by Vincent(PDP) » Fri Oct 02, 2015 7:39 am

@Slim:
You can make it toggleable too if you want to.

Code: Select all

alias keymodifierset "set x_keyboard_keymod 1"
alias keymodifierunset "set x_keyboard_keymod 0"
alias keymodifierdown "test $x_keyboard_keymod keymodifierunset keymodifierset"

bind k keymodifierdown
Last edited by Vincent(PDP) on Fri Oct 02, 2015 7:43 am, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Klofkac
Forum Regular
Posts: 481
Joined: Sat Jun 09, 2012 1:31 pm
Location: Ask Grandvoid servers

RE: Aliases to bind two actions to one key.

#4

Post by Klofkac » Fri Oct 02, 2015 4:07 pm

Vincent(PDP) wrote: @Slim:
You can make it toggleable too if you want to.

Code: Select all

alias keymodifierset "set x_keyboard_keymod 1"
alias keymodifierunset "set x_keyboard_keymod 0"
alias keymodifierdown "test $x_keyboard_keymod keymodifierunset keymodifierset"

bind k keymodifierdown
Sorry, his is redundant, command toggle x_keyboard_keymod is already working.
Well though, it is verbose...
Last edited by Klofkac on Fri Oct 02, 2015 4:09 pm, edited 1 time in total.
𝕂𝕝𝕠𝕗𝕜𝕒𝕔

User avatar
Ænima
Addicted to Zandronum
Posts: 3576
Joined: Tue Jun 05, 2012 6:12 pm

RE: Aliases to bind two actions to one key.

#5

Post by Ænima » Fri Oct 02, 2015 4:14 pm

I use something similar, I have an alias that rebinds mousewheelup to spynext and mousewheeldown to spyprev while R is held, and then you let go and mousewheel gets rebinded to weapon switching.
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

Post Reply