Just for the sake of introduction,an “Autoexec.cfg” is a configuration file to customize the game according to your desire by changing some of the console variables.
This file actually executes all the included commands when the game is launched.Source based games can easily be tweaked and customized by executing all these console variables in one text document.
You can use any text editor to make your CFG file.All the configuration files must be pasted in “cfg” folder of the game i.e left 4 dead 2\left4dead2\cfg in case of L4d2.”Autoexec.cfg” is actually a list of “CVars” on a text document.
What Is Meant by “CVar”
CVar stands for console variable.A CVar can have different values and types e.g Boolean : 0 (off) or 1 (on), Integer : A whole number. (Example : 123, 1, -500, etc…), Float : A number with a decimal. (Example : 0.33, 1.5, 50.4, etc), String : A set of characters etc.All these commands can be found and executed in the Console windows.
You can access the console by pressing the button(`) above the Tab button.If it’s not working then you will have to enable console from settings.
// is a standard comment when coding, it’s used to put in information into coding files to explain/describe what’s going on, or to comment out bad code. So every new section in the config file must start with “//”.
For example, if you want to set in game name from autoexec.cfg then you can do it by adding some text in the file.You will see the same name everytime the game is launched.The code that you must enter in a text document for “in game name” should look like:
//Set in game name here
setinfo name yourname //edit yourname
Tobi is the name that will be visible on the developer console.
How to use the Boolean variables in Autoexec.cfg
One can also add Boolean values in the config file.For a Boolean variable there can be 2 outcomes only i.e either On/Off or True/False etc.For example if you wnt to turn the console On or Off you should use:
// Startup Settings
con_enable “1” //default 0; Enables Console
Similarly different CVars cn be added under the same startup class like cheats etc.
How to Reduce Lag Using Autoexec.cfg
You can improve your network performance to reduce the in game lag using the following CVars in the text document:
//Client Network Optimization
cl_updaterate “30” //default 20; packets per second you request from the server
cl_cmdrate “30” //default 30; command packets sent to server per second
cl_interp “0.067” //default 0.1; interpolation value to match updaterate 30
rate “30000” //default 10000; max bytes/sec the host can receive data
cl_timeout 60 //workaround for server disconnecting prematurely before map load
cl_resend “1.5” //default 6; seconds to wait before retrying to connect to a server
cl_lagcompensation “1” //default 1; Improves hit registration
This may take longer to connect to the server but it will definitely reduce lag.
How to Use/Add Binds in “Autoexec.cfg”
Binds are the shortcut keys to execute certain commands in the game repeatedly.For example of you want the Voice chat button other than “C” which is deault ofcourse,you can use the bind in the following way:
bind “v” “+voicerecord” //voice chat – Default: b
This will set the voice chat key to “B” so that you will have to press b everytime uo want to talk instead of “C”.You can add different binds for your own comfort.
How to Use Alias Command
One can execute commands one after the other in a sequence using a short “alias”.It can be any key on your keyboard.All you have to do is enter that alias key and all the commands bound to it would be executed e.g:
//Server Status and SM Admin
alias sv.check “toggleconsole; clear; echo [ SERVER STATUS CHECK ]; wait 60; status; wait 60; sm plugins list; wait 60; meta list;”
bind “F5” “sv.check” //Check Server Info in console
Here all the mentioned commands in the sequence are loaded on entering “F5” key in the console.
There are hundred of CVars and binds available on the internet for Left4dead2.Now since you know that how this Autoexec.cfg thingy works,you can add these CVars and binds as you desire or make your own. Here is a list of CVars you might be interested in, It includes both the console variables and the hidden variables which are not included in console.