x
ETF2L is looking for new Staff to recruit! Are you interested in supporting the league? Then click here for more details on what we can offer and how to apply! 

Forum

TF2 configs for dummies!

Created 19th September 2012 @ 15:07

Add A Reply Pages: 1 2 Next »

Spike Himself

TC

While the title says “for dummies”, this little guide does assume at least some basic knowledge of how configs in TF2 work. There is plenty information available on the web; a simple Google search will teach you many things :)

This guide is also not so much about all the commands TF2 has to offer, or how to use them, but much rather about how to keep your config files organised and readable. And not least important, safe from other people’s POV demos! There are some code examples below for illustration, though.

Disclaimer: Any code examples in this guide are for illustrative purposes only and aren’t at all guaranteed to actually work! :)

For convenience, here’s a modest introduction to the very basics of how TF2’s config files work, but again, Google is your friend if you want to know more!

Everything in the keyboard setup in TF2 is saved to a text file. You can freely edit this textfile; it is named config.cfg and is located in your-steam-folder\steamapps\your-steam-name\Team Fortress 2\tf\cfg. By default this steam folder is found at C:\Program Files\Steam. You will find several other .cfg files in the same folder. Have a look at them if you’re interested. More on them later on in this guide!

With that said, you should NOT edit config.cfg, because any changes you make through the menus in-game will overwrite this file and carelessly get rid of your changes. Watching someone else’s POV demo will do the same.
An easy work-around to this, as many would suggest, is making the file read-only, but I recommend against doing this, because it’s unnecessary and not at all an elegant solution.

If I can’t make my config.cfg read-only, then how can I customise my config?

Well, that entirely depends on your needs. Many people will suggest editing autoexec.cfg (note that this file does not exist by default, but TF2 will use it once it’s there). This is another method I’m not at all fond of. And neither should you be! autoexec.cfg will be executed (= its contents will be read and used) after TF2 is launched. When you switch class, or die and respawn, this file is not executed again. This makes the file very viable for config stuff not related to any classes, like spam-binds, but really that is the only thing it is viable for. There is more to it though – keep reading!

Didn’t Chris say that I should put his FPS configs in autoexec.cfg?

He may very well have done, and frankly, he is right. It will work. However, it will also put a lot of stuff in there. While this is not necessarily a huge deal, it will make the file messy. Besides, do you ALWAYS want to use an FPS booster config? Do you never record movies?

A much more elegant solution is to keep separate things in separate files!

For example, if you use Chris’ maxframes config for your games and his maxquality config for recording movies, you could opt to make two new files: fps_maxframes.cfg and fps_maxquality.cfg. Then in autoexec.cfg all you have to add is these two lines:

exec fps_maxframes
//exec fps_maxquality

(the double slashes are used to “comment out” the line – that is, TF2 will just ignore it)

Next time Chris updates his configs, all you have to do is replace that one file. No longer any need to skim through various other config lines that you may have in autoexec.cfg, but everything stored only where it belongs. When you want to record a movie, comment out (= add two slashes in front of) the fps_maxframes line and uncomment (remove the slashes in front of) the maxquality line.
Simples!

To take this a step further, create a file called movie.cfg and add this line to it:

exec fps_maxquality
This file also gratefully lends itself to adding more movie-specific settings (for example, you may want to hide the chat or the kill feed in your movies). Next time you want to record a movie, open up the console in TF2 and enter exec movie. Done!
Now you can go back to autoexec.cfg and remove the maxquality line. There, that’s cleaned up again.

So what if I want different crosshair or viewmodel settings for my shotgun?

First of all, for those not in the know, you can bind a series of commands to a key (separated by semicolons). You can also make aliases, which are basically just “shortcuts” to a series of commands.

bind "w" "+forward" // Pressing W will make you walk forward!
bind "z" "+duck; +jump" // Pressing Z will make you duck and jump at the same time!

