# lib_sfo function library

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

## Description

## Public functions

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:b=1, new:b, 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. If new=1, wipe any existing contents

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
- remove + from missile.ids
- on BGEE, add some spell.ids entries missing that are present on SoD
- on EE, fix a couple of UI errors

sfo_load(library:s)=() action

Given a list of space-separated sfo library functions, load those functions and (recursively) any libraries they depend on.

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 'locbase' is set, use 'MOD_FOLDER/locbase/location'
  - if not, and the 'component_loc' variable is set, use 'MOD_FOLDER/%component_loc%/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_warnings.txt, prepended with the component number and mod name. If repeat=0, only do this if it's not already there.