CFG: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Rearranged first paragraph. Moved some of it to a Sytax section.)
mNo edit summary
Line 1: Line 1:
{{lang|CFG}}
{{lang|CFG}}
In {{game name|src|name=Source}} games, a '''configuration file''', or '''CFG''', is a text file used to execute a newline-delimited list of [[console command]]s to the [[Developer Console]]. The '''.cfg''' file extension can be found everywhere and is not specific to Source.
'''Configuration file''' (or '''CFG''') is a {{source|4}} games text file used to execute a newline-delimited list of [[ConCommand|console command]]s to the [[Developer Console]]. The '''.cfg''' file extension can be found everywhere and is not specific to Source.


The folder <code><game>/cfg/</code> is usually dedicated to CFG files and can be further organized in subdirectories, and referred in {{ent|exec}} by [[W:Path_(computing)#Absolute_and_relative_paths|relative path]].
The folder <code><game>/cfg/</code> is usually dedicated to CFG files and can be further organized in subdirectories, and referred in {{ent|exec}} by [[W:Path_(computing)#Absolute_and_relative_paths|relative path]].
Line 8: Line 8:
{{tip|The file <code><game>/cfg/autoexec.cfg</code> is run when the game starts up if it exists, so one can easily create the file and put any commands that one doesn't want to type each time.}}
{{tip|The file <code><game>/cfg/autoexec.cfg</code> is run when the game starts up if it exists, so one can easily create the file and put any commands that one doesn't want to type each time.}}


== Syntax ==
==Syntax==
* Each line is considered a command. Note that each command can still consist of multiple commands delimited with the semicolon <code>;</code>.
* Each line is considered a command. Note that each command can still consist of multiple commands delimited with the semicolon <code>;</code>.
* Comments can be added by using <code>//</code>. These two characters and everything following after them is ignored by the engine until the next line starts.
* Comments can be added by using <code>//</code>. These two characters and everything following after them is ignored by the engine until the next line starts.
* Cheat commands require {{ent|sv_cheats|1}} enabled, otherwise they have no effect. To configure a mod's default cheat convars, [[VScript]] or [[point_servercommand]] can achieve this on map start without having to enable sv_cheats.
* Cheat commands require {{ent|sv_cheats|1}} enabled, otherwise they have no effect. To configure a mod's default cheat convars, [[VScript]] or [[point_servercommand]] can achieve this on map start without having to enable sv_cheats.


== Common CFGs ==
==Common CFGs==
This is a table listing common CFG files found in mods and games alike.
This is a table listing common CFG files found in mods and games alike.


Line 25: Line 25:
| '''config.cfg''' || Ran on game start up, this is created automatically when the player runs the game/mod for the first time. {{note| On game quit, key binds in this file will be re-written to current bindings, so making changes to this file is most likely pointless.}}
| '''config.cfg''' || Ran on game start up, this is created automatically when the player runs the game/mod for the first time. {{note| On game quit, key binds in this file will be re-written to current bindings, so making changes to this file is most likely pointless.}}
|-
|-
| '''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]].
| '''[[Customizing_Options:_Keyboard#cfg.2Fconfig_default.cfg|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]].
| '''chapter#.cfg''' || Ran when the player picks the chapter, with # being the chapter number, see [[Adding chapters to your mod]].
Line 31: Line 31:
| '''game.cfg''' || Ran every time a map is loaded.
| '''game.cfg''' || Ran every time a map is loaded.
|-
|-
| '''sourcevr_modfoldername.cfg''' || {{2013 add}} Ran when the player enables VR, replace modfoldername with the name of your folder that [[gameinfo.txt]] is in.
| '''sourcevr_modfoldername.cfg''' || {{src13|since}} Ran when the player enables VR, replace modfoldername with the name of your folder that [[gameinfo.txt]] is in.
|-
|-
| '''skill_manifest.cfg''' || Runs every time the map is changed, used to list the skill.cfgs to execute.
| '''skill_manifest.cfg''' || Runs every time the map is changed, 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.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, lists the controls for the controller. {{confirm|executed after 360controller.cfg.}}
| '''360controller-linux.cfg''' || Used for players using XBox 360 controllers on Linux systems, lists the controls for the controller. {{confirm|executed after 360controller.cfg.}}
|-
|-
| '''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.}}
| '''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.
| '''[[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.
| '''[[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.
| '''[[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.
Line 49: Line 49:
|}
|}


== See also ==
==External links==
* [http://filext.com/detaillist.php?extdetail=cfg&goButton=Go More information on the format]
 
==See also==
* [[Mini-mod tutorial]]
* [[Mini-mod tutorial]]
* [[vtest]] - Alternative to cfg files.
* [[vtest]] - Alternative to cfg files.
Line 55: Line 58:
* {{ent|alias}}
* {{ent|alias}}
* {{ent|echo}}
* {{ent|echo}}
== External links ==
* [http://filext.com/detaillist.php?extdetail=cfg&goButton=Go More information on the format]


[[Category:File formats]]
[[Category:File formats]]
[[Category:Glossary]]
[[Category:Glossary]]

Revision as of 11:09, 16 May 2022

English (en)Deutsch (de)Translate (Translate)

Configuration file (or CFG) is a Source Source games text file used to execute a newline-delimited list of console commands to the Developer Console. The .cfg file extension can be found everywhere and is not specific to Source.

The folder <game>/cfg/ is usually dedicated to CFG files and can be further organized in subdirectories, and referred in exec by relative path.

CFG files can be run from the console using the exec command.

Tip.pngTip:The file <game>/cfg/autoexec.cfg is run when the game starts up if it exists, so one can easily create the file and put any commands that one doesn't want to type each time.

Syntax

  • Each line is considered a command. Note that each command can still consist of multiple commands delimited with the semicolon ;.
  • Comments can be added by using //. These two characters and everything following after them is ignored by the engine until the next line starts.
  • Cheat commands require sv_cheats 1 enabled, otherwise they have no effect. To configure a mod's default cheat convars, VScript or point_servercommand can achieve this on map start without having to enable sv_cheats.

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 on game start up, unless not found in mod folder.
config.cfg Ran on game start up, this is created automatically when the player runs the game/mod for the first time.
Note.pngNote: On game quit, key binds in this file will be re-written to current bindings, so making changes to this file is most likely pointless.
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 every time a map is loaded.
sourcevr_modfoldername.cfg (in all games since Source 2013) Ran when the player enables VR, replace modfoldername with the name of your folder that gameinfo.txt is in.
skill_manifest.cfg Runs every time the map is changed, 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, lists the controls for the controller.
Confirm:executed after 360controller.cfg.
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.

External links

See also