# The unfair edge of TF2 scripting
TF2 is a funny little multiplayer first person shooter that released in 2008. By editing a number of files in the game’s folders you can make playing it easier:
TF2 allows you to use scripting to some extent ingame, meaning you can type a command into the console and run it, regardless of what server you’re on.
say_team "Their sentry is down!"
You can also type a series of commands into a file (called a config), and then run
exec file in the console, which will run those commands as if they had been typed into the console normally.
say "Y"; wait 300 say "M"; wait 300 say "C"; wait 300 say "A"
Moreover, certain events in TF2 prompt the console to
exec some files, if they exist. If you launch a listen server (ie
map pl_upward), the console will attempt to run
…more importantly, every time you switch classes, the console attempts to run a script named after the class (eg.
This presents the possibility of running specific instructions based on what class you’re playing as; Change what X button does when you’re using Y character, display more or less information on screen, etc.
The game also runs a file named
autoexec.cfg when the game starts, and when joining a map. A common use of this file is to set custom binds, and alter the graphics settings using commands, rather than edit them in the Options window. This affords players the possibility of using “legacy” graphics settings.
Now, TF2 is a 10 year old game, and this feature has been around for that long. Can you guess what the community has done with this?
Predictably, in order to maximize performance at the expense of graphical quality, players resort to “maxframes” configs, such as Chris Down’s, Comanglia’s, etc, which use the aforementioned “legacy” commands.
Alongside this, people have created helpful scripts, such as the null-movement script, which makes it so when you press both A & D your character doesn’t just stop moving, and instead moves in the last one of those directions you pressed. There’s been scripts that lower your FOV temporarily to “zoom” in, scripts that change your weapons instantly, etc. There’s a lot.
So let’s review. TF2 runs configs by itself when:
- You start the game
- You launch a map
- listenserver.cfg (if it’s a listen server)
- You change classes
- scout.cfg / soldier.cfg / pyro.cfg / demoman.cfg / heavyweapons.cfg / engineer.cfg / medic.cfg / sniper.cfg / spy.cfg
And these are all files you can edit to your liking. Bear in mind, you can save these files (they don’t exist unless you’ve created them already) in
/tf/cfg/, or in your custom folder, in
How is this helpful?
Here’s an example:
// auto-disguise on attack, toggled with "i" alias +disguiseattack "+attack" alias -disguiseattack "-attack; lastdisguise" alias "spytoggle" "on" alias "on" "bind mouse1 +disguiseattack; alias spytoggle off; echo DISGUISE ON ATTACK ENABLED" alias "off" "bind mouse1 +attack; alias spytoggle on; echo DISGUISE ON ATTACK DISABLED" bind "i" "spytoggle" on
Above is part of my spy.cfg. This excerpt makes it so that whenever I attack as spy, which drops your disguise, I immediately begin disguising afterwards.
If you are not aware, disguising takes about 2 seconds, and requires you to pull out your Disguise Kit (press 4), and select a class (1-9). You can also put on your last used disguise by pressing B. Switching disguises while already disguised (after the 2 second period) is near instantaneous.
By shortening the worfkflow from pressing one or two buttons to essentially nothing, regaining your disguise is much faster and playing spy becomes easier.
What else can you do with commands?
You can do just about anything. A common, annoying practice is to bind a key to say something in chat.
bind <key> "say I just killed you!"
You can, for example, bind 4 keys to the
load_itempreset <0-3> command, allowing you to change loadouts without opening the loadout screen. You could make it so whenever you bring up the scoreboard you also open
net_graph 1, which displays your fps and real-time ping:
alias +scoreboard "+showscores; net_graph 1" alias -scoreboard "-showscores; net_graph 0" bind "TAB" "+scoreboard"
As of this writing, this is how my configs work:
- When you launch the game, autoexec.cfg also runs graphics.cfg and reset.cfg:
- graphics.cfg sets a number of graphics settings, some of which cannot be changed using just the ingame Options menu
- reset.cfg binds all of my keys, ie W to go forward, TAB to open the scoreboard, etc. I keep this file commented so I know what does what.
- Picking a class will run any one of the 9 class configs, which then run reset.cfg again.
- Whenever you launch a listen server, listenserver.cfg is run.
- You can run regen.cfg and skeys.cfg yourself, they’re not connected to anything that might happen in TF2
My scripts allow me to:
- set my crosshair to a default,
- …and change based on what class I’m playing as
- set my viewmodels on or off by default
- …and on or off based on what class I’m using
- display advanced netgraph (
net_graph 4), and compact memory (
mem_compact) whenever I open the scoreboard
- switch my viewmodels on/off using a bind (T)
- jump on scrollwheel (helps with bunnyhopping, and retaining momentum after landing)
- press a button to change to my loadouts
- probably something else I forgot
Is this fair?
TF2 has some of the worst starting settings of any game I’ve ever played, setting the FOV to 70 when you first launch it, and having quickswitch off by default. A lot of specific graphical settings are hidden, only accessible via the console or configs.
I have conflicted feelings about configs. I don’t think any new competitive game should have this sort of feature, but it’s still immensely useful. It’s immensely user-unfriendly to anyone unfamiliar with programming, and the only way I can see this being sort-of-haphazardly dealt with is with some sort of drag-and-drop interface.
Is it cool?
Usually. You can make the game much easier using this but it won’t make you play better. You can’t replace being good at aiming with being able to switch weapons instantly, or something.
Plus, you can do dumb things like print the entire script of The Matrix (1999).