# lib_script function library

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

## Description

Functions related to BCS scripts. (See also the family of functions in alter_script.tph).

## Public functions

script_custom_hotkeys()=() patch

On the current file (assumed to be a BAF file) swap any hotkey commands with user-set hotkey remaps, as set in the ini.

script_difficulty_ini()=() patch

On the current file (assumed to be a BAF file) swap difficulty GLOBAL checks for INI checks, but only if m_dw_did.lua is present.

script_ee_to_vanilla()=() patch

On the current file (assumed to be a BAF file) replace EE-only script commands with more-or-less-adequate oBG2 alternatives. If ToBEX is installed, replace CheckSpellState with CheckStat; if it isn't, replace it with False(). Do nothing if we're on EE.

script_install(silent:i, arguments:s, script:s, scripts:s, location:s, locbase:s, path:s)=() action

Given a list 'arguments' (syonyms: 'script', 'scripts') of script names (without .baf suffix), located at the location given by location/locbase/path, compile them into the override, first applying script_ee_to_vanilla if we're on a non-EE game. If a script is missing, whine unless silent=1.

If instead input is a list of k=>v pairs, compile k.baf to v.bcs (we don't check variables in this case).

If the script name is a set variable, compile it to the value of that variable, e.g. if script_for_wyrms is set to dw#wyrm1, compile script_for_wyrms.baf to dw#wyrm1.bcs.