Tremulous Forum

General => Troubleshooting => Topic started by: OhaiReapd on May 12, 2011, 02:07:37 am

Title: Resetting Lock Team binds.
Post by: OhaiReapd on May 12, 2011, 02:07:37 am
Ok, so I am having trouble setting it so the first time I hit the bind, it locks, and the second will unlock and reset. BUT It doesn't. I can lock, unlock but it doesn't reset.

Thanks for all the bind help. <3

Code: [Select]
seta ulocka "seta m5k1 "lock a; vstr locka; vstr menu0"
seta ulockh "seta m5k2 "lock h; vstr lockh; vstr menu0"
seta locka "seta m5k1 "unlock a; vstr ulocka; vstr menu0"
seta lockh "seta m5k2 "unlock h; vstr ulockh; vstr menu0"

seta m5k1 "lock a; vstr locka; vstr menu0"
seta m5k2 "lock h; vstr lockh; vstr menu0"
Title: Re: Resetting Lock Team binds.
Post by: Undeference on May 12, 2011, 04:39:29 am
Code: [Select]
seta ulocka "seta m5k1 "lock a; vstr locka; vstr menu0"
seta ulockh "seta m5k2 "lock h; vstr lockh; vstr menu0"
seta locka "seta m5k1 "unlock a; vstr ulocka; vstr menu0"
seta lockh "seta m5k2 "unlock h; vstr ulockh; vstr menu0"

seta m5k1 "lock a; vstr locka; vstr menu0"
seta m5k2 "lock h; vstr lockh; vstr menu0"
You can't put quotes in a cvar. Something like this should work
Code: [Select]
seta locka "lock a; seta togglea vstr unlocka"
seta unlocka "unlock a; seta togglea vstr locka"
seta togglea "vstr locka"

seta lockh "lock h; seta toggleh vstr unlockh"
seta unlockh "lock h; seta toggleh vstr lockh"
seta toggleh "vstr lockh"
Title: Re: Resetting Lock Team binds.
Post by: OhaiReapd on May 12, 2011, 05:52:13 am
Can you please explain why it works for future reference? And I can add that vstr menu0 thing too, right?
Title: Re: Resetting Lock Team binds.
Post by: Undeference on May 12, 2011, 01:57:14 pm
I don't know what "the vstr menu0 thing" is, so…

I'm not sure what you want in terms of explaining why it works, but I can take a shot at explaining why your version did not
Code: [Select]
seta ulocka "seta m5k1 "lock a; vstr locka; vstr menu0"the quote before seta m5k1 starts a string literal
the quote before lock a terminates the string literal, so the following semicolon is treated as the end of the line
the above code is interpreted as
Code: [Select]
seta unlocka "seta m5k1  lock a"
vstr locka
vstr "menu0 "

If you remove the quotes before the setas, your version might work as expected
Title: Re: Resetting Lock Team binds.
Post by: OhaiReapd on May 18, 2011, 12:23:09 pm
Oh thank you, I forgot to respond to this.. It works, thanks for the help. <3