#How to do key combination binds?
1 messages · Page 1 of 1 (latest)
similar to how some commands like moving forward (+forward) has a + or - in front of it to have hold functionality, you can do the same thing with aliases:
alias -function "does this when released"```
so you can set the aliases to bind keys as you want them to when it's held down and released, then you can bind the function key like `bind shift +function`
Like
I want to do left alt + R to killbind so I make a bind in this way
bind ALT +killself
alias +killself "bind R -killself"
alias -killself "kill"
is this correct?
this might sound stupid
i tested it out. killbind still happens when I press just the secondary button
for this, when ALT is held, it executes +killself which binds R to -killself which executes kill.
when ALT is released, it executes -killself which executes kill.
so you'd end up dying after pressing/releasing alt and R now kills you. there's also nothing rebinding R to what it was before, so it'll stay permanently bound to -killself once ALT is pressed. -killself gets automatically executed when ALT is released, so you shouldn't need to bind it to R anyway (unless you're wanting it to automatically unhold ALT as soon as R is pressed, but in this case it wouldn't make sense to do that because the only functionality is to kill when ALT + R is pressed--it would make more sense to do that if you're adding multiple keys to work with ALT, like ALT + E etc)
what you want to do with the aliases is to bind and rebind keys according to ALT being held/unheld
in this case you'd want to do
alias -killself "bind R +reload"``` (or whatever you're wanting the r key to be when you release alt)
Didn't know there's this part in Scripting page of the wiki. Thanks for the help anyways!