Using the console

From Trepidation
Jump to: navigation, search

To enter the console, press the tilde ~ key at any time in game except during a map load. The tilde key is found above TAB and to the left of number 1. This will drop the console down over the top half of your screen and you will see a prompt for entering chat, commands or variables.

The Console and what it can do

The console is a command line interface for the game, similar to how DOS is a command line for Windows, but with completely different commands and variables. Every single game feature or setting that has a value can be changed through the console. Scroll up and down within the console using the PAGEUP and PAGEDOWN keys. Commands you typed previously in the same game session can be recalled via the CURSOR_UP and CURSOR_DOWN keys. CURSOR_LEFT and CURSOR_RIGHT let you go back along the string you typed and make edits. The console supports TAB COMPLETION, so if you type a partial command then press TAB, the game will fill in the rest of the command if it exists or list all existing commands with that prefix.

Entering commands and changing variables

Commands and variables each must be preceded by a slash / or backslash \ otherwise anything typed in the console will be broadcast as global chat. To execute a command, enter the command or variable and press enter. To change the value of a variable, enter the variable name followed by a space and the new value. When you hit enter the new value will be assigned to the variable. If you want to see what the current and default values of a certain variable are, enter the variable name without any value behind it and hit enter. The console will return the current and default values. Certain variables however will not show any immediate change. Mostly variables beginning with r_ (which are related to video settings) need a restart of the render system to be applied.

To reset the render system, enter /vid_restart

If a variable change requires a restart, you'll most likely see the pending value as "latched" when you enter the variable name until the game or rendering system is restarted.

The difference between commands and variables

The difference between a command and a variable may not be clear at first, but it's quite easy to explain. A variable holds a value, whereas a command executes a certain function. For example, quit is a command. Entering /quit in the console will close Q3 and bring you back to your desktop. An example of a variable is cg_drawgun. Possible values are 0 (your gun will not be drawn) or 1 (your gun will be drawn). A few commands (often related to player movement) are "key sensitive", meaning they act only while the assigned key is held down. The +forward command is an example of this. This command is used to make the player walk forward. While the forward bound key is held down, the player walks. When the key is released, the player stops walking. To check out how this works, just enter +forward in the console and you'll notice your character starts walking forward. Your character won't stop walking until you enter -forward in the console.

Console: Binding keys

Most primary functions (like walking, strafing, jumping, shooting) can be bound through the controls menu. However, sometimes you want to assign a certain command to a key. This can be done using the "bind" command.

Example:

I want to assign my 'W' key to walking forward. This can be done by entering:

/bind w "+forward"

Console: Aliases and scripts

Scripts are a number of commands executed in order, or variables changed to a certain setting by an automated script which can be called via a single button press. A script can range from a simple toggle script to enable/mute the sound to giant scripts that perform more complex functions such as timing item spawns.

A script often consists of one or more aliases. An alias is a short one-line script put. This alias is treated like any other command in the game, though there is only one difference. If you bind a key to your alias like normal commands, Trepidation will echo (display) the content of the alias (the list of commands inside). To circumvent this problem, you need to put vstr in front of the alias name.

Example:

I have an alias named myalias and want to bind it to my 'Q' key. This is what I'd need to enter in the console to do this: /bind q "vstr myalias"

You can create new aliases using the "set" command.

Example:

Using an alias can create a script that says "FIVE-O!!!, gotta flush my stash" then upon saying, your character self-frags, waits a short time and then quits the game. Here's how to create such an alias:

/set myalias "say FIVE-O!!!, gotta flush my stash; kill; wait 500; quit"

The 'say' command will chat the "FIVE-O, gotta flush my stash" text to the other players, the 'kill' command makes the player suicide, the wait 500 command will wait 500 game ticks, and the quit command will exit the game... all via pressing the bound �Q� key.

Important note: Trepidation will not save aliases after you quit the game, so put any alias script commands in a custom base/autoexec.cfg in order to save them. (Trepidation will always run an autoexec.cfg first before any other cfg file)