lib_sfo function library

Dependencies: lib_2da, lib_anon, lib_array, lib_fn, lib_ini, lib_struct, lib_sugar, lib_tools

Description

Functions

check_ini(silent:i, ini:s, arguments:s)=(value:s) dimorphic

Return a value from the mod's ini (which needs to have previously been read in, as a flat ini, into SFO_reserved_ini_hash). If the ini doesn't contain that value, whine unless silent=1. ini and arguments are synonyms.

check_label(label:s, prefix:s)=(value:s) dimorphic

Check for a marker file, which can be set by make_label.

Do not use make_label or check_label in your base tp2 to decide whether to install a component, as they are invisible to Project Infinity and the like.

log_this(repeat:i=1, file:s, input:s, arguments:s, path:s="weidu_external/data/MOD_FOLDER", location:s, locbase:s)=() dimorphic

Dump the string 'input' (synonym:'arguments') into the text file 'file' (by default placed in the weidu_external/data/MOD_FOLDER directory, but you can override), creating it if necessary.

If repeat=0, only do this if it's not already there.

make_label(label:s)=() dimorphic

Set a marker file, which can be checked by check_label.

Do not use make_label or check_label in your base tp2 to decide whether to install a component, as they are invisible to Project Infinity and the like.

regexp_warning(file:s, parent:s="")=() dimorphic

Special case of 'warning' used specifically as a soft-fail for regexps.

sfo_batch_set action_macro

sfo_batch_update()=() action

sfo_crossplatform action_macro

Load appropriate values of the various variables for different versions of BG.

sfo_fix()=() action

A few basic fixes:

  • make sure dir.ids is present and working
  • add some possibly-missing entries to gtimes.ids and spell.ids

sfo_handle_charsets(from_utf8:b, sfo_tra_path:s, sfo_lang_path:s="weidu_external/lang/MOD_FOLDER")=(sfo_tra_loc:s, scs_tra_loc:s) action

SFO wrapper for HANDLE_CHARSETS.

sfo_path(path:s, location:s, locbase:s, file:s)=(file_path:s, path:s) dimorphic

Given some or all of 'file', 'path', 'location' and 'locbase', return a full filespec file_path (e.g. MOD_FOLDER/lib/lib_soundset.tph) and the path bit (e.g. "MOD_FOLDER/lib).

Determined as follows:

  • if 'path' is set, just use it.
  • if not, and 'location' is set:
    • if the 'component_loc' variable is set, use 'MOD_FOLDER/component_loc/location'
    • if not, and 'locbase is set, use 'MOD_FOLDER/locbase/location'
    • otherwise, use 'MOD_FOLDER/location'
  • if not, and 'locbase' is set, use 'MOD_FOLDER/locbase'
  • otherwise, just use ""

    sfo_setup action_macro

    Set up the SFO directories and variables.

    warning(repeat:i, warning:s, arguments:s)=() dimorphic

    Dump the string 'warning' (synonym: 'arguments') into data_loc/sfo_warning.txt, prepended with the component number and mod name. If repeat=0, only do this if it's not already there.