The console is a part of the user interface aimed at the game developers, content authors and power users. It is a text based interface that allows the user to enter text commands that the game interprets.
- 1 Accessing the console
- 2 Using the console
- 3 Command types
- 4 Special script files
- 5 Remote console
- 6 Map issued commands
- 7 See also
Accessing the console
Access to the console is by default disabled. To open the console, a key must be bound to the command of opening the console. On US keyboards this defaults to the tilde key. Additionally the console must be enabled in the advanced keyboard options sub dialog.
The console will be automatically opened, even if not enabled, when the game is launched using the -console argument. The -developer argument will also be automatically open the console, in addition to setting the
The console is not accessible in the Xbox or PlayStation versions of the game.
Using the console
The console is split into two parts, the large output panel and the command prompt.
The output panel
In addition to showing the output from entered commands, the output panel also logs various game events, such as player deaths and chat text.
The last few lines of the console output can be overlaid on top of the gameplay in the upper left corner. This is controlled by the
developer console variable.
The command prompt
The command prompt accepts written commands. Commands are executed by hitting the returnor enter key .
Like other text fields in the GUI, it supports the clipboard, allowing the user to cut, copy and paste text.
The command prompt supports code hinting. As the user types the command, the game will offer suggestions for what the user is typing. Hitting the tab keywill accept the suggestion, letting the user continue to type the command.
There are two kinds of commands, pure commands and so called console variables. The difference is that a console variable retains a value, while pure commands execute once.
Commands are flagged as being one or more of special types of commands.
Some commands are special and have a name beginning with a plus sign. These commands provide input used to play the game. When bound to a key they have the special property of automatically issuing their twin off command (indicated by beginning with a minus sign instead of the plus sign) when the key is released.
Many commands are considered too powerful for normal players and are marked as cheats. Unless explicitly allowed by the server owner using the
sv_cheats variable, pure commands marked as cheats will not execute and console variables will be reverted to their default values.
Most commands only make sense when connected to a server. As such the game will prevent them being used unless connected to a server. A few do make sense even without a connected server and are marked as such.
Some variables must have the same value on both the server and the client. The game will temporarily override those variables on the client when connected to a server.
Some variables contain user settings that should persist across play sessions. They are stored in the
config.cfg file by the game.
Certain variables contain data that should not be sent between clients and the server, such as passwords.
Some variables influence the recording of gameplay demos and as such need to be included/excluded from the demo recording.
Some variables are deemed to be important enough to alert all players on the server when they are changed. Changes to these variables are shown among the chat text overlay.
Change notify variables are included by default in server rule queries done by external tools.
Special script files
Team Fortress 2 automatically reads several game files and executes any commands within them. Here is the list of those files:
config.cfg- This is the default configuration file which is edited to reflect any in-game changes to keybinds or video settings. It is safe to edit this file, but it will change to reflect any modified keybinds on startup. This config will run every time the game starts up, before any other config.
config_default.cfg- This contains a basic set of keybinds, and will be executed as a backup if
config.cfgis not present.
autoexec.cfg- This is the default config file for executing custom keybinds and aliases. This config will run every time the game starts up, after
- Each class has a config file which automatically runs whenever a player switches to that class. Note that any settings set in one classes config file will be retained when switching classes unless explicitly rebound. They are as follows:
- A config file can be created for any map if it shares the same name, and will run whenever that map is loaded. For example, a
cp_well.cfgfile will be automatically run any time Well (Control Point) is loaded.
If on Windows, scripting files may be found in:
<Steam Folder>/SteamApps/common/team fortress 2/tf/cfg
If on a Mac, scripting files may be found in:
~/Library/Application Support/Steam/SteamApps/common/team fortress 2/tf/cfg
If on Linux, scripting files may be found in:
~/.steam/steam/SteamApps/common/Team Fortress 2/tf/cfg
Since the SteamPipe update, code can also be placed in
.../team fortress 2/tf/custom/yourfoldernamehere/cfg
Dedicated servers are exclusively controlled from the console. However, logging in to the server and reattaching to the console is a major hassle. Instead server administrators can use the remote console system. The game server runs an additional service that accepts console commands from remote clients. This is secured using a dedicated password.