Jump to content

Home

making a toggle key


Recommended Posts

I'm trying to make a key that allows me to toggle 'always run.' I don't like having to hold down a key to accomplish this. I have tried two different methods that I have had no success with.

 

First was with the '!'. On the filefront forums it was posted that the ! would allow a button to toggle a command. So I tried this:

bind CTRL "cl_run !"

That did not work for me.

 

The second way was with 'vstr' commands in a .cfg. I tried this"

bind CTRL vstr run1 "cl_run 1"; vstr walk1

bind CTRL vstr walk1 "cl_run 0"; vstr run1

That may not be exactly right since I'm at school and cannot pull up the actual text file, but it is close.

 

If someone knows how to do this and willing to share I'd appreciate it.

Link to post
Share on other sites

Here you go:

set toggle_run_on "set cl_run 1; set toggle_run vstr toggle_run_off"
set toggle_run_off "set cl_run 0; set toggle_run vstr toggle_run_on"
vstr toggle_run_off
bind CTRL "vstr toggle_run"

Edited by nizwiz
Link to post
Share on other sites

Thanks Nizwiz. I can't wait to go home and try it.

 

I had another idea as well. Is it possible to make a key that allows one to press a key to activate a command instead of holding the key? EX: By default press and hold crouch to crouch, release to stand up. Through a key bind press key crouch, press key again to stand up.

 

I think this would work as an alternate bind for the 'run toggle' but apply to other keys like crouch and dodge.

I don't really need a key for this, but I was wondering if it was possible.

Link to post
Share on other sites

You're welcome.

As for your crouch toggling:

set toggle_crouch_on "+movedown; set toggle_crouch vstr toggle_crouch_off"
set toggle_crouch_off "-movedown; set toggle_crouch vstr toggle_crouch_on"
vstr toggle_crouch_off
bind <keycode> "vstr toggle_crouch"

You get the idea. Basically, I guess this would work with every command that can be sustained (you can identify them with a look at the binds in your jaconfig.cfg: the sustainable commands are those with a plus sign in front of them).

Edited by nizwiz
Link to post
Share on other sites

I was just about to post that the original vstr commands didn't work. I like the simple way, but I still want to play around with the vstr commands.

 

I have a vstr command that I d/l'ed to press a button and cycle through the saber colors that looks almost exactly like the vstr you posted. Only difference is that it was missing the third line. I tried modifying it to match up more and still didn't get a result. Any ideas?

 

Thanks for the guide! I can't hardly wait to get home and read that bad boy over.

Link to post
Share on other sites
  • 3 years later...
Just found out that toggling "always run" can be done much easier without using vstr:

bind CTRL "toggle cl_run"

Simple as that, he he.

 

You might wanna have a look at this: Quake 4 Dummies - Scripts

 

Both codes work but the first one when used and exit game to make it work must be typed again.Atleast that's in KOTF.I don't know why but jka shows "Couldn't load run.cfg".Thanks alot.:detective:

Edited by duster
Link to post
Share on other sites
  • 1 month later...
×
×
  • Create New...