toggle

Info on Quake 3 and VOGON servers - live status of all Q3 servers

toggle

Postby IJ » Mon Jan 18, 2010 16:40 UTC

What's the deal with setting a toggle? I've done some searching around and it always seems to include vstr in the code, does anyone know what that means and what the proper way to implement it is?
User avatar
IJ
Former Admin
 
Posts: 261
Joined: Wed Sep 03, 2008 18:21 UTC
Location: Jersey City, NJ

Re: toggle

Postby AG » Mon Jan 18, 2010 18:49 UTC

Code: Select all
// most reliable alt-fire
set afon "+button6; bind w vstr afoff"
set afoff "-button6; bind w vstr afon"
bind w "vstr afon"

q3's "scripting engine" (if you can call it that) is pretty limited.

vstr executes a variable. variable names can be whatever you want.

in the above code, the w key executes the afon variable which turns on +button6 and then sets the w key to next execute afoff. press w again and it turns off -button6 and sets w to execute afon again.
User avatar
AG
Former Admin
 
Posts: 2366
Joined: Mon Apr 14, 2008 18:25 UTC
Location: Texas
Favorite map: q3dm17
Server: INSTAKILL
Website: http://vogonhq.com

Re: toggle

Postby dyn » Mon Jan 18, 2010 19:16 UTC

If you mean 'toggle' command itself, it toggles between 0 and 1. For example: /toggle cl_drawfps will turn FPS counter on/off (values 0 and 1). I use these in my config:
Code: Select all
bind F7 "toggle cg_drawfps"
bind F8 "toggle cg_drawtimer"
bind F9 "toggle cg_lagometer"
bind F10 "toggle cg_drawgun"


This command is not present only in Q3. Team Fortress 2 has even better one, you can toggle between user-specified values, ie. toggle cl_showfps 0 1 2 will toggle between 2 modes or turn FPS counter off. TF2 also has aliases which makes vstr stuff obsolete. Ironically Q2 had aliases too, but Carmack decided to dumb down Q3 scripting to combat cheating. Funny, sad, and ineffective at same time.
User avatar
dyn
Site Admin
 
Posts: 4006
Joined: Mon Apr 14, 2008 07:50 UTC
Favorite map: q3dm8
Server: FFA
Website: https://vogonhq.com

Re: toggle

Postby IriDeck » Mon Jan 18, 2010 19:26 UTC

Never underestimate the power of stupid people in large groups.
User avatar
IriDeck
Former Admin
 
Posts: 1264
Joined: Mon Apr 14, 2008 14:02 UTC
Location: Georgia, USA
Favorite map: Q3DM17
Server: TDM

Re: toggle

Postby IJ » Mon Jan 18, 2010 21:21 UTC

thanks, that helps. So combining the two ideas could you use bind w "toggle afon"? or does the toggle command strictly work for items quake already registers as a 1 and a 0?
User avatar
IJ
Former Admin
 
Posts: 261
Joined: Wed Sep 03, 2008 18:21 UTC
Location: Jersey City, NJ

Re: toggle

Postby AG » Mon Jan 18, 2010 21:32 UTC

inspectorjimb wrote:thanks, that helps. So combining the two ideas could you use bind w "toggle afon"? or does the toggle command strictly work for items quake already registers as a 1 and a 0?

correct.

"toggle" only works for variables with 0/1 values.
User avatar
AG
Former Admin
 
Posts: 2366
Joined: Mon Apr 14, 2008 18:25 UTC
Location: Texas
Favorite map: q3dm17
Server: INSTAKILL
Website: http://vogonhq.com

Re: toggle

Postby IriDeck » Mon Jan 18, 2010 22:17 UTC

Unfortunately, you have to do any custom "scripting" the clunky way. Q3 seems almost like COBOL now.
User avatar
IriDeck
Former Admin
 
Posts: 1264
Joined: Mon Apr 14, 2008 14:02 UTC
Location: Georgia, USA
Favorite map: Q3DM17
Server: TDM

