.cfg Files

From P2SR Wiki

Revision as of 22:45, 15 August 2021 by AMJ (talk | contribs) (formatting, linux -nojoy, foolproof syntax for exec)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Config Files (.cfg)

Overview

A config file is a file that stores commands for your game. In Portal 2, the game has many config files that it keeps track of for a variety of different purposes. As users, we can create config files that contain any commands we want.

Execution

The execution order for config files in Portal 2 goes as follows

  1. The autoexec.cfg is ran at startup, and is the first config file loaded.
  2. The config.cfg file is ran after, and loads in all of your saved binds and settings that carry over.

This means that the Autoexec is not a good place to put binds. They will be overwritten by your config.cfg file after the game loads. If you intend on setting up custom binds, enter them manually in console, or in an exec that is run separately.

Executing a .cfg file

To execute a .cfg file, it must be located in Portal 2's config folder (usually C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2\cfg) The file named autoexec.cfg will execute on game launch, any other config you make will need to be manually executed in the Portal 2 console. If the autoexec.cfg file doesn't exist, you can create it yourself by renaming and replacing the extension of a .txt file.

WRONG:

exec filename.cfg

RIGHT:

exec filename

Useful Tools

Filtering Out Junk Text

There are a few error messages or warning in the Source Engine that aren't useful, and will constantly fill up your console with garbage text, the command con_filter_enable 1 allows you to filter out specific strings from appearing in your console.

A common use of this filter is for CShader warning messages that fill your console with constant messages. Filtering it in your autoexec is simple. In the example below, any line with the text CShader is filtered out, but you can replace this with any string.

con_filter_enable 1
con_filter_text_out CShader

On Linux, there are junk console messages that appear every few seconds about controller configurations. To remove this message (and also remove controller controls), add -nojoy to your game's Launch Options in Steam.