Jump to content
Sign in to follow this  
MUG

VSTR's and their uses

Recommended Posts

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.

Share this post


Link to post

This is a great write up! The example for the command cycler is close, but will not work as is. Here's the fixed version:

bind "." exec cycler
bind "[" vstr cycleprev
bind "]" vstr cyclenext
bind "P" vstr cycle

seta cycle "vstr cycle1"
seta cycle1 "set cycleprev vstr cycle7;set cyclenext vstr cycle2; set cycle COMMAND1; echo NAME1"
seta cycle2 "set cycleprev vstr cycle1;set cyclenext vstr cycle3; set cycle COMMAND2; echo NAME2"
seta cycle3 "set cycleprev vstr cycle2;set cyclenext vstr cycle4; set cycle COMMAND3; echo NAME3"
seta cycle4 "set cycleprev vstr cycle3;set cyclenext vstr cycle5; set cycle COMMAND4; echo NAME4"
seta cycle5 "set cycleprev vstr cycle4;set cyclenext vstr cycle6; set cycle COMMAND5; echo NAME6"
seta cycle6 "set cycleprev vstr cycle5;set cyclenext vstr cycle7; set cycle COMMAND6; echo NAME7"
seta cycle7 "set cycleprev vstr cycle6;set cyclenext vstr cycle1; set cycle COMMAND7; echo NAME7"

"." Reloads the file

"[" Shows the previous command in the cycle

"]" Shows the next command in the cycle

"P" Executes the command

COMMAND is the command and NAME is what you will see when selecting the command.

 

Here''s a version that I'm using to select a message to send after a duel:

bind "." exec messagecycler
bind "[" vstr cycleprev
bind "]" vstr cyclenext
bind "P" vstr cycle

seta cycle "vstr cycle1"
seta cycle1 "set cycleprev vstr cycle7;set cyclenext vstr cycle2; set cycle say Good Fight; echo Good Fight"
seta cycle2 "set cycleprev vstr cycle1;set cyclenext vstr cycle3; set cycle say Good Duel; echo Good Duel"
seta cycle3 "set cycleprev vstr cycle2;set cyclenext vstr cycle4; set cycle say GG; echo GG"
seta cycle4 "set cycleprev vstr cycle3;set cyclenext vstr cycle5; set cycle say GF; echo GF"
seta cycle5 "set cycleprev vstr cycle4;set cyclenext vstr cycle6; set cycle say Well Played; echo Well Played"
seta cycle6 "set cycleprev vstr cycle5;set cyclenext vstr cycle7; set cycle say Close one!; echo Close One"
seta cycle7 "set cycleprev vstr cycle6;set cyclenext vstr cycle1; set cycle say Whew!; echo Whew"

 

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×
×
  • Create New...