Re: toggle

Postby IJ » Tue Jan 19, 2010 17:29 UTC

Finally got it working properly, thanks for your help. I also added on -button6 and +button6 to my keys set for rockets and rail respectively to have it automatic. For anybody interested:
Code: Select all
bind KP_END "weapon 7; +button6"
bind KP_DOWNARROW "weapon 5; -button6"
bind kp_ins "vstr afon"
set afon "+button6; bind kp_ins vstr afoff"
set afoff "-button6; bind kp_ins vstr afon"
User avatar
IJ
Former Admin
 
Posts: 261
Joined: Wed Sep 03, 2008 18:21 UTC
Location: Jersey City, NJ

Re: toggle

Postby dyn » Tue Jan 19, 2010 20:32 UTC

AltFire can be activated with +button6 or with af command from client to server. First one makes it effective when you use button6 only, second one toggles it on/off and it stays that way across respawns as well.

All you need is this:
Code: Select all
bind f "af"
bind r "+button6"


Then either toggle it on/off with F or use it on-the-fly with R (-button6 is effective when key is depressed). You can bind it to other keys. When you use 'af' command, server will notify you about the AltFire state, either ON or OFF.
User avatar
dyn
Site Admin
 
Posts: 4006
Joined: Mon Apr 14, 2008 07:50 UTC
Favorite map: q3dm8
Server: FFA
Website: https://vogonhq.com

Re: toggle

Postby SD » Tue Jan 19, 2010 20:36 UTC

I use MWHEELUP for af - sounds freaky but it's what I'm used to
User avatar
SD
Former Admin
 
Posts: 1611
Joined: Tue Feb 03, 2009 18:54 UTC
Location: Wales, UK
Favorite map: Q3TOURNEY3
Server: INSTAKILL

Re: toggle

Postby dyn » Tue Jan 19, 2010 21:10 UTC

Hm, if it works for you then why not... :) I use wheel for weapon switch, but not that much since i need only one bind and that is: WEAPON 5 !!! :twisted:
User avatar
dyn
Site Admin
 
Posts: 4006
Joined: Mon Apr 14, 2008 07:50 UTC
Favorite map: q3dm8
Server: FFA
Website: https://vogonhq.com

Re: toggle

Postby SD » Tue Jan 19, 2010 21:13 UTC

Lol! MWHEELDOWN is weapon switch for me and MWHEELUP is af. I dont change weapons very much so I don't need wheelup and wheeldown to flip back and forth, but maybe that does restrict me a little. I'm considering changing ALL my movement binds as mine are weird and some players might even die if they knew what I use :)
User avatar
SD
Former Admin
 
Posts: 1611
Joined: Tue Feb 03, 2009 18:54 UTC
Location: Wales, UK
Favorite map: Q3TOURNEY3
Server: INSTAKILL

Re: toggle

Postby IJ » Tue Jan 19, 2010 21:49 UTC

dyn wrote:Hm, if it works for you then why not... :) I use wheel for weapon switch, but not that much since i need only one bind and that is: WEAPON 5 !!! :twisted:


Just out of curiosity, when you do play, do you play as dyn?
User avatar
IJ
Former Admin
 
Posts: 261
Joined: Wed Sep 03, 2008 18:21 UTC
Location: Jersey City, NJ

Re: toggle

Postby dyn » Tue Jan 19, 2010 22:25 UTC

Usually anon, but i change to dyn if i talk to others.
User avatar
dyn
Site Admin
 
Posts: 4006
Joined: Mon Apr 14, 2008 07:50 UTC
Favorite map: q3dm8
Server: FFA
Website: https://vogonhq.com

Re: toggle

Postby DEAN SINSTROM » Tue Jan 19, 2010 23:14 UTC

dyn wrote:I use wheel for weapon switch

