Config File

version 2 by Aaron Reed

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Initialization

    Using the extension requires a three-part initialization process. First, include the extension and compile your project. This will create a blank config file in the project directory. Edit this file with a text editor and define a set of key value pairs separated by an equals sign that define your variables and their default values. For instance, your config file might look like this (the first line is automatically created when Inform creates the file:

        * //57BB9588-4BA9-4AD2-BC35-869673E5C13F// config
    Variables must contain no spaces, and there must in addition be no spaces between the end of the variable name and the number. Blank lines or lines starting with an exclamation point are ignored. You may add a space and any additional characters after the numeric value; this extra material will be ignored. Avoid tab characters, which seem to cause an inexplicable slowdown in some interpreters when reading the file.

    Save the config file and recompile your program. A block of Inform code will be generated to create these variables, along with infrastructure that will allow their values to be read in. Simply copy and paste this code block into your project, recompile once again, and you're set. You can now reference all variables in your Inform code, and change their values in the config file at will. If the config file is absent at the time the story is executed, the default values you initially defined will be used.