CFG: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added .vtest link in see also, removed link from 'exec', removed the note about the cfg folder since I added that to the description, and changed the description a little bit.)
(Change the description quite a bit, I also added a Common CFGs section for adding known .cfg files like modsettings.cfg.)
Line 3: Line 3:
}}
}}
{{DISPLAYTITLE:cfg}}
{{DISPLAYTITLE:cfg}}
.'''cfg''' files can be found everywhere and are not specific to [[Source]]. It is an abbreviation of ''configuration''.
'''.cfg''' files can be found everywhere and are not specific to [[Source]]. It is an abbreviation of ''configuration''.


In Source games, a configuration file can be executed to perform a list of console commands. CFG files can be written in any other plain [[text editor]]. To create one, right-click the blank space in a cfg folder, and go to <code>New>Text file</code>. Rename it to <code>myconfig.cfg</code> or whatever you want, as long as it ends in .cfg and is placed in the cfg folder. You can then open it in your text editor and put commands in.


Normally, the file <code>autoexec.cfg</code> is run when the game starts up, so you can easily put any commands that you don't want to enter each time into that.
In Source games, a configuration file can be executed to perform a list of console commands. CFG files can be written in any other plain [[text editor]]. To create one, right-click the blank space in a cfg folder, and go to <code>New>Text file</code>. Rename it to <code>myconfig.cfg</code> or whatever you want, as long as it ends in .cfg and is placed in the cfg folder. You can then open it in your text editor and put commands in.  Normally, the file <code>autoexec.cfg</code> is run when the game starts up, so you can easily put any commands that you don't want to enter each time into that.  They can also be ran from the console using "<code>exec <cfgname></code>" where filename is the name of the configuration file, with or without the extension. Sometimes people put exec lines into the <code>autoexec.cfg</code>, so that other cfg files are executed when the game starts up. Configuration files can be placed in subdirectories of the cfg folder. The exec command would require you to include the subdirectories in the command.


They can also be run from the console using "<code>exec <cfgname></code>" where filename is the name of the configuration file, excluding its .cfg extension. Sometimes people put exec lines into the <code>autoexec.cfg</code>, so that other cfg files are executed when the game starts up. Configuration files can be placed in subdirectories of the cfg folder. The exec command would require you to include the subdirectories in the command.
{{tip|You can add comments to .cfg files by using // .}}


== Common CFGs ==
This is a table listing common .cfg files found in mods and games alike.
{| class="wikitable"
! CFG !! Description
|-
| '''[[autoexec|autoexec.cfg]]''' || Ran on game start up.
|-
| '''modsettings.cfg''' || Ran every time a map is loaded.
|-
| '''config.cfg''' || Ran on game start up, this is created automatically when the player runs the game/mod for the first time.
|-
| '''config_default.cfg''' || Ran when no config.cfg is present or the player clicks the 'Use Defaults' button in the keyboard tab in the options panel, see [[Customizing Options: Keyboard]].
|-
| '''chapter#.cfg''' || Ran when the player picks the chapter, with # being the chapter number, see [[Adding chapters to your mod]].
|-
| '''game.cfg''' || Ran on game start up.
|-
| '''sourcevr_modfoldername.cfg''' || {{2013 add}} Ran when the player enables VR, replace modnamefolder with the name of your folder that [[gameinfo.txt]] is in.
|-
| '''skill_manifest.cfg''' || Ran on game start up, used to list the skill.cfgs to execute.
|-
| '''360controller.cfg''' || Used for players using XBox 360 controllers, lists the controls for the controller. {{TODO|Find out when this is executed.}}
|-
| '''360controller-linux.cfg''' || Used for players using XBox 360 controllers on Linux systems, executed after 360controller.cfg, lists the controls for the controller.
|-
| '''undo360controller.cfg''' || Used for players using XBox 360 controllers when they want to undo the effects of the controller. {{TODO|Find out when this is executed.}}
|-
| '''listenserver.cfg''' || Ran when a listen server is being started, and runs every time the map is changed.
|-
| '''server.cfg''' || Ran when a dedicated server is being started, and runs every time the map is changed.
|-
| '''[[valve.rc]]''' || Special cfg file with the .rc extension, it's ran on game start up and executes autoexec.cfg along with a few other commands.
|-
|}
== See also ==
== See also ==
* [[Mini-mod tutorial]]
* [[Mini-mod tutorial]]

Revision as of 16:39, 2 May 2017

Template:Otherlang2

.cfg files can be found everywhere and are not specific to Source. It is an abbreviation of configuration.


In Source games, a configuration file can be executed to perform a list of console commands. CFG files can be written in any other plain text editor. To create one, right-click the blank space in a cfg folder, and go to New>Text file. Rename it to myconfig.cfg or whatever you want, as long as it ends in .cfg and is placed in the cfg folder. You can then open it in your text editor and put commands in. Normally, the file autoexec.cfg is run when the game starts up, so you can easily put any commands that you don't want to enter each time into that. They can also be ran from the console using "exec <cfgname>" where filename is the name of the configuration file, with or without the extension. Sometimes people put exec lines into the autoexec.cfg, so that other cfg files are executed when the game starts up. Configuration files can be placed in subdirectories of the cfg folder. The exec command would require you to include the subdirectories in the command.

Tip.pngTip:You can add comments to .cfg files by using // .

Common CFGs

This is a table listing common .cfg files found in mods and games alike.

CFG Description
autoexec.cfg Ran on game start up.
modsettings.cfg Ran every time a map is loaded.
config.cfg Ran on game start up, this is created automatically when the player runs the game/mod for the first time.
config_default.cfg Ran when no config.cfg is present or the player clicks the 'Use Defaults' button in the keyboard tab in the options panel, see Customizing Options: Keyboard.
chapter#.cfg Ran when the player picks the chapter, with # being the chapter number, see Adding chapters to your mod.
game.cfg Ran on game start up.
sourcevr_modfoldername.cfg Template:2013 add Ran when the player enables VR, replace modnamefolder with the name of your folder that gameinfo.txt is in.
skill_manifest.cfg Ran on game start up, used to list the skill.cfgs to execute.
360controller.cfg Used for players using XBox 360 controllers, lists the controls for the controller.
Todo: Find out when this is executed.
360controller-linux.cfg Used for players using XBox 360 controllers on Linux systems, executed after 360controller.cfg, lists the controls for the controller.
undo360controller.cfg Used for players using XBox 360 controllers when they want to undo the effects of the controller.
Todo: Find out when this is executed.
listenserver.cfg Ran when a listen server is being started, and runs every time the map is changed.
server.cfg Ran when a dedicated server is being started, and runs every time the map is changed.
valve.rc Special cfg file with the .rc extension, it's ran on game start up and executes autoexec.cfg along with a few other commands.

See also

External links