I use MWHEELUP for rail, and MWHEELDOWN for rocket. (just thought I'd offer my 2ยข)
User avatar
DEAN SINSTROM
Former Admin
 
Posts: 280
Joined: Tue Jul 21, 2009 20:17 UTC
Location: Toronto, Canada
Favorite map: Q3DM1
Server: FFA

Re: toggle

Postby IJ » Thu Jan 21, 2010 14:03 UTC

Somehow the toggle gets messed up, this is the problem I was having before. It basically thinks alt-fire is off when it's actually on and the bind kp_ins "vstr afon" stops working. As a work around I set my alt-fire button to be af and now it works when I need it, although it's kind of funny because it displays the opposite message when pressed, ie - "alt fire is on" when i actually just turned it off. In any case, I don't need to use it that often now that I have my rail and rocketlauncher keys set to turn it on and off automatically anyways.

Dean, using the wheel to toggle between rocket and rail sounds crazy to me, although I guess everybody gets used to what they set it up to be. For instance I've always used the arrow keys for movement so all my other shortcuts are a pain to program since the number pad has weird names for the keys (kp_ins, kp_end, kp_pgdn....). That reminds me, does anybody know the name for the 5 key on the keypad? I was never able to figure that one out.
User avatar
IJ
Former Admin
 
Posts: 261
Joined: Wed Sep 03, 2008 18:21 UTC
Location: Jersey City, NJ

Re: toggle

Postby IriDeck » Thu Jan 21, 2010 17:59 UTC

Hey IJ, here's the code I use for this:
Code: Select all
// Update Hook for FFA AND CTF:
set hkwp10 "weapon 5;-button6;set nxthk vstr hkoff"
set hkoff "weapon 7;+button6;set nxthk vstr hkwp10"
set nxthk vstr hkwp10
set hookon "bind mouse3 vstr hookoff;echo ^3OFF-HAND ^5HOOK;bind mouse2 +button5"
set hookoff "bind mouse2 vstr nxthk;bind mouse3 vstr hookon;echo ^3FFA ^5MODE"

vstr hookon


This one is actually a two-dimensional toggle: the middle-click (click your mousewheel) alternates between CTF hook (off-hand, or +button5 hook), and FFA mode, which alternates between rockets without alt-fire and rail WITH alt-fire enabled. Right-click does that task, and allows me to blast and rail quickly.

If you only want the FFA toggle (which it seems you do), then do this:
Code: Select all
set altoff "weapon 5;-button6;set alttoggle vstr alton;echo [ROCKETS]"
set alton "weapon 7;+button6;set alttoggle vstr altoff;echo [RAILMODE]"
set alttoggle vstr alton
bind <key> vstr alttoggle


Now, whatever key you put in <key> will switch you between rail & rockets (rail first, though). Note that if you switch to rockets manually from rail, the next time you hit the toggle, it'll go for the rockets again, because that's what it's set to do. It takes some getting used to.
User avatar
IriDeck
Former Admin
 
Posts: 1264
Joined: Mon Apr 14, 2008 14:02 UTC
Location: Georgia, USA
Favorite map: Q3DM17
Server: TDM

Re: toggle

Postby dyn » Fri Jan 22, 2010 00:26 UTC

There is a "problem", server can use passthru Rail as default. In that case your script will change it to normal one.

Here are simplest solutions for all of the above + Teleport, in case you don't need mixed weapons:
Code: Select all
bind e "+button2;wait;weapon 5"
bind f "af"
bind q "+button5;wait;weapon 10"
bind r "+button6"


e - activate Teleport, switch to RL (i prefer RL, you can set it to any other weapon)
f - toggles AltFire on/off
q - uses any hook available, either offhand or weapon 10
r - +button6 for temp AltFire
User avatar
dyn
Site Admin
 
Posts: 4006
Joined: Mon Apr 14, 2008 07:50 UTC
Favorite map: q3dm8
Server: FFA
Website: https://vogonhq.com


Return to Quake 3

Who is online

Users browsing this forum: CommonCrawl [Bot], Semrush [Bot] and 0 guests