From Team Fortress Wiki
Jump to: navigation, search
This article is about user interface. For the console versions of Team Fortress 2, see Differences between platforms.
The developer console as found in Team Fortress 2
I have been shown who is the boss!
The Spy humiliated and about to killbind

The console, also known as the developer console, is a part of the user interface aimed at the game developers, content authors and power users on the PC version of Team Fortress 2. It is a text-based command-line interface that allows the user to enter text commands that the game interprets.

Accessing the console

The advanced keyboard options dialog that hides the option to enable 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. This defaults to the backtick/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 developer and sv_cheats variables.

The console is not accessible in the Xbox 360 or PlayStation 3 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 return Return or enter key ↵ Enter.

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 completion. As the user types the command, the game will offer suggestions for what the user is typing. Hitting the tab key Tab ⇆ will accept the suggestion, letting the user continue to type the command.

Command types

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.

Input 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.


Main article: Cheats

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.

Server executable

By default the server is forbidden from executing commands on the client. Only specifically flagged commands allow the server to issue them to clients.

Offline commands

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.

Replicated variables

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.

Archived variables

Some variables contain user settings that should persist across play sessions. They are stored in the config.cfg file by the game.

Protected variables

Certain variables contain data that should not be sent between clients and the server, such as passwords.

Demo required/forbidden

Some variables influence the recording of gameplay demos and as such need to be included/excluded from the demo recording.

Change notification

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.cfg is 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 config.cfg.
  • newbindings.txt - This file contains "ideal" keys for certain actions. When the game starts, it checks to see if the keys specified in this file are used for anything. If not, then the action specified there is automatically applied to them. This file is located in the tf_misc_dir.vpk in the scripts folder.
  • 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:
    • scout.cfg, soldier.cfg, pyro.cfg, demoman.cfg, heavyweapons.cfg, engineer.cfg, medic.cfg, sniper.cfg, spy.cfg
  • 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.cfg file will be automatically run any time Well (Control Point) is loaded.

Script paths

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

Remote console

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.

Map issued commands

Maps can issue console commands using the point_servercommand, point_clientcommand and point_broadcastclientcommand entities. An example of a map that does this is Walkway. In Team Fortress 2, sv_allow_point_servercommand must be set to always in order for this to work. VScript can also issue console commands.

See also