lfnetwork.com mark read register faq members calendar

Thread: making a toggle key
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 10-04-2008, 04:06 PM   #1
katanamaru
 
Join Date: Aug 2002
Posts: 471
making a toggle key

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.
katanamaru is offline   you may: quote & reply,
Old 10-05-2008, 05:07 PM   #2
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
Here you go:
Code:
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"

Last edited by nizwiz; 10-07-2008 at 07:33 PM.
nizwiz is offline   you may: quote & reply,
Old 10-07-2008, 04:20 PM   #3
katanamaru
 
Join Date: Aug 2002
Posts: 471
Thanks

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.
katanamaru is offline   you may: quote & reply,
Old 10-07-2008, 07:11 PM   #4
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
You're welcome.
As for your crouch toggling:
Code:
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).

Last edited by nizwiz; 10-07-2008 at 07:34 PM.
nizwiz is offline   you may: quote & reply,
Old 10-07-2008, 08:31 PM   #5
katanamaru
 
Join Date: Aug 2002
Posts: 471
Well this has been very helpful! Thanks I always wanted to learn more about the vstr command and applying it to key presses. Is there anything else the vstr command can do? Or are there other console commands that are neat?
katanamaru is offline   you may: quote & reply,
Old 10-08-2008, 04:56 PM   #6
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
Just found out that toggling "always run" can be done much easier without using vstr:
Code:
bind CTRL "toggle cl_run"
Simple as that, he he.

You might wanna have a look at this: Quake 4 Dummies - Scripts
nizwiz is offline   you may: quote & reply,
Old 10-09-2008, 04:38 PM   #7
katanamaru
 
Join Date: Aug 2002
Posts: 471
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.
katanamaru is offline   you may: quote & reply,
Old 10-09-2008, 07:31 PM   #8
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
Hmm, I tried both cfg's out on jasp and jamp, and they work fine with me. Can't tell why they didn't with you. Maybe a typo on your part? Otherwise, no idea.
nizwiz is offline   you may: quote & reply,
Old 10-13-2008, 04:14 PM   #9
katanamaru
 
Join Date: Aug 2002
Posts: 471
I put the code in as a .cfg named run.cfg. Then when the game loaded I typed exec run.cfg. Then it didn't work. Did you use a similar method or type it into the console?
katanamaru is offline   you may: quote & reply,
Old 10-13-2008, 07:20 PM   #10
nizwiz
Rookie
 
nizwiz's Avatar
 
Join Date: Jul 2007
Posts: 159
It did it just like that. Could you exec the cfg, enter 'toggle_run', 'toggle_run_on' and 'bind CTRL' on the console and post the responses here? Maybe then we can pinpoint the problem you're facing.
nizwiz is offline   you may: quote & reply,
Old 10-14-2008, 04:21 PM   #11
katanamaru
 
Join Date: Aug 2002
Posts: 471
Ok, I'll try tonight.

1.I'll execute my cfg, in this case run.cfg

2.Open the console and enter 'toggle_run' enter, 'toggle_run_on' enter, and then 'bind CTRL' enter. Close console
katanamaru is offline   you may: quote & reply,
Old 09-14-2012, 06:55 PM   #12
duster
Rookie
 
duster's Avatar
 
Join Date: Sep 2012
Location: High in the sky...
Posts: 217
Current Game: Alice,Broforce and Quake 3
Thumbs up

Quote:
Originally Posted by nizwiz View Post
Just found out that toggling "always run" can be done much easier without using vstr:
Code:
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.

Last edited by duster; 09-14-2012 at 08:42 PM.
duster is offline   you may: quote & reply,
Old 10-30-2012, 04:52 PM   #13
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
bind CTRL "cl_run !" should work the same as the toggle key. It may forget when exiting still because I don't know if cl_run is CVAR_ARCHIVE or not.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > making a toggle key

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:23 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.