This wiki is static and therefore read-only as of August 2011. More information here.
Hosted by NexuizNinjaz.com

Episode 4: Config files

Preview


After discussing settings and variables in the past episodes this time we will have a look at config files and what happens with them if you launch and close Nexuiz. Would be a shame if these nice tweaks you did got lost due to improper handling of your config, right?

After watching this episode you will be able to

  • locate your default config file
  • utilize the 3 most common commands in config files
  • understand what's happening under the hood when Nexuiz is launched/closed


Spread the word!

QuickFacts


The main configuration file is called config.cfg. It's main purpose is to hold the changes made in the Nexuiz's config menu. Therefor it is rewritten from scratch every time you close Nexuiz. This implies that it can only hold variables that are automaticcaly saved on shutdown (refer to last episode). If you find the changes you made by hand to config.cfg to be lost use autoexec.cfg instead.

Location of main config file:

  • Windows: inside Nexuiz/data folder
  • Linux/Mac: inside /home/username/.nexuiz (mind the dot, it is a hidden folder)

General config elements:

  • exec: execute another config file
    • usage: exec <configfile>
    • allows for specialized config files (e.g.: demo recording, game mode specific settings)
  • set: creates new variables or changes values of existing ones
    • usage: set <name> ”<value>” (mind the quotes)
    • additional description for the console's autocompletion can be provided:
      • set <varname> ”<value>” ”<description>”
  • seta: “permanent” version of set
    • usage: identical to set
    • variables created or changed with seta will be saved to config.cfg if applicable
    • see Episode 3: Advanced settings menu for explantion which variables can be saved automatically

autoexec.cfg

  • Location: same as config.cfg (you might have to create it)
  • everything put here is apllied for sure on start up
  • used for variables that are not written to config.cfg and aliases

Transscript


Hello and welcome to episode no. 4 of the Nexuiz In-Depth video podcast. My name is Marius Shekow aka GreEn`mArine and this time

  • I will explain what happens under the hood when you open and close Nexuiz, in regard to the settings that will be saved to your config. For this I'll explain the 3 most used elements in the config files, which is the exec command, the set command and the seta command!
  • Your config file btw is called config.cfg. I'll explain what it contains later. On windows you will, by default, find it in your Nexuiz/data folder, at the location where you unpacked nexuiz with your zip program. On Linux or mac, you have to navigate to your home folder, e.g. /home/yourusername/ and then go into the hidden folder .nexuiz, and then into the data folder to see the config file. Once you open it with a text editor you'll see all your keybinds and manipulated variables are there, which were set using a weird seta command, but I'll come to this one in a second.
  • Now I'll explain the exec command. The syntax for its usage is to enter exec and then the name of the config file. This config file is just a textfile. Here I've opened a sample file called test.cfg which is located in my data folder of Nexuiz, that sets the timelimit to 5 and then, in the next line, just shows me a message on the console that it did that. Now in nexuiz when I do exec test.cfg, it will open the file and go through each line and act as if I had written the content of this line into the console myself. It will first set the timelimit to 5 and then, immediately after, show me the message of the echo command.
  • The trick is that the exec command can be nested. Here I have a config file a.cfg which sets some variables, then executes a config file b.cfg and then sets some more variables. Here we have the file b.cfg that just contains a small message. When I then execute the a.cfg the lines that are executed after each other look like this. So it behaves as if the exec b.cfg was replaced by the content of file b.cfg.
  • Now I'll explain the set command which is used very often too:
    • set, followed by the <name> and <value> of the variable, creates a new variable with the specified name and value. If the variable already existed it will just modify its value. However, if you know the variable existed already, you don't have to write the set, but it won't be of any harm either! Also keep in mind that it is recommended to quote the value of the variable, especially if it is a phrase that has spaces in it, e.g. set my_new_var “hello Benjamin”
    • If you wanted, you can also provide a description for the variable which will be shown when using the auto-completion feature of the console. To do this, provide a QUOTED description after the value of the variable (set nameOfVar value “my description”)
  • explain seta
    • Now to the seta command. seta works just like the set command regarding its syntax. seta will also create a new variable with the specified name, value and description, or modify one that already existed. But what seta additionally does is to mark the variable to be a saved variable, which means that once you close nexuiz, it will automatically save the value to your config file, as opposed to variables created with set which won't be saved. But keep in mind that marking a variable as saved only works if seta created a new variable, not when modifying an existing one! This means that you can't convert existing non-saved variables to saved variables permanently.
  • Let's have a look what happens when you open Nexuiz. What happens is that the game will always open the file called quake.rc which is also just a config file itself. It can be found in that huge archive file in your Nexuiz/data folder, which you can open using any zip program, btw.
    • It will first execute the default config of Nexuiz, which creates a lot of variables for the game, such as the damage variables for the weapons or many others, and it also creates default keybinds.
    • After that it loads your config.cfg. Note that what ever is contained in your config file, it will overwrite the variables or keybinds from the default.cfg.
    • Then it executes the campaign config file which saves your personal progress in the single player campaigns.
    • Last but not least it executes the file autoexec.cfg. If you don't have it yet you need to create it in your Nexuiz/data folder, or when you are on linux you would normally create it in the /home/username/.nexuiz/data folder that I showed to you earlier. In this file you can put anything you like and you can be sure that all variables or keybinds you put there will be applied once the game is loaded. You usually use this file to overwrite values of variables that are normally not saved to the config, and you also use it for defining aliases, which I'll explain in another session. It also very handy to make sure the value of a few variables are reseted to the default you want it to be, especially for variables that you might sometimes change during the game, such as your in-game nick.
  • Now you know what happens when Nexuiz starts, but what happens when nexuiz closes?
    • When you close the game, it will automatically use the command saveconfig, which completely rewrites your config.cfg from scratch. Btw, you can use this command manually by entering it in the console, to make sure that variables you changed are really saved. The problem is that sometimes, when nexuiz crashes due to some problems, that saveconfig command is NOT called, and all changes you did to variables or keybinds since the last start will be lost. Now you might wonder: well, what is actually being saved to the config?
    • saved: keybinds and variables marked as saved that have a different value to their default value You can check that yourself by opening the config.cfg in a text editor and you'll see that it contains all the variables from the advanced settings menu from the previous episode that are written in bold yellow color.
    • not saved: aliases, saved variables which already have the default value, and variables that are not marked to be saved. As I said previously, the saveconfig command will rewrite the config.cfg from scratch each time you close nexuiz, which means that in many cases just putting something into your config file manually with a text editor will fail, because what ever you changed probably affected a non-saved variable. If this happens to you, place these changes in your autoexecute config instead!


Now you know what happens when opening and closing Nexuiz, and I hope I was able to demonstrate the config loading and saving mechanisms of the game. I know that all this console stuff isn't as exciting at times, but it is needed as a foundation to understand upcoming tutorials. In the next episode I'll show you a few tricks how you can modify from which location the config files are loaded, which allows easy configuration for multi-user or multi-purpose environments that you never thought were possible. This was GreEn`mArine for the AT dev team, have a good time and cu next week!

 
tech/indepth/episode4.txt · Last modified: 2009/06/01 22:38 by dim
Nexuiz Ninjaz Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
GFDL logoGFDLcontent Unless mentioned on the licensing page, the work on this page is licensed under the GNU Free Documentation License. The author states that the text and images can be used within the restrictions of this license (for example, they can be incorporated into certain free encyclopedias such as Wikipedia).
Kindly hosted by NexuizNinjaz.com