alias "spambindlol" "say LOL U MAD" // Creates a 'new command', but it's not yet bound to any keys!
bind "q" "spambindlol" // Pressing Q will spam the chat!

Now then, back to shotguns.

Let’s start by opening up your soldier.cfg file and add a line to bind a key to switch to your shotgun:

bind "2" "slot2"

You can probably find this very line in config.cfg! It doesn’t do anything other than switching to the shotgun, though.
Let’s suppose you want to change the viewmodel’s fov and change the colour of the crosshair:

bind "2" "slot 2; viewmodel_fov 175; cl_crosshair_red 255; cl_crosshair_blue 64; cl_crosshair_green 64"

(cl_crosshair_[red|green|blue] can have any value between 0 and 255, where a lower value makes it darker (less colour) and higher values give it more colour, thus makes it lighter)

There, now you have a very distant shotgun on your soldier, but at least the crosshair is nice and colourful!

Now, what if you want the same settings on your engineer as well? Simple, right, just copy the code over to engineer.cfg?? Well yes, that would work, but, again, it’s an unnecessary solution and far from elegant. Next time you want to change the viewmodel fov on both shotguns, you’d have to edit both files. That’s unnecessary effort!!

To keep things nice and clean, consider making a new file, aliases.cfg. In this file you will from now on store all your aliases! Once you’ve created the file, add the following line to it:

alias "shotgun" "slot 2; viewmodel_fov 175; cl_crosshair_red 255; cl_crosshair_blue 64; cl_crosshair_green 64"

And perhaps something for your rocket launcher, too:

alias "rockets" "slot 1; viewmodel_fov 90; cl_crosshair_red 255; cl_crosshair_blue 255; cl_crosshair_green 0"

Meanwhile, back in soldier.cfg:

exec aliases
bind "1" "rockets"
bind "2" "shotgun"

Simples!

Using this method, you’ll quickly find you have many similar binds across all the classes. You may even have a bunch of binds that are exactly the same for most or all classes. Are you thinking what I’m thinking? That’s right, binds.cfg for default binds!
We will load the default binds in each class config, so that every time you switch class, first all the binds get reset to your defaults, and then your class-specific binds will overwrite some of those defaults.
You may also find it useful to have your aliases available when binding keys! For this reason, we shall move exec aliases into binds.cfg. Now, in our class configs, all we have to do is exec binds, like so:

binds.cfg
exec aliases
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"

Back in soldier.cfg:
exec binds
bind "1" "rockets" // binds.cfg does already bind 1 and 2, but we're discarding those by adding them here :-]
bind "2" "shotgun"
// no need to bind "3"; binds.cfg already does this!

And in engineer.cfg:
exec binds
bind "1" "shotgun"
// no need to bind 2 and 3; binds.cfg already does this!

See where that’s going? Beautiful isn’t it? :D

On a completely different subject: Watching POV demos without breaking your config and without making your config read-only! How? Well, read on:

Copy your config.cfg and name the new file myconfig.cfg. You may choose to remove all the binds from this new file (you will put those in binds.cfg now, right?).
In autoexec.cfg add this line:

exec myconfig

If you have an FPS config, make sure the new config file and the FPS config are executed in the right order! The FPS config may contain settings that are also in your myconfig.cfg, and in order for the FPS config not to behave unexpectedly, it should be the last thing to run. Chris will also not be happy if you blame his config for messing up your game, while it is in fact your clumsy config undoing the FPS config’s work!

exec myconfig
exec fps_maxframes

There. Your config files are now forever safe, readable and organised!

tl;dr
+ Create a copy of config.cfg and exec that file in autoexec.cfg
+ Keep separate things in separate files: binds.cfg, aliases.cfg, movie.cfg, fps_maxframes.cfg, etc…
+ Be sure that you have all binds and aliases available when you switch class or respawn, by executing them from within each class config.

Happy config’ing!


Last edited by Spike Himself,

maukkaaa

