| 97 | The config file adds missing variables or sections and repairs unreadable values by resetting them to the default value, but it doesn't change or remove needless entries. This allows you to add comments or funny ASCII-art. Whitespaces are ignored, so you can format your config-file in every way you like. |
| 98 | |
| 99 | You can begin a line with a comment-symbol to ignore a line. If this removes an entry, a new one gets added to the end of the section, but you could add two versions of a line and comment one (for example when you want to test different settings without losing the previous value). There are four different comment-symbols: |
| 100 | * '''#'''comment: script-language style |
| 101 | * '''%'''comment: matlab style |
| 102 | * ''';'''comment: unreal tournament config-file style |
| 103 | * '''//'''comment: code style |
| 104 | |
| 105 | Different variable-types have different formattings in the config file. There are three different cases: |
| 106 | * '''Primitives''': varname=value |
| 107 | * '''Strings''': varname="string" |
| 108 | * '''Complex types''' (like vectors): varname=(value1, ..., valueN) |
| 109 | |
| 110 | * Additionally booleans can be denoted by using ''true'' or ''false''. |
| 111 | |
| 112 | There are four cases causing the parser to change the config-file: |
| 113 | 1. Case: A config-value is set, but can't be parsed (wrong formatting) or can't be converted to the wanted type: |
| 114 | * Change: The value is set back to the default |
| 115 | 1. Case: A config-value is missing but the section of the corresponding class exists: |
| 116 | * Change: The value is added at the end of the section |
| 117 | 1. Case: The whole section is missing or can't be found because the [!ClassName]-line is missing: |
| 118 | * Change: The whole section is added at the end of the file |
| 119 | 1. Case: The config-file is missing: |
| 120 | * Change: The config-file is created and all sections and values are written to the file. |
| 121 | |
| 122 | Example of a valid config-file: |
| 123 | {{{ |
| 124 | [MyClass] <-- This name is stupid |
| 125 | firstValue_ = 1.000000 |
| 126 | secondValue_ = 1.0 |
| 127 | thirdValue_ = 1 |
| 128 | |
| 129 | [OtherClass] <-- This name is even worse |
| 130 | //teststring = "test" |
| 131 | teststring = "teeeeeeeeeeeest" |
| 132 | |
| 133 | [StupidNamedClass] <-- This name rocks |
| 134 | position1_=(1.0, 2.0, 3.0) |
| 135 | position2_ = ( 1.000000 , 2.000000 , 3.000000 ) |
| 136 | position3_ = (1,2,3) |
| 137 | |
| 138 | gagagugubleeeeeeeeeep! |
| 139 | |
| 140 | [LastClass] <-- Where did you know...? Now this is scary... |
| 141 | moo_ = "Oh yes they do!" |
| 142 | bTheyMoo_ = true |
| 143 | }}} |