INI settings

Functions


get_ini_config

sfall.h

array get_ini_config(string file)

Loads a given INI file and returns a permanent array (map) where keys are section names and values are permanent sub-arrays (maps) where keys and values are strings.

  • Searches the file in the regular file system, like with all other ini-related functions.
  • Subsequent calls for the same file will return the same array, unless it was disposed using free_array.

get_ini_config_db

sfall.h

array get_ini_config_db(string file)

Works exactly like get_ini_config, except it searches the file in database (DAT) files. If not found, then it will try the regular file system.


get_ini_section

sfall.h

array get_ini_section(string file, string sect)

Returns an associative array of keys and values for a given INI file and section.

  • If the INI file is not found, it returns an empty array.
  • NOTE: all keys and their values will be of String type.

get_ini_sections

sfall.h

array get_ini_sections(string file)

Returns an array of names of all sections in a given INI file.

  • If the INI file is not found, it returns an empty array.

get_ini_setting

int get_ini_setting(string setting)

Reads an integer value from an ini file in the Fallout directory.

  • It only takes a single argument; seperate the file name, section and key with a “|” character; e.g. myvar:=get_ini_setting("myini.ini|mysec|var1")
  • If the file or key cannot be found or the setting argument is in an invalid format, it returns -1.
  • The file name is limited to 63 chars, including the extension.
  • The section name is limited to 32 characters.
  • It can also be used to get sfall settings by using ddraw.ini as the file name.

get_ini_string

string get_ini_string(string setting)

Reads a string value from an ini file in the Fallout directory.

  • If the file or key cannot be found, it returns an empty string.
  • If the setting argument is in an invalid format, it returns -1 (integer).

modified_ini

int modified_ini

Returns the value of ModifiedIni setting in [Main] section of the INI.


set_ini_setting

sfall.h

void set_ini_setting(string setting, int/string value)

Writes an integer or a string value to an ini file in the Fallout directory. If the ini file does not exist, it will be created The setting argument works in the same way as in get_ini_setting, seperate the file name, section and key with a “|” character. Note: the file name is limited to 63 chars (including the extension), the section name is limited to 32 characters.