you spelled fpx in the first part where you mentioned about using 2 fps configs

Spike Himself

TC

Quoted from maukkaaa

you spelled fpx in the first part where you mentioned about using 2 fps configs

Oops! Fixed now, thank you :)

maukkaaa

oh and do you know whats the command for the default crosshair the one that switches when you change weapons?

feeling

ist doof

Quoted from Spike Himself

bind “z” “+duck; +jump” // Pressing Z will make you duck and jump at the same time!

That is wrong. Every +command needs a -command, except if you only bind the +command without anything else.

It has to look like this:
alias +djump "+jump;+duck"
alias -djump "-jump;-duck"
bind KEY "+djump"

Quoted from maukkaaa

oh and do you know whats the command for the default crosshair the one that switches when you change weapons?

default crosshair:
cl_crosshair_file ""

default size:
cl_crosshair_scale "32"

default color:
cl_crosshair_blue "200"
cl_crosshair_green "200"
cl_crosshair_red "200"


Last edited by feeling,

Spike Himself

TC

Quoted from feeling

That is wrong. Every +command needs a -command, except if you only bind the +command without anything else.

It has to look like this:
alias +djump "+jump;+duck"
alias -djump "-jump;-duck"
bind KEY "+djump"

Aye, you are correct – I should’ve used a different example to illustrate my point :)
(deliberately chose not to cover the +/- thing at all because it’s a) confusing to most people and b) irrelevant to the topic)


Last edited by Spike Himself,

eleyos

Engie’s shotty is actually slot1. Just saying.

ondkaja

.:[aAa]:.

The scripting guide on the official TF wiki is less retarded in my opinion. http://wiki.teamfortress.com/wiki/Scripting

Spike Himself

TC

Quoted from ondkaja

The scripting guide on the official TF wiki is less retarded in my opinion. http://wiki.teamfortress.com/wiki/Scripting

It’s also about scripting and not about keeping your files organised.

octochris

(0v0)

The suggestion about configs is a bad idea that will end with bad things happening. The configs are not supersets of each other. Don’t expect help from me if you do it this way, because it will be completely impossible to tell what the hell is going on.


Last edited by octochris,

Spike Himself

TC

It is in fact very much the exact opposite :)

What sort of problems are you foreseeing?

slate

(ETF2L Donator)
AMG

please suggest putting something a la “exec defaultclass.cfg” in every classconfig. So many people rebind everything in every classconfig because they use mouse2 for something else as solder or whatever.

envy

Quoted from octochris

Don’t expect help from me if you do it this way, because it will be completely impossible to tell what the hell is going on.

If my autoexec.cfg consist of
exec main
exec gfx
exec clear
exec crosshairs
why it’s harder to tell what the hell is going on? main it’s a fully working config.cfg, gfx – only your config, clear it’s only unbindall and binds, and crosshairs is full of aliases. Also, every class config has “exec clear”. This way seems more consistent and less chaotic.
The only thing I can come up that people don’t edit gfx.cfg well, so for instance, m_rawinput switches to 0 every time.

ondkaja

.:[aAa]:.

Quoted from Spike Himself

[…]

It’s also about scripting and not about keeping your files organised.

If you don’t even know about the exec command, what’s the chance of having so many scripts that you have to keep them organised in different files?

octochris

(0v0)

Quoted from envy

[…]
If my autoexec.cfg consist of
exec main
exec gfx
exec clear
exec crosshairs
why it’s harder to tell what the hell is going on? main it’s a fully working config.cfg, gfx – only your config, clear it’s only unbindall and binds, and crosshairs is full of aliases. Also, every class config has “exec clear”. This way seems more consistent and less chaotic.
The only thing I can come up that people don’t edit gfx.cfg well, so for instance, m_rawinput switches to 0 every time.

I should clarify, the suggestion to use multiple frames/quality configs interchangeably.

Add A Reply Pages: 1 2 Next »