Read Ini File Icon Read Ini File

With this action you can read a piece of data from an Ini file. You must previously have opened the Ini file for reading/writing using the action Open Ini File, and then with this action you give the type of data to read (either a real number or a string enclosed in ""), as well as the section header and the key within that section to get the data from. You can also supply a default value which can be either a real number of a string, and the type should coincide with the "Type" set in the action. This default action will be returned by the action should any of the following occur:

Under any of the above circumstances, you will get the default value returned rather than a value from the Ini file. Whatever value is returned will be stored in the target variable that you specify, which can also be created at that moment if flagged as a temporary local variable.

IMPORTANT! trying to read data from an Ini file that has not been opened previously using the Open Ini File action will cause a serious error and crash your game.

 

Action Syntax:

Read Ini File Action

Arguments:

ArgumentDescription
TypeThe type of data to read, either a string (enclosed in quotes ""), or a real number
SectionThe section of the Ini file to read from (as a string)
KeyThe key within the section to read from (as a string)
DefaultThe default value to return should either the file, section or key not exist
TargetThe target variable for holding the return value from the action

 

Example:

Read Ini File ExampleThe above action block code will open an Ini file for reading then use data read from it to set 3 different global variables before closing the file again.