Commands

There are a number of useful commands in Q3, some of them are standalone, and others require parameters to be input.

By far the most used command is the set command, and its derivatives. The set command is used to create variables, or to change the value of an existing var.

set <var> <value>
There are also the commands seta, sets and setu. These are like the set command, but they each do something extra. The seta command will archive the variable, meaning it will be written to the player's q3config.cfg and remembered next time they load the game. The sets command marks the variable as server info, meaning it will be broadcasted to clients scanning for servers to play on, along with the usual server info. The setu command marks the variable as user info, meaning it will be visible to server admins.

If the name of an existing CVar is entered in place of a command, its current value will be displayed. An existing CVar can also be changed in this way by specifying a new value like so:

<existingVar> <newValue>
There is no need to specify the full set command if the CVar already exists, however it is required for creating new CVars.

vstr

The vstr command is used to execute the contents of a CVar, treating its value as a command.

vstr <var>
For example, if I have the following CVar:
seta zoom_in "cg_fov 60"
then the command vstr zoom_in will result in cg_fov 60 being executed. This command allows powerful custom scripts to be created.

Binds

A bind is where a command, or string of commands, is attached to a particular user input, such as a keyboard key or mouse button. When the key is pressed, the associated commands are executed. For example by default the number 3 is binded to the shotgun - pressing it will cause a weapon switch from the current weapon to the shotgun.

To bind a key, the command should be entered as follows:

bind <key> <command>
The command must be a single token, so if it contains spaces, or if you wish to string together more than one command, it must be surrounded by double-quotes, for example:
bind q "weapon 6;cg_crosshairSize 34"
The above command will switch weapon to the LG and make the crosshair large (size 34). If the command is omitted, the currently binded command for that key will be displayed. A key can be quickly unbinded using the unbind command:
unbind <key>

Button Commands

Some commands in the Q3 engine begin with a + or - sign. These button commands come as a plus and minus pair, and behave differently to the other commands when binded to a key. If a button command is binded to a key, the plus command is executed when the key is pressed down, and the minus command is executed when the key is released. For example the fire weapon command is +attack. So when using the bind:

bind MOUSE1 +attack
when pressing down the mouse button, the current weapon will begin firing (+attack), and when releasing the button the firing will stop (-attack).

- injx