Function ReadSettings(filePath: string, [group:Integer=0], memfile:Element=NULL) : Integer
Returns how long it took to parse the file, or -1 if the file did not exist.
(For how to use groups, see the advanced topic VirtualVariable Groups)
This function loads the file at filePath and assigns the data it reads to "VirtualVariables".
Here is an example of a settings file:
Here is how it would work in a program:
ReadSettings maps variables it finds so that you can access them with the commands VirtualInteger, VirtualReal, VirtualString and VirtualBoolean
Integers are defined with an exclaimation mark, e.g. ! myint = 123
Strings are defined with a dollar symbol, e.g. $ mystr = abc
Reals with the tilde, e.g. ~ myreal = 1.234
Booleans with the question mark, e.g. ? mybool = TRUE
VirtualVariable names can be made up of the following characters: a-z, A-Z, underscore (_) and the digits 0-9 as long as the digits 0-9 aren't the first character of the name. E.g. cat, _cat, cat123 are ok, 123cat is invalid.
Simple - but there's lots more the ReadSettings function can do - you can also use maths and boolean logic in your settings files, Conditionals (if/endif), Macro Expressions and Parser Constants.
Here's an example of an advanced settings file (but most applications only need a simple one as shown earlier). This also shows off the Engine Modes advanced feature.
You might also like to see an another example using conditionals (if/else statements).
If you pass a MemFile to this function, it will use that instead of reading directly from a file. This makes the function faster.