Author Topic: Multiple Binds  (Read 2606 times)

WARNER

  • PGP
  • Posts: 13
Multiple Binds
« on: October 11, 2008, 12:08:04 PM »
Can you have multiple binds on 1 key?  ??? I heard you can but no one told me how.. please help? :-\

iced

  • 68 Carbine
  • Posts: 354
Re: Multiple Binds
« Reply #1 on: October 11, 2008, 12:12:16 PM »
no u cant

WARNER

  • PGP
  • Posts: 13
Re: Multiple Binds
« Reply #2 on: October 11, 2008, 12:29:47 PM »

Olbaid

  • Autococker
  • Posts: 731
Re: Multiple Binds
« Reply #3 on: October 11, 2008, 12:43:01 PM »
Yes, you can.  "cmd;cmd"

{appy Hamper

  • VM-68
  • Posts: 128
Re: Multiple Binds
« Reply #4 on: October 14, 2008, 10:53:39 AM »
can you give me an example of how you would use "cmd;cmd"

If you mean something like:

bind "mouse1" "+attack;+movedown"

I'm pretty near certain that doesn't work.  At least it didn't in the older builds (maybe that got changed after I stopped actively writing scripts)...

Can you have multiple binds on 1 key?  ??? I heard you can but no one told me how.. please help? :-\

you have to use an ALIAS:

bind "mouse1" "duckshoot"
alias duckshoot "+attack;+movedown"

all you wanted to know and more about writing scripts:
http://console.planetquake.gamespy.com/tutorials/quake_2.html

Eiii

  • Autococker
  • Posts: 4595
Re: Multiple Binds
« Reply #5 on: October 14, 2008, 11:43:40 AM »
Nope, aliases really don't accomplish anything other than group together commands for convenience's sake.

{appy Hamper

  • VM-68
  • Posts: 128
Re: Multiple Binds
« Reply #6 on: October 14, 2008, 12:33:12 PM »
"nope" what?

"nope," we don't need aliases?
"nope," we can't use "cmd;cmd;cmd..." in a single bind?
"nope," I'm not really on fire?
"nope," but I'll give you a $100?
...

I assume you're referring to the 1st answer, to which I say, "since when?!!" and "why didn't I know about this sooner?!!"  :o

Zorchenhimer

  • Autococker
  • Posts: 2614
Re: Multiple Binds
« Reply #7 on: October 14, 2008, 12:35:45 PM »
Haha, for +/- commands you might have to put a few "wait" commands in between there.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Multiple Binds
« Reply #8 on: October 14, 2008, 03:32:37 PM »
Nope, aliases really don't accomplish anything other than group together commands for convenience's sake.
Try writing a crouch toggle bind without aliases. :)

Eiii

  • Autococker
  • Posts: 4595
Re: Multiple Binds
« Reply #9 on: October 14, 2008, 05:19:42 PM »
"nope" what?

"nope," we don't need aliases?
"nope," we can't use "cmd;cmd;cmd..." in a single bind?
"nope," I'm not really on fire?
"nope," but I'll give you a $100?
...

I assume you're referring to the 1st answer, to which I say, "since when?!!" and "why didn't I know about this sooner?!!"  :o
Nope, you don't need aliases to stick multiple cmds in a bind. As jits points out, though, aliases can be pretty useful for rebinding and such. :P

Feel free to do 'bind mouse2 "+moveup;say Jump!", though. When I just tested this, though, it appends some numbers to the end of what you say... >.>

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Multiple Binds
« Reply #10 on: October 14, 2008, 07:43:14 PM »
Feel free to do 'bind mouse2 "+moveup;say Jump!", though. When I just tested this, though, it appends some numbers to the end of what you say... >.>

Ugh, I thought I fixed that!

Edit: Interesting...

Code: [Select]
if (kb[0] == '+')
{ // button commands add keynum and time as a parm
Com_sprintf(cmd, sizeof(cmd), "%s %i %i\n", kb, key, time);
Cbuf_AddText(cmd);
}

I don't think anything even uses that.  Wonder if it's safe to remove it.

Edit: It's not.

You can work around this easily enough with an alias:

alias +jump "+moveup;say Jump!"
alias -jump "-moveup"
bind mouse2 "+jump"

Put a feature vote up for it if you want it fixed.  Turns out it isn't as trivial as I thought it would be to fix.
« Last Edit: October 14, 2008, 08:34:01 PM by jitspoe »

WARNER

  • PGP
  • Posts: 13
Re: Multiple Binds
« Reply #11 on: October 25, 2008, 03:48:36 PM »
some on said that you can have multipple name binds on one key. is it possible? can you telll me how if it is? it would be really helpful. im kind of a newb at these things... ;D

zimtstern

  • Committee Member
  • Autococker
  • Posts: 1356
Re: Multiple Binds
« Reply #12 on: October 25, 2008, 04:02:07 PM »
bind "F8" "switchname1"
alias switchname1 "name YOURNAMEHERE; bind F8 switchname2; echo YOURNAMEHERE"
alias switchname2 "name 1YOURNAMEHERE; bind F8 switchname3; echo 1YOURNAMEHERE"
alias switchname3 "name 2YOURNAMEHERE; bind F8 switchname4; echo 2YOURNAMEHERE"
alias switchname4 "name 3YOURNAMEHERE; bind F8 switchname1; echo 3YOURNAMEHERE"

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: Multiple Binds
« Reply #13 on: October 25, 2008, 09:04:48 PM »
bind space +moveup
bind f +moveup

They won't undo each other.