Tremulous Forum

General => Troubleshooting => Topic started by: DraZiLoX on October 31, 2009, 05:16:50 pm

Title: IF, in binds.
Post by: DraZiLoX on October 31, 2009, 05:16:50 pm
Is possible use IF in binds?

Like:

bind 1 "say !specme;if team spectate;echo Spectator cant join spectators."
Title: Re: IF, in binds.
Post by: David on October 31, 2009, 05:25:52 pm
Nope.
However that specific example can be achieved using team configs, so the bind gets changed depending on what team you are on.
Title: Re: IF, in binds.
Post by: DraZiLoX on October 31, 2009, 07:49:35 pm
Okay...
Title: Re: IF, in binds.
Post by: Celestial_Rage on November 01, 2009, 02:00:23 am
I also understand that there is also an /if command for comparing cvars?

I've tried it and the output I get is:
Code: [Select]
if <value1> <operator> <value2> <cmdthen> (<cmdelse>) : compares the first two values and executes <cmdthen> if true, <cmdelse> if false
but, I have no clue how to use it. I've tried what it says, but it still doesn't work..
Title: Re: IF, in binds.
Post by: UniqPhoeniX on November 01, 2009, 02:44:00 am
/if is a tremfusion feature, along with many other nice scripting features (http://www.tremfusion.net/wiki/Features_list). "if \$g_unlagged\ = 1 unlagged_on unlagged_off" will "vstr unlagged_on" if unlagged is enabled and "vstr unlagged_off" if not (ofc you have to create those). Tho "team" is not a variable, so can't be used in if cmd, but you can create a variable that is changed depending on your team.
Title: Re: IF, in binds.
Post by: Amanieu on November 01, 2009, 11:43:03 am
A p_team variable will be available in the next release.