All SFO-LUA functions

Description

Public Functions

add_dual_class_kit_option(kit:s, oldclass:s, oldkit:s, newclass:s)=() action (ui_dual_class_kits)

Enable dual-classing from kit 'oldkit' of old class 'oldclass', into kit 'kit' of class 'newclass'. Class entries should be IDS entries like 'FIGHTER'. Kit entries should be kitlist.2da rownames.

add_elem_spell_desc(elem_string:s, spell:s)=() action (ui_spell_system_elemental)

add_ini_func()=() patch (ui_set_ini_globals)

add_kit_menu(name:i, desc:i, title:i, trueclass_desc:i, name_strref:i, desc_strref:i, title_strref:i, trueclass_desc_strref:i, id:s, kits:s, class:s)=() action (ui_virtual_class)

This creates a kit-selection menu for a given class. All kits in the space-separated list 'kits' (identified by kitlist.2da rownames) for the class 'class' (identified by a class.ids entry) are grouped into their own menu. 'id' is some unique identifier for this menu (use a modder prefix).

'name', 'desc' and 'title' should be the numbers of entries in the currently-loaded tra file. 'name' is the name of the menu itself (displayed in place of a kit name on the parent class's kit menu). 'title' is the name for the submenu (replacing 'Choose Kit'). 'desc' is the description displayed when you click or mouse over the submenu on the main kit-selection screen.

For instance, if you want to gather several dragon disciple kits together, 'name' might be 'Dragon Disciple', 'desc' might be the general description for Dragon Disciples, and 'title' might be 'Choose Dragon' or similar.

add_pseudorace(NAME:s="-1", DESC:s="-1", REAL_RACE:s="-1")=() action (ui_add_subraces)

Add a single race to SFO's master table of pseudoraces. (This only updates the tables; the game itself is not updated.)

add_race(race:s, NAME:s, DESCSTR:s, UPPERCASE:s, BIOGRAPHY:s)=() action (ui_add_subraces)

Add a single race to SFO's master table of races. (This only updates the tables; the game itself is not updated.)

add_subrace(COLOR_SKIN:i="-1", COLOR_HAIR:i="-1", COLOR_MAJOR:i="-1", COLOR_MINOR:i="-1", STR:i, DEX:i, CON:i, INT:i, WIS:i, CHA:i, EXTRA_PROF:i, PP:i, OL:i, FT:i, MS:i, HS:i, DI:i, ST:i, subrace:s, NAME:s, DESC:s, PARENT:s, FINAL_RACE:s="*", ICON:s="-1", ICON_STRREF:s="-1", BIO_OLD:s="-1", BIO_NEW:s="-1", SPL_INIT:s, SPL_RECUR:s)=() action (ui_add_subraces)

Add a single subrace to SFO's master table of subraces. (This only updates the tables; the game itself is not updated.)

add_to_clab_level_1(clab:s, spell:s)=() dimorphic (ui_extra_spells)

Lightweight adder that just adds the spell to a CLAB file

add_to_subrace_tables(subrace_table:s, race_table:s, pseudorace_table:s, disabled:s, table_path:s)=() action (ui_add_subraces)

Take a bunch of tables defining race, subrace and pseudorace and add them to SFO's master tables. (This only updates the tables; the game itself is not updated.)

add_virtual_class(multiclass:b, name:i, desc:i, name_strref:i, desc_strref:i, ident:s, parent:s, human:s, dwarf:s, elf:s, gnome:s, halfling:s, half_elf:s, halforc:s, all_races:s="true")=() action (ui_virtual_class)

This adds a new virtual class to the class-selection menu (to the single-class bit unless multiclass is set to 1). You need to specify a unique string 'ident' to identify the class, and a real class ('parent', an entry in class.ids) as its parent.

You also need a name and description, specifiable either as a tra ref ('name', 'desc') or directly as a strref ('name_strref', 'desc_strref').

By default, the class will be available to all races. To restrict it, set 'all_races' to 'false' and then set each of 'human', 'dwarf' etc to 'true' if you want it available.

assign_bonus_spells(update_description:b=1, skip_clab:b, class:s, kit:s, spells:s, spell_array:s, tra:s="sfo_lua", tra_path:s="DEFAULT")=() action (ui_bonus_spells)

Given kit 'kit, and a space-separated list of spells 'spells' and/or a k=>_ array of spells 'spell_array', grant those spells as bonus learned spells at the appropriate level, making appropriate LUA and CLAB changes to do so.

Spells can be given as bare resrefs, or as spell.ids entries, or as dw_ext_spell.ids entries, or as abbreviated entries (i.e., with the 'WIZARD_' or 'CLERIC_' preamble stripped (if ambiguous, we assume WIZARD). Spells of the wrong type (i.e. cleric spells for wizards, or vice versa) are autoconverted to the appropriate type using the lib_splconv library.

Multiclass kits can be handled, but only if they're in SFO format and only on a full sfo install (we use lib_kit functionality). The parent class can normally be inferred; if you are adding bonus spells to a cleric/mage, you need to specify 'class' explicitly as cleric or mage.

The function will attempt to update the kit description (you can tell it not to by setting update_description=0). It needs to be given a tra file and a tra path; the defaults point to lua/lang and to sfo-lua's default tra file. (Look at that file for format if you want to do your own.) The same tra file is also passed to the splconv function to make any cleric->wizard and wizard->cleric conversion descriptions.

If you set skip_clab to 1, the new spells are added to the LUA and the kit description, but not to the CLAB. (This is useful if you're cloning an existing kit.)

assign_kit_to_virtual_class(kit:s, class:s)=() action (ui_virtual_class)

The kit 'kit' (a rowname from kitlist.2da) is added to the virtual class 'class' (the unique ID for the class, specified in add_virtual_class). The kit needs to be a legal kit for the parent class of the virtual class, and will now be displayed in the virtual class's kit menu rather than the real class's menu.

assign_spheres(update_scroll_usability:i=1, update_scrolls_later:i=1, update_description:i=1, class:s, kit:s, kit_clastext:s, spheres:s, default:s, add:s, subtract:s, block:s, base_tra:s=sfo_lua, base_tra_path:s="DEFAULT")=() action (ui_spell_system_spheres)

Allocate spheres to a given kit or class.

bonus_spells_from_list(skip_clab:b, update_description:i=1, kit:s, path:s, class:s)=() action (ui_bonus_spells)

Loads the file in 'path' (which should be a 2-column table - the first column is conventionally a level, but need not be). Go through the entries in the second column. Each is a |-separated list of spell ids entries (possibly including extended-namespace ids). Assign the first entry in each column that actually exists as an installed spell as a bonus spell to the kit 'kit'.

build_subraces(tlk_signal_start:i=900000, delay_mode:b)=() action (ui_add_subraces)

Operate on the subrace tables to actually construct the subraces if delay_mode=1, introduce a 1-second delay into the spells (for experimental HoW compatibility, though we haven't got this stable yet).

color_finder_tool()=() action (ui_add_portraits)

NOT FOR LIVE USE - alter the UI so that the CHARGEN color customization screen displays the numerical values of the chosen colors

define_spell_list(determine_empty_levels:b, empty_level_max:i=9, silent:b, spells:s, key:s, list_name:s, spell_array:s)=() action (ui_spell_system)

Given a space-separated list of spells 'spells', and/or an array spell=>_ or spell=>spell_level of spells, and a string 'key', construct a spell list 'key' comprising those spells. If you use the spell=>spell_level format, it saves looking up the levels of the spells).

Spells can be given either as resrefs or as IDS entries (if the latter, they need to have been loaded into memory using data_spell_resrefs). If a spell is missing, whine unless silent=1.

If determine_empty_levels=1, also record which levels are empty in the lua output. (empty_level_max is the highest level at which this is done - default is 9.)

Spell system is automatically set up if it isn't already.

detect_chargen_status()=() action (ui_shared_code)

Install the detect_chargen_status LUA functions in m_dw_shr.lua (these functions are used by other SFO functions (and elsewhere in ToF) to detect whether a given menu is being called as part of chargen)

disable_subrace(subrace:s)=() action (ui_add_subraces)

Disable the listed subrace (assumed to be installed) from the list of subraces offered to the player in character generation.

dual_class_kits()=() action (ui_dual_class_kits)

Do setup work, ready to install specific dual-class kits.

exclude_subrace(kit:s, subrace:s)=() action (ui_virtual_class)

This forces 'kit' (a rowname entry from kitlist.2da) to prohibit characters of subrace 'subrace' (an ID from the sfo-lua-generated table 'dw_subrace_ids.2da' in dw_shared).

extended_add_spell(force_extended:i, replace:i, id:s, file:s, path:s, location:s, locbase:s, exclude_alignment:s, exclude_kit:s, include_class:s)=(resref:s) action (ui_extra_spells)

extended_add_spell_helper(force_extended:i, level:i, type_num:i, type:s, id:s)=(resref:s, lua_line_needed:s) action (ui_extra_spells)

extended_spell_test()=() action (ui_extra_spells)

This just copies 10 spells of each level into the 51-55 and extended namespaces, for testing. It also makes the Doom copy (SPPR1A3) good-only

externalize_profsmax()=() action (ui_externalize_proficiencies)

This moves the functionality of profsmax.2da to the LUA, permitting control of maximum proficiencies at a finer grain than the engine permits (in particular, this is required for libraries like ui_add_subraces that use proficiencies to signal).

externalize_weapprof()=() action (ui_externalize_proficiencies)

This moves the functionality of weapprof.2da to the LUA, permitting control of allowed proficiencies at a finer grain than the core engine permits.

get_spell_array(list:s, root:s)=(this_array:a) action (ui_spell_system)

Given 'root' either SPPR or SPWI, and 'list' a list of spell-list keys, return an array of all spells with that root, in the format resref=>[01], with the value being 1 iff the spell is in one of the lists.

If list is 'cleric' or 'druid', instead parse the spell directly and check its usability fla

get_virtual_parent_classes()=(virtual_parent_classes:a) action (ui_virtual_class)

Parses m_dw_vcd.lua to extract an array of virtual classes, in the form $virtual_parent_class([virtual class id])=[id of first kit included in the class]

get_weapprof_path()=(weapprof_path:s) action (ui_externalize_proficiencies)

This returns either 'override/weapprof.2da' or '[data_loc_shared]/weapprof.2da', depending on whether the weapprof system has been externalized.

hide_ability_button_for_kit(kit:s, buttons:s)=() action (ui_hide_ability_button)

The kit 'kit' has the button(s) 'buttons' hidden by the UI. 'kit' is a rowname entry from kitlist.2da. 'Buttons' is a space-separated list of strings which appear as 'button' in enginest.2da entries of form STRREF_GUI_BUTTONS_[button].

hide_hla(resref:s)=() action (ui_externalize_hlas)

Given the resref of a HLA, that HLA is hidden (i.e., player-unselectable) for all players on the HLA screen. (Mostly used internally; in general it will be more sensible just to remove the HLA from the LU files.)

hide_proficiency(id:i)=() action (ui_externalize_proficiencies)

This hides the proficiency with id 'id' so that it is not displayed on the proficiency select screen.

hide_this_displayed_ability(string:s)=() action (ui_shared_code)

Mark a specific ability (or space-separated list of abilities) to be hidden on the character sheet. Abilities are identified by their enginst.2da ID.

ini_global_add(default:i, add_to_ini:i, type:s, id:s, global:s)=() dimorphic (ui_set_ini_globals)

ini_global_add_function(function:s)=() dimorphic (ui_set_ini_globals)

ini_global_setup()=() action (ui_set_ini_globals)

install_extended_spell_functions()=() action (ui_extra_spells)

Add the LUA functions and menu edits to enable extended spells. Most of this is now externalized to the onOpen and systemcall libraries.

make_elemental_spell_lists(adjust_description:i=1, tra:s=sfo_lua, tra_path:s="DEFAULT")=(earth_names:s, air_names:s, fire_names:s, water_names:s, all_names:s) action (ui_spell_system_elemental)

Create LUA spell lists for each element.

make_extended_spell_line(add_to_clab:i, resref:s, include_class:s, exclude_kit:s, exclude_alignment:s)=(line:s, no_align_restrictions:s, lua_array:s, class_bar:a, kit_bar:a, align_bar:a) patch (ui_extra_spells)

make_force_spell_lists()=() action (ui_spell_system_elemental)

Create LUA lists of all force spells.

no_int_max_spells()=() action (ui_spell_system)

override_chargen_kit_name(override:i, use_tra:b=1, kit:s, class:s, lua:s="m_dw_vcd")=() action (ui_virtual_class)

This function overrides the name displayed on the character-generation selection screen (but not on the character sheet) for a specific kit, which is specified both by 'kit' (a rowname entry from kitlist.2da) and 'class' (an entry in class.ids).

The integer 'override' specifies the new name. By default it's an entry drawn from the current tra file. If use_tra is set to 0, it's instead a strref.

'lua' lists where the override instruction is stored. (Don't change this off the default unless you know what you're doing and have a very good reason.)

override_class_kit_menu(virtual:b, title_tra:i="-1", class:s, title:s)=() action (ui_virtual_class)

This changes the title of a kit-selection menu in character generation. 'Class' should be an entry from class.ids, or the ID of a virtual class (in the latter case, you need to set virtual=1). You can set the title either directly as a string ('title') or indirectly as the tra number of a line in the current tra file ('title_tra').

override_class_kit_menu_setup()=() action (ui_virtual_class)

override_hla_description(strref:i, resref:s)=() action (ui_externalize_hlas)

This replaces the description shown on the HLA select screen for HLA 'resref' with the strref 'strref'. It requires ui_externalize_hlas to have been run.

override_hla_name(strref:i, resref:s)=() action (ui_externalize_hlas)

This replaces the name shown on the HLA select screen for HLA 'resref' with the strref 'strref'. It requires ui_externalize_hlas to have been run.

override_kit_desc_data(old_1_strref:i, new_1_strref:i, old_2_strref:i, new_2_strref:i, old_3_strref:i, new_3_strref:i, kit:s, swap:s, old_1:s, new_1:s, old_2:s, new_2:s, old_3:s, new_3:s)=() action (ui_virtual_class)

This function overrides the displayed class names on a character's character sheet. Its main use is for multiclass kits, so that the names of the kit components show up instead of the class components. The 'kit' variable (which should be a kitlist 2da rowname) specifies the kit for which the override should be applied.

You can specify the override in several ways. The simplest (which is usually sufficient) is to set 'swap' to a list of class=>kit swaps, e.g. swap="fighter=>kensai thief=>assasin". Here 'class' should be a class.ids entry, and 'kit' should be a kitlist.2da rowname. You can also directly specify strings to be swapped out and in, either by strref (old_[123]_strref is swapped for new_[123]_strref) or directly by string (old_[123] is swapped for new_[123]).

parse_spell_lists(allow_learn:s, block_learn:s, allow_priest:s, block_priest:s, type:s="priest")=(spell_array:a) action (ui_spell_system)

Given the 'allow_learn', 'block_learn', 'allow_priest', 'block_priest' values for some (actual or fictional) kit, and its type (either 'priest' or 'mage') return an array of all usable spells, in the format resref=>1

process_extended_spells()=() action (ui_extra_spells)

Get the extended-namespace spells into lua and into auto-grant spells.

process_favored_enemy_ini(file:s, location:s, locbase:s, path:s)=() action (ui_ranger_favored_enemy)

Process an ini file identifying various ranger favored enemies, in SFO's format. The format is a series of blocks like:
[SKELETAL_UNDEAD]
race=LICH,DEMILICH
primary_race=SKELETON
name=3
desc=4

Here: SKELETAL_UNDEAD is an internal identifier. 'primary_race' is the race that actually gets set as a favored enemy in the game engine. 'race' is a comma-separated list of other races that SFO fakes up as additional favored enemies. 'name' and 'desc' are TRA references to the name and description of the favored enemy as shown on the selection screen.

process_scroll_usability_now()=() action (ui_spell_system)

rechoose_ranger_favored_enemy(levels:s)=() action (ui_ranger_favored_enemy)

Given a space-separated list of numbers, allow rangers to rechoose their favored enemy at every level in the list.

remove_erase_bg()=() patch (ui_spell_system)

remove_erase_iwd()=() patch (ui_spell_system)

require_gender(kit:s, gender:[male|female])=() action (ui_virtual_class)

This forces 'kit' (a rowname entry from kitlist.2da) to require the character to be male or to be female, according to what 'gender' is set to.

scroll_spec_bonus_setup()=() action (ui_spell_system)

Build the various resources needed for the externalized bonus-spell setup.

set_basic_hla_progression(min:i, step:i)=() action (ui_externalize_hlas)

This function sets the HLA progression (prior to crossing the threshold for 'genuine' HLAs, i.e. 3M XP in BG2, so that you start getting them at level min and then get another one every step levels.

set_dual_class_kit_components_for_proficiencies(kit:s, components:s)=() action (ui_externalize_proficiencies)

I don't 100% recall what this does. It's described in my notes like this: 'set the single-class kits that override multiclass kit proficiencies for dc purposes'.

set_kit_display_priority(priority:i, kit:s)=() action (ui_virtual_class)

This assigns an integer 'priority' to the kit 'kit' (specified by a kitlist.2da rowname). This determines the order in which the kits are displayed at character selection: kits are displayed in increasing order of order priority, with kits that have no order priority displayed last and kits displayed in alphabetical order within each priority.

set_signalling_stat(stat:i)=() action (ui_externalize_proficiencies)

This sets up the stat 'stat' to be used by other UI libraries to send a signal from the chargen screen to the main game. Don't use unless you're confident you know what you're doing.

set_signalling_stat_helper(stat:i)=() patch (ui_externalize_proficiencies)

set_specialist_spells(number_required:i=1, list_spells:b=1, update_description:b, learn_more_line:s, memorize_more_line:s, old_line:s, new_line_1:s, new_line_2:s, string_school:s, string_school2:s, kit:s, spell_list:s, tra:s="sfo_lua", tra_path:s)=() action (ui_spell_system)

Given a kit 'kit' (a rowname entry in kitlist.2da), an optional integer 'number_required' (default=1) and a space-separated list of spell-list keys 'spell_list', require that kit to learn at least number_required spells from that list.

The optional 'learn_more_line' and 'memorize_more_line' are displayed to players in character generation if they don't learn/memorize an appropriate number of speciality spells. (If not set, the component autogenerates a default warning.)

The variables 'tra' and 'tra_path' specify where some standard strings are drawn from (the default assumption is that they're from sfo/lua/lang//sfo_lua.tra").

If update_description is set to 1, the function will attempt to update the kit description. (This only works with kits in a relatively standard format.) The various other variables control how this works:

  • 'old_line' is by default 'May cast one additional spell per level.', but it can be any 'advantage' or 'disadvantage' line from the kit description. It is deleted from the kit description if present.
  • 'school_string' is by default 'from the LISTNAME school', where LISTNAME is the name-string of the specialist list, or the last such list if there is more than one.
  • 'new_line_1' is by default 'May cast one additional spell per level. This additional spell must be SCHOOL_PLACEHOLDER'; SCHOOL_PLACEHOLDER is swapped for 'string_school'. It is added to the top of the 'Advantages' list if number_required=1.
  • 'new_line_2' is by default 'May cast one additional spell per level. At least NUMBER_PLACEHOLDER memorized spells of each level must be SCHOOL_PLACEHOLDER'; SCHOOL_PLACEHOLDER is swapped for 'string_school' and NUMBER_PLACEHOLDER is swapped for the value of 'number_required'. It is added to the top of the 'Advantages' list if number_required>1.
  • list_spells, if set, includes a list of all spells from the preferred list. In this case, 'string_school2' (default value: the name-string of the specialist list, or the last such list if there is more than one) is substituted into the string 'The full list of SCHOOL_PLACEHOLDER_2 spells is:'.

set_spell_learn_modifiers(kit:s, modifiers:s)=() action (ui_spell_system)

Set the externalized modifications to the chance of learning a spell. Specify 'kit' (a rowname from kitlist) and 'modifiers' (the actual LUA list of modifiers). 'modifiers' should be a comma-separated list with elements of form 'list=integer', where 'list' is either a spell list or 'default' (applies to all spell lists not called out.)

set_spell_list(chargen_choose_spells:b, update_scroll_usability:b=1, update_scrolls_later:b, silent:b, import_parent_blocks:b=1, class:s, kit:s, kit_clastext:s, block_learn:s="no_change", allow_learn:s="no_change", block_priest:s="no_change", allow_priest:s="no_change")=() action (ui_spell_system)

Set the spell lists available to, or blocked for, a given class or kit (either set class to a class.ids entry, or kit to a kitlist.2da rowname). Each of block_learn, allow_learn, block_priest, or allow_priest can be a space-separated or comma-separated list of spell-list keys, or 'no_change' (the default) in which case whatever it's currently set to will be unchanged.

If chargen_choose_spells=1, the lua also sets dwChargenChooseSpells to 1 for that class or kit. That causes the UI to try to learn spells from the character's specialist list, if any. [This is an odd place to put this, on reflection.]

If update_scroll_usability=1, we also go through all scrolls and mark them up as usable/unusable for that class/kit.

If the spell system is not already set up, we set it up.

set_up_externalized_proficiencies()=() action (ui_externalize_proficiencies)

This function is a general setup for the ui_externalize_proficiency functions.

shared_color_changes()=() action (ui_shared_code)

Installs the LUA function 'dwUpdateColors' into m_dw_shr.lua (this function is used to force the starting colors during CHARGEN, e.g. for subrace or portrait-match purposes)

spell_system_extension_setup()=() action (ui_extra_spells)

spl_basic_ability_localcopy()=() patch (ui_extra_spells)

systemcall_patch()=() patch (ui_system_call)

ui_add_portraits(force_cd:i, portrait_path:s, portrait_table:s, disable:s, enable:s)=() action (ui_add_portraits)

Add some new portraits into the system, or modify existing ones (EE only)

The portraits should be listed in a 2DA table of form
skin hair major minor race sex class disabled
EXAMPLE INT INT INT INT human f fighter no
(any of these columns can be missing, in which case defaults are assumed.) The function generates a master table of this form which lives in the 'shared' subdirectory of weidu_external (specifically, at weidu_external/data/shared/dw_portraits.2da)

  • 'skin', 'hair', 'major' and 'minor' are the colors - as used by the UI - that should be assigned by default if the portrait is selected. (You can edit these
  • 'race' can be any of human, halfelf, elf, dwarf, halfling, gnome, halforc, special (the default).
  • 'class' can be fighter, wizard, cleric, thief, bard, barbarian, special (the default).
  • 'sex' can be f, m, fm (the default).
  • 'disabled' can be yes or no (the default).

The bmps themselves should be named as follows:

  • EXAMPLEhires.bmp (for large high-resolution portraits) - copied to the L slot
  • EXAMPLE330.bmp - also copied to the L slot
  • EXAMPLEL.bmp - copied direct to the L slot
  • EXAMPLE269.bmp - copied to the M slot
  • EXAMPLEM.bmp - copied to the M slot

The function takes these variables:

  • portrait_table: the full path to a new table, of the above form, to be added
  • portrait_path: the path to the directory containing any new portrait BMPs listed in the table (or, if no table is given, containing any
  • portrait BMPs just to be copied over directly - mostly applies to the core IWD/BG/BG2 portraits)
  • disable: a list, separated by spaces, of portrait base names to disable from the system
  • enable: a list, separated by spaces, of portrait base names to enable in the systems

On a non-EE install we default to CamDawg's cd_portrait_copy (which is assumed as a dependency); you can force this even on EE by setting INT_VAR force_cd=1.

ui_copy_spell_lists(from:s, to:s)=() action (ui_spell_system)

Read in the spell lists associated with a given kit, and copy it to a different kit

ui_deolvynize()=(value:s) action (ui_deolvynize)

This attempts to reverse the effect of OlvynChuru's ClassSpellTool function on menu.ui and to move all spells added by ClassSpellTools to the SFO-lua system. It's not been extensively tested in the wild.

Idempotent (you can run it as many times as you like).

ui_detect_class_kit(version:s)=() action (ui_detect_class_kit)

Set up all the resources to detect the class and kit (etc). Note that unlike other SFO-lua libraries, this one just reinstalls itself every time you build it (since new classes and kits may have been added). 'Version', if set to 1, is used for debugging.

ui_dualclass_specialist_bonus_spells()=() action (ui_dual_class_kits)

ui_externalize_hlas(min:i, step:i, activate_feats:i=1)=() action (ui_externalize_hlas)

This (idempotent) function sets up the HLA system to grant HLAs every few levels (starting with level min, and then after every step levels) and to externalize requirements for various HLAs. In doing so it sets up an HLA menu if (as in IWD or BG) none is active; it also removes the icon column from the BG2 HLA menu, since that requires multiple icons for applied powers that aren't really needed and which push the art requirements.

If activate_feats=0, the low-level feats are not enabled (only the other externalizations are enabled).

ui_externalize_usability_descriptions(strref:i="-1", kit:s, item:s, item_array:s="sfo_reserved_usability_array")=() dimorphic (ui_externalize_usability_descriptions)

ui_externalize_usability_descriptions_setup()=() action (ui_externalize_usability_descriptions)

ui_inn_label()=() action (ui_inn_label)

After running this function, once you stay in an inn the room type (from 1 to 4, with - iirc - 1 as worst) is stored in the global variable dw_inn_roomtype. It gets reset once you rest again, so pick it up and change it to zero quickly if you want to interact with it.

ui_on_open_setup()=() action (ui_on_open)

Sets up the ui_on_open library's systematic hijacking of ui.menu's onOpen command. This function is called automatically by other sfo-lua libraries: it is highly unlikely that any mod will need to call it directly.

ui_read_all_spell_lists()=(block_learn:a, block_priest:a, allow_learn:a, allow_priest:a, list_names:a, kit_names:a) dimorphic (ui_spell_system)

Read in all the spell lists, and store them in arrays block_learn, block_priest, allow_learn, allow_priest, in this format: $allow_priest(OHTEMPUS combat)=1. Also return a k=>_ array of all list names, and a k=> array of all kit names.

ui_read_spell_lists(literal:b, kit:s)=(learn:s, priest:s, block_learn:s, block_priest:s) action (ui_spell_system)

Read in the spell lists associated with a given kit. If literal=1, leave in the commas and quote marks; otherwise remove them.

ui_spell_system_schools(force_rebuild:b, tra:s=sfo_lua, tra_path:s="DEFAULT")=() action (ui_spell_system_schools)

Sets up the spell system to include all the schools of magic as defined spell lists.

ui_spell_system_setup()=() action (ui_spell_system)

Set up the externalized spell system. (Idempotent.)

ui_spell_system_spheres(path:s="sphere", list:s="sphere_list.2da", tra:s="sphere", tra_path:s="MOD_FOLDER/lang", base_tra:s=sfo_lua, base_tra_path:s="DEFAULT", 3p_folder:s=dw_tof3p)=() action (ui_spell_system_spheres)

Sets up a sphere system. See ToF for format; by default we read a 2da of spheres at sphere/sphere_list.2da, and then look for text files listing the various spells in each sphere in 'sphere'.

ui_stress_test()=() action (ui_shared_code)

Run a bunch of SFO-LUA's core UI edits and report when each is installed. For use in testing SFO-LUA on different UI mods.

ui_subrace_item_use()=() action (ui_add_subraces)

Goes through all items in the game to make sure that they're appropriately marked as unusable by new races. We assume that the new race can use something iff humans can (except that if only humans are prohibited from using it, we assume new races can use it). This is idempotent but not called automatically.

ui_system_call_setup()=() action (ui_system_call)

Set up the system-call system, making appropriate menu edits and collecting data for lua libraries.

virtual_class_setup()=() action (ui_virtual_class)

Set up the various lua files and menu edits for virtual classes