VSTRs (Variable Strings) are a neat little way of assigning a command (or group of commands) a name which you can enter to use. For example:
/set haddock say I like haddock
sets a vstr called haddock that makes the user say "I like haddock" on use.
The format is: /set [vstrname] [command(s)]
To use a vstr:
/vstr [vstr name]
eg
/vstr haddock
It is important to note that JKA tends not to remember vstrs between sessions, so if you want to save them, create a cfg.
A few things you can do with vstrs
You can bind a vstr to a key:
/bind x vstr haddock
You can even make a vstr with multiple commands just like in a bind:
/set spam "say I hate white people;wait 200;say lololololololollololoollollol"
would make you say "I hate white people" and then say "lolololololololololo" after a short delay whenever you type /vstr spam
Make a vstr that changes what it does (useful for a number of advanced things):
/set haddock "say hi;set haddock say no you"
the first time you /vstr haddock it will make you say "hi" the second time you will say "no you"
Vstr uses with servers
You can set up vstrs in your server cfg or in other configs. These can be used via rcon to quickly do things with one command. Additionally there is an admin command in japlus (and I think in some other mods) "amvstr" which can be used by admins to make the server run vstrs. This means that server admins can effectively give their admins access to some specific commands that they have set with server side vstrs, without needing to give them rcon access.
Making A Command Selection Cycle:
You know the force selection on Q E and F? Imagine if you could do that, but instead of selecting force powers you could select from a list of commands you pre-set in a config. Here's how to do it.
- Go to base and create a new text file.
- Rename it to cycle.cfg (or anything else you want.cfg)
- Open it in notepad or any other text editor
- First lets set up the keys:
Choose a random name for your cycle. I will go with "cycle" for simplicity. Type:
bind [ vstr cycleprev bind ] vstr cyclenext bind enter vstr cycle
You can replace "[", "]" and "enter" with you choice of previous, next and use keys (like Q, E and F)
- Now get a list of all the commands you want to be selectable. Here is my example list:
cg_draw2d 0
cg_draw2d 1
saber single_4
saber single_4 single_6
(you can have way more than 4 commands (any number in fact) i just used 4 for simplicity)
- Now here is the hard part you need to make a load of vstrs, one for each command in this format:
seta cycle2 "set cycle [command 2];set cycleprev cycle1;set cyclenext cycle3;echo Message"
For cycle1 you need the "set cycleprev" to name the last cycle and for the last cycle entry you need "set cyclenext cycle1"
Example:
seta cycle1 "set cycle cg_draw2d 0;set cycleprev cycle4;set cyclenext cycle2;echo Hide Hud" seta cycle2 "set cycle cg_draw2d 1;set cycleprev cycle1;set cyclenext cycle3;echo Show Hud" seta cycle3 "set cycle saber single_4;set cycleprev cycle2;set cyclenext cycle4;echo Single Saber" seta cycle4 "set cycle saber single_4 single_6;set cycleprev cycle3;set cyclenext cycle1;echo Dual Sabers"
- Finally you need to set the default setting:
"set cycle [command 1];set cycleprev cycle4;set cyclenext cycle2"
here is the full example file:
bind [ vstr cycleprev bind ] vstr cyclenext bind enter vstr cycle seta cycle1 "set cycle cg_draw2d 0;set cycleprev cycle4;set cyclenext cycle2;echo Hide Hud" seta cycle2 "set cycle cg_draw2d 1;set cycleprev cycle1;set cyclenext cycle3;echo Show Hud" seta cycle3 "set cycle saber single_4;set cycleprev cycle2;set cyclenext cycle4;echo Single Saber" seta cycle4 "set cycle saber single_4 single_6;set cycleprev cycle3;set cyclenext cycle1;echo Dual Sabers" "set cycle cg_draw2d 0;set cycleprev cycle4;set cyclenext cycle2"
To activate it, go in game and type /exec cycle into the console. The game should now remember the cycle for good. If it stops working simply type /exec cycle again.
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now