Skip to content

O1. Syntax

Murren edited this page Oct 11, 2023 · 1 revision

Syntax

Syntax is the set of symbols and words with their coupled functions that make up a computer language. .ini syntax is structured in sections containing pairs. In GIMI-.ini syntax (from here on Gimi-Ini-Syntax, GIS) five different types of lines exist:

Sections
[ExampleSection]
Sections are identified with square brackets encapsulating their name. A section begins under its declaration, and ends at the declaration of the next section (or the end of the file). They can be seen as 'categories' or 'groups' of pairs. All other types need to be in sections; they cannot exist outside of a section.

Parameters
exampleparameter = value
Parameters are pairs of reserved words being set to a value. GIS has specific words reserved that are compiled in a specific way. They are the main communication between the .ini file and the mod loader.

Variables
$active = 5
Variables are fields that store information, similar to variables in coding. You can use them to remember a number, that you can use later to for example differentiate files or enable or disable the mod. They need to always be marked with $, to differentiate them from parameters. More about them is explained in the Variables chapter.

Comments
; ExampleComment
Comments are lines starting with a semicolon, indicating they should not be read; They will be ignored when compiled, and can be used to explain something in your file, or for example to create horizontal lines to easily organize the sections. Note that comments have to have their own line! They cannot follow after something else on the same line.

Conditions
if $example == 5
     $this = $that
else if $example > 5
     $that = $this
else
     $example = $example + 1
endif
Conditions are lines that can be used to do logic, which can only be used in CommandList sections. There are four keywords:

if <condition> checks if the condition is true. If so, it continues to what's inside the if-statement, then skips to the end of the if-statement; otherwise it continues to the first line after it.

else if <condition does the same as a normal if-statement, but can only come after a normal if-statement. If the first if-statement is true, then it behaves like normal but skips over any else-ifs and elses after it.

else is basically the 'alternative'; It can only come after an if statement, and only runs if the if-statement was false.

endif closes the if-statement. Indentation is ignored during compilation; You have to end your if statements to avoid errors.

The example statement would check if the $example variable is equal to 5; if so, it sets the variable $this to the value of $that. If not, it checks if $example is bigger than 5; if so, it sets $that to $this. If not, this means both if statements were false and it increments $example with 1. Then the if statement is closed, and it continues to whatever follows.

Clone this wiki locally