Xonotic Forums
How to bind several actions to a key? - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Configuration Tips (https://forums.xonotic.org/forumdisplay.php?fid=19)
+--- Thread: How to bind several actions to a key? (/showthread.php?tid=3784)



How to bind several actions to a key? - voice - 12-25-2012

Title says it. I want to bind the +jump and +fire2 actions to SHIFT.

Tried a few ways to write that in config.cfg, but no luck so far, any help appreciated.


RE: How to bind several actions to a key? - Mr. Bougo - 12-25-2012

Including + and - commands in binds is a little tricky. You might think it would be as simple as doing bind shift "+jump;+fire2", but that does not work because (AFAIK) the engine expects just one command if a bind command starts in +.

Here's how you should do it: by defining a couple of aliases and binding them:
Code:
alias +jumpfire2 "+jump; +fire2"
alias -jumpfire2 "-jump; -fire2"
bind shift +jumpfire2

Put those three lines in autoexec.cfg (DO NOT edit config.cfg manually, it gets overwritten by the game and the aliases will be lost). If you don't already have one, just create autoexec.cfg in the same directory as config.cfg.


RE: How to bind several actions to a key? - voice - 12-25-2012

Thank you man!


RE: How to bind several actions to a key? - Mr. Bougo - 12-25-2012

Ignore the following, I'm not sure it's right. You might want to give it a try, though.

Note that there is a drawback when you bind multiple keys to the same +/- command (I'm guessing you have a jump key and an attack2 key other than shift). Releasing a + key will release the bind, so if you press space to jump while you're pressing shift to jump-attack, you will stop jumping as soon as you release space or shift.


RE: How to bind several actions to a key? - MrDetonia - 03-21-2020

To necro an eight year old thread, anyone know how I'd go about setting up single key weapon-switch and fire? In Quake I would set config like so, but this always seems to fire before switching weapon:

Code:
alias +rl "impulse 9; +fire"
alias -rl -fire
bind mouse2 +rl



RE: How to bind several actions to a key? - martin-t - 03-21-2020

You might wanna look at when the cl_hook_activeweapon runs and put the +fire there. Might need +fire ; wait ; -fire but that might block input for one frame. defer might avoid that but some servers intentionally break it. There's also nextframe. Or just learn to release manually.

I think you acc will suffer though - you need to be aiming at target at the point it fires but you're not in control when it fires. Wouldn't be more logical to invert it and first fire, THEN switch away? This would mean you have 9 fire buttons though if you have 9 weapon binds.