Left 4 Dead 2

Left 4 Dead 2

67 ratings
Setting up an AutoExec.cfg
By мяFunreal
AutoExecutables allow you to: execute config files, bind keys, set Cvars and create aliases, as the game launches
Which is useful for people who have mods that require execution of certain commands.
   
Award
Favorite
Favorited
Unfavorite
Foreword.
"Auto Executables" automatically execute when the game is launched, so whatever is written into this file will be executed, aliased, bound, and set before the game even fully loaded.

This is useful for launching cfg files like outline glow scripts, setting aliases as shortcuts for commands, binding keys that you don't want to bind ingame, and also just setting cvars like the noclip speed.

Why would you need this?
Because some mods require you to change a Cvar or execute a file on game launch.
Examples:
  • Font mods require you to change the resolution on game launch.
  • Outline glow scripts require you to execute a config.
  • Talker scripts with radial menus require you to execute a config.
  • Adding reminders of certain commands like rebuilding audiocaches for a specific folder, allowing you to just copypaste the written line and execute it as a command.
Setup
In your steam library, go to L4D2, right click it and pick "Properties".


In the General settings, at the bottom is the Launch Options.
Add +exec !exec.cfg.


In "Installed Files" Click Browse.


An explorer window pops up, showing where L4D2 is installed.
Open the left4dead2 folder and then the cfg folder within it.
Create a new text file called !exec.cfg.

Make sure it is a cfg file, not a txt file called "!exec.cfg.txt"
!exec.cfg
Open !exec.cfg with a text editor and paste this empty prefab.
You don't really need this specific text, it's just organized and easy to spot ingame.
echo echo echo echo "_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_" echo echo echo // ----------------------{ Executables }------------------------- // ------------------------{ Aliases }--------------------------- // -------------------------{ Binds }---------------------------- // -------------------------{ Other }---------------------------- // --------------------------{ END }----------------------------- echo echo echo echo "_,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_" echo echo echo
Example Usage
Here's an example of how you might want to set up the contents of your settings:

Executables
Executables do one thing: Executes multiple cfg files on game launch.
Like Doktor Haus' (Zaeryn's) vocalizer mod, or my outline glow scripts.

Usage:
exec HausVoc.cfg exec glows/outline_glow.cfg exec glows/cl_glow_item.cfg exec glows/cl_glow_item_far.cfg exec glows/cl_glow_thirdstrike_item.cfg

Aliases
Aliases function as "Shortcuts" to commands.

Say you have to use the command mat_reloadallmaterials often, but you don't want to bind the command to a key, and you don't want to write the entire command either cause its quite long.
Using aliases you can make one word execute the command.

Or you want to execute a cfg file for testing, like the "singleplayer versus" commands, but you don't want to type out "exec !versus" manually, you can just type "vs" instead, thanks to the alias.

Or, perhaps you just want multiple commands to execute, without writing a new cfg.
Which requires you to separate each cvar with a ; .

Usage:
alias RelMat mat_reloadallmaterials //Write "relmat" as command to trigger mat_reloadallmaterials alias vs "exec !versus" //Write vs to execute the !versus.cfg //This one below disables all infected, except for the common infected. alias onlyci "director_start; director_no_bosses 1; director_no_specials 1; say CI Only"

Binds
Binds allow you to bind a key to a command.
Press the key while playing and the command you bound to it triggers.

Walking, jumping, shooting, are all keybinds. But the ingame keybind menu won't allow you to bind anything but basic movement and gameplay related inputs.
So a CFG or manual entering in the ingame console is required.

Usage:
bind n z_spawn //Press N to spawn a CI bind m z_spawn Witch //Press M to spawn a Witch bind j "upgrade_add LASER_SIGHT" //Give Yourself The Laser bind g "upgrade_add INCENDIARY_AMMO" //Give Yourself Incendiary Ammo bind h "upgrade_add EXPLOSIVE_AMMO" //Give Yourself Explosive Ammo //Swap CI variant by looking at them and pressing 6 bind "6" "z_increment_head;z_increment_skin;z_increment_lower; z_increment_upper"

Other
This section is meant for anything else that has no place above.
Such as setting a convar's default, or writing a message into the console log as a reminder.
You could also add the "Swap resolution" thing to reload fonts in here.
Usage:
sv_noclipspeed 2 //Makes noclipping faster by default. mat_setvideomode 3840 2100 1; wait 10; mat_setvideomode 3840 2160 1 //Echo lines write the content of the following "" into the console. As reminders. //The empty echo lines are as separators, to make it easier to read ingame. echo echo "QQQ Quits game" echo echo "snd_buildsoundcachefordirectory ../!Custom_Sounds" echo "snd_buildsoundcachefordirectory ../!Custom_Sounds/VOICE_44100HZ" echo echo "clear_attributes deletes all nav attributes when used in nav_edit 1" echo echo "sv_attributes applies survival-only map attributes, minus player start and finale" echo echo "Write new config using: host_writeconfig !navundo_defaultbinds.cfg" echo
Finished Appearance
Here's how a finished exec.cfg would look like ingame, and as raw file.

Closing Words
That's all.

Some people would say "just make a file called autoexec.cfg the game's loading that anyways."
- No, it doesn't always. Plus, having your own file gives your more controll over its name.

Have fun modding your game!

My Discord[discord.gg] - For whatever
My Paypal[paypal.me] - For don't-ations.
10 Comments
アンドレ 28 Jan @ 8:30am 
thanks
NiKo 20 Sep, 2023 @ 2:35pm 
thanks
小雨 20 Sep, 2023 @ 7:27am 
3
Trinojka 20 Sep, 2023 @ 6:30am 
thanks
alobx 18 Sep, 2023 @ 11:01am 
oh ok
мяFunreal  [author] 18 Sep, 2023 @ 4:30am 
People who play tf2, or csgo, or any source game could just look up auto exec in google and copy this here, then add their own settings.

Why would you want me to repost the same thing in another game's guide section just because a setting would be different?
alobx 17 Sep, 2023 @ 10:18pm 
i mean commands useful for tf and repost it in tf community thats it
мяFunreal  [author] 17 Sep, 2023 @ 3:05pm 
Since this is just a text file, you can use this in tf2 too.
alobx 17 Sep, 2023 @ 11:05am 
good job, we need that for tf2 too
好机会小渡 16 Sep, 2023 @ 8:04pm 
:health: