Basic tutorial 3
Using more than one cfg file.
People often ask me why should I use more than one cfg file? Why not only use your autoexec.cfg file? Well there are 2 answers in my opinion:
* The maximum file size and
* Creating clarity and structure in your config.
I'll discuss both!
Maximum file size
The file size of a cfg file cannot exceed 16kb. Since it is no more than a simple text file(, but with another extension), you can add a lot of stuff to it before you reach that maximum.
Clarity and structure
Instead of putting everything in one file it's better if you try to divide all your settings, binds and scripts over different cfg files, instead of putting everything into 1 cfg file. Let's say you put everything into 1 file and after a perioid of time you have produced over 200 lines of code in that file. Wouldn't it be hard to find a certain line of code in all that text? Now if you were searching for a certain script and it was in a seperate cfg file, you would not have a problem finding it.
We talked about creating an autoexec file in the second tutorial and about executing it. All the commands inside will be executed. Now your next question would probably be: "Do I have execute all the scripts in console, like I have to do with the autoexec file, explained in the second tutorial? Well of course all cfg files have to be executed, but not manually in your console. Only your autoexec is executed from your console and all the other cfg files are executed from the autoexec.cfg, also explained in the second tutorial(in the part of using downloaded scripts).
Let me just give you one more simple example. Say you have 3 cfg files:
* settings.cfg
* controls.cfg
* scripts.cfg
You execute these files from your autoexec.cfg with the following lines:
exec settings.cfg
exec controls.cfg
exec scripts.cfg
If you then execute your autoexec.cfg in console, your autoexec will execute the other 3 cfg files. Piece of cake!
|