From 1788096ae745ca384a651da5d6c3dcf814877a6f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 3 Jan 2026 12:58:54 +0000 Subject: [PATCH] deploy: c44fe84cc4a7f79be5d702209bbef20964f632ca --- 404.html | 2 +- alter-min-max/index.html | 4 ++-- animations/index.html | 4 ++-- array-functions/index.html | 4 ++-- arrays/index.html | 4 ++-- art-and-appearance/index.html | 4 ++-- audio/index.html | 4 ++-- best-practices/index.html | 4 ++-- call_offset_vx/index.html | 4 ++-- car/index.html | 4 ++-- combat/index.html | 4 ++-- cursor/index.html | 4 ++-- data-types/index.html | 2 +- direct-memory-access/index.html | 2 +- explosions/index.html | 4 ++-- feed.xml | 2 +- funcx/index.html | 4 ++-- global-script-functions/index.html | 4 ++-- global-scripts/index.html | 2 +- global-variables/index.html | 4 ++-- graphics/index.html | 4 ++-- hook-functions/index.html | 4 ++-- hook-types/index.html | 4 ++-- hooks/index.html | 4 ++-- index.html | 2 +- ini-settings/index.html | 4 ++-- interface/index.html | 2 +- inventory/index.html | 4 ++-- keyboard-and-mouse/index.html | 4 ++-- knockback/index.html | 4 ++-- lists/index.html | 4 ++-- locks/index.html | 4 ++-- main-interface/index.html | 4 ++-- maps-and-encounters/index.html | 4 ++-- math/index.html | 4 ++-- npc-perks/index.html | 4 ++-- objects-and-scripts/index.html | 4 ++-- optimization/index.html | 4 ++-- other/index.html | 4 ++-- outline/index.html | 4 ++-- perks-and-traits/index.html | 4 ++-- pip-boy/index.html | 4 ++-- read_xxx/index.html | 4 ++-- rest/index.html | 4 ++-- sfall-funcx-macros/index.html | 4 ++-- sfall/index.html | 2 +- skills/index.html | 4 ++-- sslc/index.html | 4 ++-- stats/index.html | 4 ++-- strings/index.html | 4 ++-- tags/index.html | 4 ++-- tiles-and-paths/index.html | 4 ++-- utility/index.html | 4 ++-- version/index.html | 4 ++-- virtual-file-system/index.html | 4 ++-- weapons-and-ammo/index.html | 4 ++-- windows-and-images/index.html | 4 ++-- worldmap/index.html | 4 ++-- write_xxx/index.html | 4 ++-- 59 files changed, 110 insertions(+), 110 deletions(-) diff --git a/404.html b/404.html index 4e3e4800..6d24a3b0 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ - sfall | Sfall documentation Skip to main content Link Menu Expand (external link) Document Search Copy Copied

404

Page not found :(

The requested page could not be found.


This site uses Just the Docs, a documentation theme for Jekyll.
+ sfall | Sfall documentation Skip to main content Link Menu Expand (external link) Document Search Copy Copied

404

Page not found :(

The requested page could not be found.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/alter-min-max/index.html b/alter-min-max/index.html index 3e9177c8..72b0eea2 100644 --- a/alter-min-max/index.html +++ b/alter-min-max/index.html @@ -1,7 +1,7 @@ - Alter min/max | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Alter min/max

The set_stat_max/min functions can be used to set the valid ranges on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only affects the player, the set_npc_ functions only affects other critters, and the set_ functions affects both.

Functions


set_npc_stat_max

void set_npc_stat_max(int stat, int value)
+             Alter min/max | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Alter min/max

The set_stat_max/min functions can be used to set the valid ranges on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only affects the player, the set_npc_ functions only affects other critters, and the set_ functions affects both.

Functions


set_npc_stat_max

void set_npc_stat_max(int stat, int value)
 

set_npc_stat_min

void set_npc_stat_min(int stat, int value)
 

set_pc_stat_max

void set_pc_stat_max(int stat, int value)
 

set_pc_stat_min

void set_pc_stat_min(int stat, int value)
 

set_stat_max

void set_stat_max(int stat, int value)
 

set_stat_min

void set_stat_min(int stat, int value)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/animations/index.html b/animations/index.html index a503a415..2f5dac9b 100644 --- a/animations/index.html +++ b/animations/index.html @@ -1,4 +1,4 @@ - Animations | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Animations

Functions


reg_anim_animate_and_hide

void reg_anim_animate_and_hide(ObjectPtr, int animID, int delay)
+             Animations | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Animations

Functions


reg_anim_animate_and_hide

void reg_anim_animate_and_hide(ObjectPtr, int animID, int delay)
 

Works exactly like reg_anim_animate but the object will automatically disappear after the last animation frame (but not destroyed).

  • delay: delay from the previous animation. A value of -1 will execute the specified animation immediately after the previous one in the sequence ends.

reg_anim_animate_and_move

sfall.h

void reg_anim_animate_and_move(ObjectPtr, int tile, int animID, int delay)
 

Plays the specified animation while simultaneously moving the object to the given tile.

  • delay: delay from the previous animation. A value of -1 will execute the specified animation immediately after the previous one in the sequence ends.

reg_anim_callback

void reg_anim_callback(procedure proc)
 

Adds the given procedure to an animation sequence-list and executes it in the registered sequence.


reg_anim_change_fid

void reg_anim_change_fid(ObjectPtr, int FID, int delay)
@@ -7,4 +7,4 @@
 

Given object is destroyed at the end of current animation set.


reg_anim_light

void reg_anim_light(ObjectPtr, int light, int delay)
 

Change light of any object. Light argument is a light radius (0-8), but you can use highest 2 bytes to pass light intensity as well (example: 0xFFFF0008 - intensity 65535 and radius 8). If highest 2 bytes are 0, intensity will not be changed. Intensity range is from 0 to 65535 (0xFFFF)


reg_anim_take_out

void reg_anim_take_out(ObjectPtr, holdFrameID, delay)
 

Plays “take out weapon” animation for given holdFrameID. It is not required to have such weapon in critter’s inventory.


reg_anim_turn_towards

void reg_anim_turn_towards(ObjectPtr, int tile/target, delay)
-

Makes object change its direction to face given tile number or target object.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Makes object change its direction to face given tile number or target object.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/array-functions/index.html b/array-functions/index.html index f0d93636..06ff9e2e 100644 --- a/array-functions/index.html +++ b/array-functions/index.html @@ -1,4 +1,4 @@ - Array functions | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Array functions

Functions


array_key

mixed array_key(int arrayID, int index)
+             Array functions | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Array functions

Functions


array_key

mixed array_key(int arrayID, int index)
 

Don’t use it directly; it is generated by the compiler in foreach loops.

  • for lists, returns index back (no change).
  • for maps, returns a key at the specified numeric index (don’t rely on the order in which keys are stored though).
  • can be checked if given array is associative or not, by using index (-1): 0 - array is list, 1 - array is map.

arrayexpr

int arrayexpr(mixed key, mixed value)
 

Don’t use it directly; it is used by compiler to create array expressions.

  • assigns value to a given key in an array, created by last create_array or temp_array call.
  • always returns 0.

create_array

int create_array(int size, int nothing)
 

Creates permanent array (but not “saved”).

  • if size >= 0, creates list with given size.
  • if size == -1, creates map (associative array).
  • if size == -1 and flags == 2, creates a “lookup” map (associative array) in which the values of existing keys are read-only and can’t be updated. This type of array allows you to store a zero (0) key value.
  • returns array ID (valid until array is deleted).

fix_array

void fix_array(int arrayID)
@@ -11,4 +11,4 @@
 

Makes the array saveable; it will be saved in sfallgv.sav file when saving the game.

  • array ID is associated with given “key”.
  • array becomes permanent (if it was temporary) and “saved”.
  • key can be of any type (int, float or string).
  • if you specify 0 as the key for the array ID, it will make the array “unsaved”.

scan_array

mixed scan_array(int arrayID, mixed value)
 

Searches for a first occurence of given value inside given array.

  • if value is found, returns its index (for lists) or key (for maps).
  • if value is not found, returns -1 (be careful, as -1 can be a valid key for a map).

set_array

void set_array(int arrayID, mixed key, mixed value)
 

Sets array value (shorthand: arrayID[key] := value).

  • if used on list, “key” must be numeric and within valid index range (0..size-1)
  • if used on map, key can be of any type
  • to “unset” a value from map, just set it to zero (0)
    • NOTE: to add a value of 0 for the key, use the float value of 0.0

temp_array

int temp_array(int size, int nothing)
-

Works exactly like create_array, only created array becomes “temporary”.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Works exactly like create_array, only created array becomes “temporary”.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/arrays/index.html b/arrays/index.html index ae572a74..758f86be 100644 --- a/arrays/index.html +++ b/arrays/index.html @@ -1,4 +1,4 @@ - Arrays | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Arrays

sfall introduces new method of storing variables - arrays.

Array is basically a container which can store variable number of values (elements). Each element in array can be of any type. Arrays can be extremely useful for some more advanced scripting, in conjunction with loops. See array function reference here.

Arrays concept

Array elements are accessed by index or key. For example:

// this code puts some string in array "list" at index 5:
+             Arrays | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Arrays

sfall introduces new method of storing variables - arrays.

Array is basically a container which can store variable number of values (elements). Each element in array can be of any type. Arrays can be extremely useful for some more advanced scripting, in conjunction with loops. See array function reference here.

Arrays concept

Array elements are accessed by index or key. For example:

// this code puts some string in array "list" at index 5:
 list[5] := "Value";
 

There are 2 different types of arrays currently available:

  • Lists - a set of values with specific size (number of elements), where all elements have numeric indexes starting from zero (0) up to array length minus one.

    For example:

    // this creates list with 3 elements. Element "A" has index 0, element "B" has index 1, element "C" - 2
     list := ["A", "B", "C"];
    @@ -64,4 +64,4 @@
             // kaboom!!!
         end
     end
    -

    Array operators reference

    *mixed means any type

    • int create_array(int size, int flags):
      • creates permanent array (but not “saved”)
      • if size >= 0, creates list with given size
      • if size == -1, creates map (associative array)
      • if size == -1 and flags == 2, creates a “lookup” map (associative array) in which the values of existing keys are read-only and can’t be updated. This type of array allows you to store a zero (0) key value
        • NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
      • returns arrayID (valid until array is deleted)
    • int temp_array(int size, int flags):
      • works exactly like create_array, only created array becomes “temporary”
    • void fix_array(int arrayID):
      • changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames)
    • void set_array(int arrayID, mixed key, mixed value):
      • sets array value
      • if used on list, “key” must be numeric and within valid index range (0..size-1)
      • if used on map, key can be of any type
      • to “unset” a value from map, just set it to zero (0)
        • NOTE: to add a value of 0 for the key, use the float value of 0.0
      • this works exactly like statement: arrayID[key] := value;
    • mixed get_array(int arrayID, mixed key):
      • returns array value by key or index
      • if key doesn’t exist or index is not in valid range, returns 0
      • works exactly like expression: (arrayID[key])
    • void resize_array(int arrayID, int size):
      • changes array size
      • applicable to maps too, but only to reduce elements
      • there are number of special negative values of “size” which perform various operations on the array, use macros sort_array, sort_array_reverse, reverse_array, shuffle_array from sfall.h header
    • void free_array(int arrayID):
      • deletes any array
      • if array was “saved”, it will be removed from a savegame
    • mixed scan_array(int arrayID, mixed value):
      • searches for a first occurrence of given value inside given array
      • if value is found, returns it’s index (for lists) or key (for maps)
      • if value is not found, returns -1 (be careful, as -1 can be a valid key for a map)
    • int len_array(int arrayID):
      • returns number of elements or key=>value pairs in a given array
      • if array is not found, returns -1 (can be used to check if given array exist)
    • void save_array(mixed key, int arrayID):
      • makes the array saveable; it will be saved in sfallgv.sav file when saving the game
      • arrayID is associated with given “key”
      • array becomes permanent (if it was temporary) and “saved”
      • key can be of any type (int, float or string)
      • if you specify 0 as the key for the array ID, it will make the array “unsaved”
    • int load_array(mixed key):
      • loads array from savegame data by the same key provided in save_array
      • returns array ID or zero (0) if none found
    • mixed array_key(int arrayID, int index):
      • don’t use it directly; it is generated by the compiler in foreach loops
      • for lists, returns index back (no change)
      • for maps, returns a key at the specified numeric index (don’t rely on the order in which keys are stored though)
      • can be checked if given array is associative or not, by using index (-1): 0 - array is list, 1 - array is map
    • int arrayexpr(mixed key, mixed value):
      • don’t use it directly; it is used by compiler to create array expressions
      • assigns value to a given key in an array, created by last create_array or temp_array call
      • always returns 0

    Backward compatibility notes

    For those who used arrays in their mods before sfall 3.4:

    • There is an INI parameter ArraysBehavior in Misc section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that create_array will create permanent arrays which are “saved” by default and their IDs are also permanent. It is 1 by default.

    • NOTE: Starting from sfall 4.3.3/3.8.33, the ArraysBehavior option is removed, and arrays always work in ArraysBehavior=1 mode. Make sure to review your scripts if you need to save arrays into savegames.

    • How savegame compatibility is handled?
      Saved arrays are stored in sfallgv.sav file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn’t crash, but all arrays will be lost.

    • Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays.


    Table of contents


This site uses Just the Docs, a documentation theme for Jekyll.
+

Array operators reference

*mixed means any type

  • int create_array(int size, int flags):
    • creates permanent array (but not “saved”)
    • if size >= 0, creates list with given size
    • if size == -1, creates map (associative array)
    • if size == -1 and flags == 2, creates a “lookup” map (associative array) in which the values of existing keys are read-only and can’t be updated. This type of array allows you to store a zero (0) key value
      • NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
    • returns arrayID (valid until array is deleted)
  • int temp_array(int size, int flags):
    • works exactly like create_array, only created array becomes “temporary”
  • void fix_array(int arrayID):
    • changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames)
  • void set_array(int arrayID, mixed key, mixed value):
    • sets array value
    • if used on list, “key” must be numeric and within valid index range (0..size-1)
    • if used on map, key can be of any type
    • to “unset” a value from map, just set it to zero (0)
      • NOTE: to add a value of 0 for the key, use the float value of 0.0
    • this works exactly like statement: arrayID[key] := value;
  • mixed get_array(int arrayID, mixed key):
    • returns array value by key or index
    • if key doesn’t exist or index is not in valid range, returns 0
    • works exactly like expression: (arrayID[key])
  • void resize_array(int arrayID, int size):
    • changes array size
    • applicable to maps too, but only to reduce elements
    • there are number of special negative values of “size” which perform various operations on the array, use macros sort_array, sort_array_reverse, reverse_array, shuffle_array from sfall.h header
  • void free_array(int arrayID):
    • deletes any array
    • if array was “saved”, it will be removed from a savegame
  • mixed scan_array(int arrayID, mixed value):
    • searches for a first occurrence of given value inside given array
    • if value is found, returns it’s index (for lists) or key (for maps)
    • if value is not found, returns -1 (be careful, as -1 can be a valid key for a map)
  • int len_array(int arrayID):
    • returns number of elements or key=>value pairs in a given array
    • if array is not found, returns -1 (can be used to check if given array exist)
  • void save_array(mixed key, int arrayID):
    • makes the array saveable; it will be saved in sfallgv.sav file when saving the game
    • arrayID is associated with given “key”
    • array becomes permanent (if it was temporary) and “saved”
    • key can be of any type (int, float or string)
    • if you specify 0 as the key for the array ID, it will make the array “unsaved”
  • int load_array(mixed key):
    • loads array from savegame data by the same key provided in save_array
    • returns array ID or zero (0) if none found
  • mixed array_key(int arrayID, int index):
    • don’t use it directly; it is generated by the compiler in foreach loops
    • for lists, returns index back (no change)
    • for maps, returns a key at the specified numeric index (don’t rely on the order in which keys are stored though)
    • can be checked if given array is associative or not, by using index (-1): 0 - array is list, 1 - array is map
  • int arrayexpr(mixed key, mixed value):
    • don’t use it directly; it is used by compiler to create array expressions
    • assigns value to a given key in an array, created by last create_array or temp_array call
    • always returns 0

Backward compatibility notes

For those who used arrays in their mods before sfall 3.4:

  • There is an INI parameter ArraysBehavior in Misc section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that create_array will create permanent arrays which are “saved” by default and their IDs are also permanent. It is 1 by default.

  • NOTE: Starting from sfall 4.3.3/3.8.33, the ArraysBehavior option is removed, and arrays always work in ArraysBehavior=1 mode. Make sure to review your scripts if you need to save arrays into savegames.

  • How savegame compatibility is handled?
    Saved arrays are stored in sfallgv.sav file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn’t crash, but all arrays will be lost.

  • Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays.


Table of contents


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/art-and-appearance/index.html b/art-and-appearance/index.html index 9d7937a1..a4984319 100644 --- a/art-and-appearance/index.html +++ b/art-and-appearance/index.html @@ -1,6 +1,6 @@ - Art and appearance | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Art and appearance

Functions


art_cache_clear

sfall.h

void art_cache_clear()
+             Art and appearance | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Art and appearance

Functions


art_cache_clear

sfall.h

void art_cache_clear()
 

Clears the cache of FRM image files loaded into memory.


art_exists

int art_exists(int artFID)
 

checks if given artFID exists in the game. Useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000)).


refresh_pc_art

void refresh_pc_art
 

set_hero_race

void set_hero_race(int style)
 

set_hero_style

void set_hero_style(int style)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/audio/index.html b/audio/index.html index b77dfd95..1c298481 100644 --- a/audio/index.html +++ b/audio/index.html @@ -1,5 +1,5 @@ - Audio | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Audio

Functions


eax_available

int eax_available()
+             Audio | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Audio

Functions


eax_available

int eax_available()
 

Obsolete since sfall 2.1a. Always returns 0.


play_sfall_sound

int play_sfall_sound(string file, int mode)
 

Used to play mp3/wav/wma files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don’t wish to loop, play_sfall_sound returns 0. If you do loop, it returns an ID which can be passed back to stop_sfall_sound when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.

Starting from sfall 4.2.8/3.8.28, you can pass a value in the mode argument for a reduced sound volume. To set the volume, you need to convert the number to hexadecimal and use the argument format 0xZZZZ000Y, where ZZZZ is the volume reduction value in range from 0 to 32767 (the value 32767 is mute), and Y is the playback mode.


set_eax_environment

void set_eax_environment(int environment)
 

Obsolete since sfall 2.1a. Has no effect.


stop_sfall_sound

void stop_sfall_sound(int soundID)
-

Stops looping mp3/wav/wma files previously launched by play_sfall_sound. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Stops looping mp3/wav/wma files previously launched by play_sfall_sound. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/best-practices/index.html b/best-practices/index.html index a1a5db48..f2fc0cec 100644 --- a/best-practices/index.html +++ b/best-practices/index.html @@ -1,4 +1,4 @@ - Best practices | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Best practices

Mod compatibility

  1. If it can be done in a global script, do it in a global script. Combined with hooks, they are extremely powerful, possibilities ranging from creating new perks to UI scripting to prototype altering on-the-fly. While scripting does take a bit longer to get started, and hacking prototypes directly with GUI programs might look easier at first, consider that:
    • Scripts from different mods modifying the same thing can actually be compatible with each other. Binary files can’t.
    • Scripts can be version controlled and thus are much more easier to maintain.
  2. If you’re using set_sfall_return, always couple it with set_sfall_arg for the corresponding arg(s), unless you have a specific reason not to. Detailed explanation is available here.

  3. Pick yourself a 2-3 character modding prefix. Use it for:
    • global script names
    • global variable names and saved array names
    • debug messages

This will ensure (to some degree), that another mod doesn’t overwrite your scripts, doesn’t mess with your global variables, and that debug messages coming from your scripts can be distinguished easily.

For example, if you pick prefix “a_”, your script could be named gl_a_myscript.int, and might look like this:

    #define NAME "gl_a_myscript"
+             Best practices | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Best practices

Mod compatibility

  1. If it can be done in a global script, do it in a global script. Combined with hooks, they are extremely powerful, possibilities ranging from creating new perks to UI scripting to prototype altering on-the-fly. While scripting does take a bit longer to get started, and hacking prototypes directly with GUI programs might look easier at first, consider that:
    • Scripts from different mods modifying the same thing can actually be compatible with each other. Binary files can’t.
    • Scripts can be version controlled and thus are much more easier to maintain.
  2. If you’re using set_sfall_return, always couple it with set_sfall_arg for the corresponding arg(s), unless you have a specific reason not to. Detailed explanation is available here.

  3. Pick yourself a 2-3 character modding prefix. Use it for:
    • global script names
    • global variable names and saved array names
    • debug messages

This will ensure (to some degree), that another mod doesn’t overwrite your scripts, doesn’t mess with your global variables, and that debug messages coming from your scripts can be distinguished easily.

For example, if you pick prefix “a_”, your script could be named gl_a_myscript.int, and might look like this:

    #define NAME "gl_a_myscript"
     #define ndebug(message) debug_msg(NAME + ": " + message + "\n")
 
     procedure start begin
@@ -8,4 +8,4 @@
       end
     end
     ...
-

Performance

  1. Do not abuse set_global_script_repeat. Whenever possible, register your script as a hook instead. You can register the same procedure at multiple hook points, if necessary.
    • If you have set_global_script_repeat(300) in your script, you’re probably doing something wrong. That’s an invocation every 3-5 seconds, approximately.
    • If you have set_global_script_repeat(30), you are definitely doing something wrong. Look for suitable hooks harder, think of another way for implementing it, ask fellow modders for help.

This site uses Just the Docs, a documentation theme for Jekyll.
+

Performance

  1. Do not abuse set_global_script_repeat. Whenever possible, register your script as a hook instead. You can register the same procedure at multiple hook points, if necessary.
    • If you have set_global_script_repeat(300) in your script, you’re probably doing something wrong. That’s an invocation every 3-5 seconds, approximately.
    • If you have set_global_script_repeat(30), you are definitely doing something wrong. Look for suitable hooks harder, think of another way for implementing it, ask fellow modders for help.

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/call_offset_vx/index.html b/call_offset_vx/index.html index 3ede4a27..296f1e0d 100644 --- a/call_offset_vx/index.html +++ b/call_offset_vx/index.html @@ -1,4 +1,4 @@ - call_offset_vX | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

call_offset_vX

Can be used to call arbitrary functions inside Fallout. Different versions are used to call functions with different numbers of arguments. None of these functions will work unless AllowUnsafeScripting is enabled in ddraw.ini.

Functions


call_offset_r0

UNSAFE

int call_offset_r0(int address)
+             call_offset_vX | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

call_offset_vX

Can be used to call arbitrary functions inside Fallout. Different versions are used to call functions with different numbers of arguments. None of these functions will work unless AllowUnsafeScripting is enabled in ddraw.ini.

Functions


call_offset_r0

UNSAFE

int call_offset_r0(int address)
 

call_offset_r1

UNSAFE

int call_offset_r1(int address, int arg1)
 

call_offset_r2

UNSAFE

int call_offset_r2(int address, int arg1, int arg2)
 

call_offset_r3

UNSAFE

int call_offset_r3(int address, int arg1, int arg2, int arg3)
@@ -8,4 +8,4 @@
 

call_offset_v2

UNSAFE

void call_offset_v2(int address, int arg1, int arg2)
 

call_offset_v3

UNSAFE

void call_offset_v3(int address, int arg1, int arg2, int arg3)
 

call_offset_v4

UNSAFE

void call_offset_v4(int address, int arg1, int arg2, int arg3, int arg4)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/car/index.html b/car/index.html index f776a3d7..6ad86578 100644 --- a/car/index.html +++ b/car/index.html @@ -1,4 +1,4 @@ - Car | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Car

Functions


car_gas_amount

sfall.h

int car_gas_amount()
+             Car | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Car

Functions


car_gas_amount

sfall.h

int car_gas_amount()
 

Returns the current amount of fuel in player’s car (between 0 and 80000). To change fuel amount, use vanilla function: metarule(METARULE_GIVE_CAR_GAS, amount) - amount can be positive or negative.


set_car_current_town

void set_car_current_town(int town)
 

Changes the current town index for the player’s car.


set_car_intface_art

sfall.h

void set_car_intface_art(int artIndex)
-
  • Changes the interface art (index in intrface.lst) for the car image on the world map interface
  • Should be called before going to the world map
  • Vanilla art index is 433

This site uses Just the Docs, a documentation theme for Jekyll.
+
  • Changes the interface art (index in intrface.lst) for the car image on the world map interface
  • Should be called before going to the world map
  • Vanilla art index is 433

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/combat/index.html b/combat/index.html index c3ecbd2a..9b5c7183 100644 --- a/combat/index.html +++ b/combat/index.html @@ -1,4 +1,4 @@ - Combat | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Combat

Subcategories

Functions


attack_is_aimed

sfall.h

bool attack_is_aimed()
+             Combat | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Combat

Subcategories

Functions


attack_is_aimed

sfall.h

bool attack_is_aimed()
 

Returns 1 if the aimed attack mode is selected, 0 otherwise.


block_combat

void block_combat(bool value)
 

Deny the player to enter combat mode.


combat_data

mixed combat_data
 
  • returns a pointer to the C_ATTACK_* data for the current combat attack process (see defined constants in define_extra.h)
  • can be used in conjunction with the get_object_data and set_object_data functions example: sfall_func3("set_object_data", sfall_func0("combat_data"), C_ATTACK_UNUSED, 255);

disable_aimed_shots

void disable_aimed_shots(int pid)
@@ -17,4 +17,4 @@
 

Used for modifying the critical table. For details see critical hit tables. Changes are not saved, and will reset to the defaults (or to the contents of CriticalOverrides.ini, if it exists) at each game reload. Requires OverrideCriticalTable to be enabled in ddraw.ini (already enabled by default).


set_critter_burst_disable

void set_critter_burst_disable(int critter, int disable)
 

set_critter_current_ap

void set_critter_current_ap(CritterPtr, int ap)
 

Should only be used during the target critters turn while in combat.


set_spray_settings

sfall.h

void set_spray_settings(int centerMult, int centerDiv, int targetMult, int targetDiv)
-

Allows changing the multipliers and divisors for the bullet distribution of burst attacks dynamically. All settings are automatically reset to default values (i.e. ComputeSpray_* settings in ddraw.ini) after each attack action

  • Should be called before the calculation of the bullet distribution (e.g. in HOOK_TOHIT or HOOK_AMMOCOST)
  • centerDiv/targetDiv: the minimum value of divisor is 1
  • centerMult/targetMult: multiplier values are capped at divisor values
  • NOTE: refer to the description of ComputeSpray_* settings in ddraw.ini for details of the bullet distribution of burst attacks

This site uses Just the Docs, a documentation theme for Jekyll.
+

Allows changing the multipliers and divisors for the bullet distribution of burst attacks dynamically. All settings are automatically reset to default values (i.e. ComputeSpray_* settings in ddraw.ini) after each attack action

  • Should be called before the calculation of the bullet distribution (e.g. in HOOK_TOHIT or HOOK_AMMOCOST)
  • centerDiv/targetDiv: the minimum value of divisor is 1
  • centerMult/targetMult: multiplier values are capped at divisor values
  • NOTE: refer to the description of ComputeSpray_* settings in ddraw.ini for details of the bullet distribution of burst attacks

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/cursor/index.html b/cursor/index.html index c95ce4eb..411b5a7c 100644 --- a/cursor/index.html +++ b/cursor/index.html @@ -1,3 +1,3 @@ - Cursor | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Cursor

Functions


get_cursor_mode

sfall.h

int get_cursor_mode()
+             Cursor | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Cursor

Functions


get_cursor_mode

sfall.h

int get_cursor_mode()
 

Returns the current cursor mode. Values: 0 - movement cursor, 1 - command cursor, 2 - targeting cursor, 4 to 10 are Skilldex skills (yellow targeting cursor).


set_cursor_mode

sfall.h

void set_cursor_mode(int mode)
-

Sets the current cursor mode.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Sets the current cursor mode.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/data-types/index.html b/data-types/index.html index 31770c8b..37193aee 100644 --- a/data-types/index.html +++ b/data-types/index.html @@ -1 +1 @@ - Data types | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Data types

Data types mentioned in this document

  • array - array ID to be used with array-related functions (actually an integer)
  • any - any type
  • bool - boolean (in fact, int: True is 1 and False is 0)
  • int - integer number
  • mixed - type depends on exact use case
  • float - floating point number
  • ObjectPtr - pointer to a game object (actually an integer)
  • proc - procedure name (used in register_hook_proc)
  • string - string (text) value
  • void - means opcode does not return any value

This site uses Just the Docs, a documentation theme for Jekyll.
+ Data types | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Data types

Data types mentioned in this document

  • array - array ID to be used with array-related functions (actually an integer)
  • any - any type
  • bool - boolean (in fact, int: True is 1 and False is 0)
  • int - integer number
  • mixed - type depends on exact use case
  • float - floating point number
  • ObjectPtr - pointer to a game object (actually an integer)
  • proc - procedure name (used in register_hook_proc)
  • string - string (text) value
  • void - means opcode does not return any value

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/direct-memory-access/index.html b/direct-memory-access/index.html index e246e170..ff02b63c 100644 --- a/direct-memory-access/index.html +++ b/direct-memory-access/index.html @@ -1 +1 @@ - Direct memory access | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Direct memory access

Subcategories


This site uses Just the Docs, a documentation theme for Jekyll.
+ Direct memory access | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Direct memory access

Subcategories


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/explosions/index.html b/explosions/index.html index 3eeac4a0..8111ca17 100644 --- a/explosions/index.html +++ b/explosions/index.html @@ -1,4 +1,4 @@ - Explosions | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Explosions

Functions


get_explosion_damage

sfall.h

array get_explosion_damage(itemPid)
+             Explosions | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Explosions

Functions


get_explosion_damage

sfall.h

array get_explosion_damage(itemPid)
 

Returns an array of the minimum and maximum damage of the explosive item.


item_make_explosive

sfall.h

void item_make_explosive(int pid, int activePid, int minDamage, int maxDamage)
 
  • makes the specified item (pid) an explosive item like Dynamite or Plastic Explosives
  • maxDamage is optional
  • activePid is for an item with an active timer, can be the same as the pid argument
  • the item proto must be the Misc Item type and have the Use action flag
  • minDamage/maxDamage are the minimum and maximum explosion damage
  • using the function on an item that is already set as an explosive will override its previous settings
  • NOTE: this function does not work for pids of Dynamite and Plastic Explosives

metarule2_explosions

int metarule2_explosions(int arg1, int arg2)
 

Was made as a quick-and-dirty hack to enable dynamic changes to some explosion parameters for ranged attacks. All changed parameters are automatically reset to vanilla state after each attack action.


set_attack_explosion_art

sfall.h

void set_attack_explosion_art(x, y)
@@ -9,4 +9,4 @@
 

Sets the minimum and maximum damage for Dynamite. Changed damage will be reset each time the player reloads the game.


set_explosion_max_targets

sfall.h

void set_explosion_max_targets(x)
 

Sets the maximum number of additional targets for an explosion, valid range: 1..6 (default is 6).


set_explosion_radius

sfall.h

void set_explosion_radius(grenade, rocket)
 

Sets a permanent radius of the explosion for grenades and/or rockets. Passing 0 means not changing the corresponding radius. Changed radius will be reset each time the player reloads the game.


set_plastic_damage

sfall.h

void set_plastic_damage(minDmg, maxDmg)
-

Sets the minimum and maximum damage for Plastic Explosives. Changed damage will be reset each time the player reloads the game.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Sets the minimum and maximum damage for Plastic Explosives. Changed damage will be reset each time the player reloads the game.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/feed.xml b/feed.xml index 9e6ec6b5..2e243238 100644 --- a/feed.xml +++ b/feed.xml @@ -1 +1 @@ -Jekyll2026-01-01T12:25:00+00:00/sfall/feed.xmlsfallSfall documentation \ No newline at end of file +Jekyll2026-01-03T12:58:48+00:00/sfall/feed.xmlsfallSfall documentation \ No newline at end of file diff --git a/funcx/index.html b/funcx/index.html index 4da8bf6a..9610817a 100644 --- a/funcx/index.html +++ b/funcx/index.html @@ -1,4 +1,4 @@ - funcX | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

funcX

Functions


sfall_func0

any sfall_func0(char* funcName)
+             funcX | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

funcX

Functions


sfall_func0

any sfall_func0(char* funcName)
 

Calls script function with given name and no arguments.


sfall_func1

any sfall_func1(char* funcName, arg1)
 

Calls script function with given name and 1 argument.


sfall_func2

any sfall_func2(char* funcName, arg1, arg2)
 

Calls script function with given name and 2 arguments.


sfall_func3

any sfall_func3(char* funcName, arg1, arg2, arg3)
@@ -7,4 +7,4 @@
 

Calls script function with given name and 5 arguments.


sfall_func6

any sfall_func6(char* funcName, arg1, arg2, arg3, arg4, arg5, arg6)
 

Calls script function with given name and 6 arguments


sfall_func7

any sfall_func7(string funcName, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
 

Calls script function with given name and 7 arguments


sfall_func8

any sfall_func8(string funcName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
-

Calls script function with given name and 8 arguments


This site uses Just the Docs, a documentation theme for Jekyll.
+

Calls script function with given name and 8 arguments


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/global-script-functions/index.html b/global-script-functions/index.html index f3fba28d..d7c4d5e4 100644 --- a/global-script-functions/index.html +++ b/global-script-functions/index.html @@ -1,4 +1,4 @@ - Global script functions | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Global script functions

Functions


available_global_script_types

int available_global_script_types
+             Global script functions | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Global script functions

Functions


available_global_script_types

int available_global_script_types
 

set_global_script_repeat

void set_global_script_repeat(int frames)
 

Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up repeat rate. Will have no effect if called on a non-global script.


set_global_script_type

void set_global_script_type(int type)
-

Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up the script type.

  • (DEPRECATED) Using type 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.

This site uses Just the Docs, a documentation theme for Jekyll.
+

Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up the script type.

  • (DEPRECATED) Using type 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/global-scripts/index.html b/global-scripts/index.html index c89af467..d89d38ee 100644 --- a/global-scripts/index.html +++ b/global-scripts/index.html @@ -1 +1 @@ - Global scripts | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Global scripts

As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object (i.e. using self_obj without using set_self first will crash the script).

To use a global script, the script must have a name which begins with gl and contains a procedure called start, map_enter_p_proc, map_exit_p_proc, or map_update_p_proc. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.).

Global scripts have multiple modes, which can be set using the set_global_script_type function.

  • In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map.
  • In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc.
  • In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows.
  • Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows.

This site uses Just the Docs, a documentation theme for Jekyll.
+ Global scripts | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Global scripts

As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object (i.e. using self_obj without using set_self first will crash the script).

To use a global script, the script must have a name which begins with gl and contains a procedure called start, map_enter_p_proc, map_exit_p_proc, or map_update_p_proc. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.).

Global scripts have multiple modes, which can be set using the set_global_script_type function.

  • In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map.
  • In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc.
  • In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows.
  • Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows.

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/global-variables/index.html b/global-variables/index.html index 35c75e47..6e007730 100644 --- a/global-variables/index.html +++ b/global-variables/index.html @@ -1,4 +1,4 @@ - Global variables | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Global variables

These functions require an EXACTLY 8 characters long, case sensitive string for the variable name. The variables behave the same as normal Fallout globals, except that they don’t have to be declared beforehand in vault13.gam. Trying to get a variable which hasn’t been set will always return 0. The functions are intended for use when a patch to a mod requires the addition of a new global variable, a case which would otherwise require the player to start a new game.

Functions


get_sfall_global_float

float get_sfall_global_float(string/int varname)
+             Global variables | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Global variables

These functions require an EXACTLY 8 characters long, case sensitive string for the variable name. The variables behave the same as normal Fallout globals, except that they don’t have to be declared beforehand in vault13.gam. Trying to get a variable which hasn’t been set will always return 0. The functions are intended for use when a patch to a mod requires the addition of a new global variable, a case which would otherwise require the player to start a new game.

Functions


get_sfall_global_float

float get_sfall_global_float(string/int varname)
 

get_sfall_global_int

int get_sfall_global_int(string/int varname)
 

set_sfall_global

void set_sfall_global(string/int varname, int/float value)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/graphics/index.html b/graphics/index.html index 19304085..31fb3a0f 100644 --- a/graphics/index.html +++ b/graphics/index.html @@ -1,4 +1,4 @@ - Graphics | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Graphics

The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can’t. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.

Functions


activate_shader

void activate_shader(int ID)
+             Graphics | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Graphics

The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can’t. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.

Functions


activate_shader

void activate_shader(int ID)
 

deactivate_shader

void deactivate_shader(int ID)
 

force_graphics_refresh

void force_graphics_refresh(bool enabled)
 

Forces the screen to redraw at times when it normally wouldn’t. If you’re using animated shader, turning this option on is recommended.


free_shader

void free_shader(int ID)
@@ -14,4 +14,4 @@
 

set_shader_mode

void set_shader_mode(int mode)
 

Tells sfall when to use a shader. The parameter is a set of 32 flags which specify the screens on which the shader will be disabled, unless bit 32 is set, in which case the shader will only be active on those screens. Remember that screens are displayed on top of each other; if the player opens the character menu which in combat, the game still considers the player to be in combat. See sfall.h for a list of defines.


set_shader_texture

void set_shader_texture(int ID, string param, int texID)
 

set_shader_vector

void set_shader_vector(int ID, string param, float f1, float f2, float f3, float f4)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/hook-functions/index.html b/hook-functions/index.html index 32720cf2..c5254363 100644 --- a/hook-functions/index.html +++ b/hook-functions/index.html @@ -1,4 +1,4 @@ - Hook functions | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Hook functions

Functions


get_sfall_arg

mixed get_sfall_arg()
+             Hook functions | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Hook functions

Functions


get_sfall_arg

mixed get_sfall_arg()
 

Gets the next argument from sfall. Each time it’s called it returns the next argument, or otherwise it returns 0 if there are no more arguments left. You can arbitrarily get the value of any argument using the sfall_func1("get_sfall_arg_at", argNum) function.


get_sfall_arg_at

sfall.h

mixed get_sfall_arg_at(int argNum)
 

Gets the value of hook argument with the specified argument number (first argument of hook starts from 0)


get_sfall_args

int get_sfall_args()
 

Returns all hook arguments as a new temp array.


init_hook

int init_hook()
@@ -13,4 +13,4 @@
 

So if you combine both mods together, they will run in chain and the end result will be a 75% from original hit chance (hook register order doesn’t matter in this case, if you use set_sfall_arg in both hooks).

The defines to use for the hookID are in sfall.h.


register_hook_proc_spec

void register_hook_proc_spec(int hookID, procedure proc)
 

Works the same as register_hook_proc, except that it registers the current script at the end of the hook script execution chain (i.e. the script will be executed after all previously registered scripts for the same hook, including the hs_<name>.int script). In addition, all scripts hooked to a single hook point with this function are executed in the exact order of how they were registered. In the case of using register_hook and register_hook_proc functions, scripts are executed in reverse order of how they were registered. The execution chain of script procedures for a hook is as follows: 1. Procedures registered with register_hook and register_hook_proc functions (executed in reverse order of registration). 2. The hs_<name>.int script. 3. Procedures registered with the register_hook_proc_spec function (executed in the exact order of registration).


set_sfall_arg

void set_sfall_arg(int argNum, int value)
 

Changes argument value. The argument number (argNum) is 0-indexed. This is useful if you have several hook scripts attached to one hook point (see register_hook_proc).


set_sfall_return

void set_sfall_return(any value)
-

Used to return the new values from the script. Each time it’s called it sets the next value, or if you’ve already set all return values it does nothing.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Used to return the new values from the script. Each time it’s called it sets the next value, or if you’ve already set all return values it does nothing.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/hook-types/index.html b/hook-types/index.html index 96d01ceb..a8a7a0f2 100644 --- a/hook-types/index.html +++ b/hook-types/index.html @@ -1,4 +1,4 @@ - Hook types | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Hook types


AdjustFID

HOOK_ADJUSTFID (hs_adjustfid.int)

Runs after calculating character figure FID on the inventory screen, whenever the game decides that character appearance might change. Also happens on other screens, like barter.

NOTE: FID has following format: 0x0ABBCDDD, where: A - object type, BB - animation code (always 0 in this case), C - weapon code, DDD - FRM index in LST file.

int     arg0 - the vanilla FID calculated by the engine according to critter base FID and armor/weapon being used
+             Hook types | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Hook types


AdjustFID

HOOK_ADJUSTFID (hs_adjustfid.int)

Runs after calculating character figure FID on the inventory screen, whenever the game decides that character appearance might change. Also happens on other screens, like barter.

NOTE: FID has following format: 0x0ABBCDDD, where: A - object type, BB - animation code (always 0 in this case), C - weapon code, DDD - FRM index in LST file.

int     arg0 - the vanilla FID calculated by the engine according to critter base FID and armor/weapon being used
 int     arg1 - the modified FID calculated by the internal sfall code (like Hero Appearance Mod)
 
 int     ret0 - overrides the calculated FID with provided value
@@ -344,4 +344,4 @@ int     ret0 - overrides the returned result of the function:
                0 - not in range (can't see)
                1 - in range (will see if not blocked)
                2 - forced detection (will see regardless, only used in obj_can_see_obj script function which is called by every critter in the game)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/hooks/index.html b/hooks/index.html index e2626913..793163a3 100644 --- a/hooks/index.html +++ b/hooks/index.html @@ -1,4 +1,4 @@ - Hooks | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Hooks

Hook scripts are specially named scripts that are run by sfall at specific points to allow mods to override normally hardcoded behaviour in a more flexible way than sfall’s normal ini configuration.

In addition to the bit of code it overrides, the script will be run once when first loaded and again at each player reload to allow for setup. Hook scripts have access to a set of arguments supplied to sfall, but aren’t required to use them all. They also return one or more values, but again they’re optional, and you only need to return a value if you want to override the default.

See hook types and hook functions reference for details.

Hooks compatibility

To aid in mods compatibility, avoid using the predefined hs_<name>.int scripts. Instead it is recommended to use a normal global script combined with register_hook_proc or register_hook.

Example setup for a hook-script based mod:

procedure tohit_hook_handler begin
+             Hooks | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Hooks

Hook scripts are specially named scripts that are run by sfall at specific points to allow mods to override normally hardcoded behaviour in a more flexible way than sfall’s normal ini configuration.

In addition to the bit of code it overrides, the script will be run once when first loaded and again at each player reload to allow for setup. Hook scripts have access to a set of arguments supplied to sfall, but aren’t required to use them all. They also return one or more values, but again they’re optional, and you only need to return a value if you want to override the default.

See hook types and hook functions reference for details.

Hooks compatibility

To aid in mods compatibility, avoid using the predefined hs_<name>.int scripts. Instead it is recommended to use a normal global script combined with register_hook_proc or register_hook.

Example setup for a hook-script based mod:

procedure tohit_hook_handler begin
    display_msg("Modifying hit_hook " + get_sfall_arg);
    set_hit_chance_max(100);
    set_sfall_return(100);
@@ -9,4 +9,4 @@
       register_hook_proc(HOOK_TOHIT, tohit_hook_handler);
    end
 end
-

Table of contents


This site uses Just the Docs, a documentation theme for Jekyll.
+

Table of contents


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/index.html b/index.html index b45b23c2..1da0e6c3 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ - Home | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

sfall

sfall is a set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.

Engine modifications include:

  • Better support for modern operating systems
  • Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc.
  • Bug fixes
  • Many additional features for users, such as item highlight button, party member control, etc.
  • Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)

Note that this is documentation for sfall specifically, not Fallout scripting in general. For vanilla function reference, refer to the wiki.

Getting started

To get started with sfall, first familiarize yourself with new concepts:

Pay special attention to the best practices page. Also, take a look at SSLC features and optimization guide.

Next, proceed to discover new functions. They are categorized, use the menu to find the one you need. If you can’t, check uncategorized functions list and sfall macros. Also, there’s search at the top of the page.

Questions and problems

  • Report bugs and suggest features on Github.
  • Ask questions and discuss on the forum.

This site uses Just the Docs, a documentation theme for Jekyll.
+ Home | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

sfall

sfall is a set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.

Engine modifications include:

  • Better support for modern operating systems
  • Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc.
  • Bug fixes
  • Many additional features for users, such as item highlight button, party member control, etc.
  • Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)

Note that this is documentation for sfall specifically, not Fallout scripting in general. For vanilla function reference, refer to the wiki.

Getting started

To get started with sfall, first familiarize yourself with new concepts:

Pay special attention to the best practices page. Also, take a look at SSLC features and optimization guide.

Next, proceed to discover new functions. They are categorized, use the menu to find the one you need. If you can’t, check uncategorized functions list and sfall macros. Also, there’s search at the top of the page.

Questions and problems

  • Report bugs and suggest features on Github.
  • Ask questions and discuss on the forum.

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/ini-settings/index.html b/ini-settings/index.html index 47e3874c..304b97be 100644 --- a/ini-settings/index.html +++ b/ini-settings/index.html @@ -1,4 +1,4 @@ - INI settings | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

INI settings

Functions


get_ini_config

sfall.h

array get_ini_config(string file)
+             INI settings | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

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)
@@ -6,4 +6,4 @@
 

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.


This site uses Just the Docs, a documentation theme for Jekyll.
+

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.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/interface/index.html b/interface/index.html index c03b1c52..83f91c91 100644 --- a/interface/index.html +++ b/interface/index.html @@ -1 +1 @@ - Interface | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Interface

Subcategories


This site uses Just the Docs, a documentation theme for Jekyll.
+ Interface | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Interface

Subcategories


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/inventory/index.html b/inventory/index.html index 63850a2e..7c192688 100644 --- a/inventory/index.html +++ b/inventory/index.html @@ -1,3 +1,3 @@ - Inventory | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Inventory

Functions


display_stats

sfall.h

void display_stats()
+             Inventory | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Inventory

Functions


display_stats

sfall.h

void display_stats()
 
  • Updates player’s stats in the inventory display window or on the character screen.
  • NOTE: works only when the interface window is opened

inventory_redraw

sfall.h

void inventory_redraw(invSide)
-

Redraws inventory items list in the inventory/loot/barter screens. Argument invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument).


This site uses Just the Docs, a documentation theme for Jekyll.
+

Redraws inventory items list in the inventory/loot/barter screens. Argument invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument).


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/keyboard-and-mouse/index.html b/keyboard-and-mouse/index.html index d49f6b6d..05d750d9 100644 --- a/keyboard-and-mouse/index.html +++ b/keyboard-and-mouse/index.html @@ -1,6 +1,6 @@ - Keyboard and mouse | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Keyboard and mouse

Functions


get_mouse_buttons

int get_mouse_buttons()
+             Keyboard and mouse | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Keyboard and mouse

Functions


get_mouse_buttons

int get_mouse_buttons()
 

Returns the number of the mouse button that is currently pressed (1 - left, 2 - right, 3 - left+right, 4 - middle, 0 otherwise).


get_mouse_x

int get_mouse_x()
 

get_mouse_y

int get_mouse_y()
 

key_pressed

int key_pressed(int dxScancode)
 

tap_key

void tap_key(int dxScancode)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/knockback/index.html b/knockback/index.html index 579d8a9a..e723961b 100644 --- a/knockback/index.html +++ b/knockback/index.html @@ -1,7 +1,7 @@ - Knockback | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Knockback

The type value in the weapon knockback functions can be 0 or 1. If 0, the value becomes an absolute distance that targets will be knocked back. If 1, the value is multiplied by the distance they would normally have been knocked back. Weapon knockback modifiers are applied in the order weapon -> attacker -> target, so a x2 weapon wielded by an abs 6 attacker hitting a /2 target will knock the target back 3 squares. The knockback functions will not override the stonewall perk or knockdowns resulting from criticals. knockback values set on weapons or critters are not saved, and must be reset each time the player reloads.

Functions


remove_attacker_knockback

void remove_attacker_knockback(CritterPtr)
+             Knockback | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Knockback

The type value in the weapon knockback functions can be 0 or 1. If 0, the value becomes an absolute distance that targets will be knocked back. If 1, the value is multiplied by the distance they would normally have been knocked back. Weapon knockback modifiers are applied in the order weapon -> attacker -> target, so a x2 weapon wielded by an abs 6 attacker hitting a /2 target will knock the target back 3 squares. The knockback functions will not override the stonewall perk or knockdowns resulting from criticals. knockback values set on weapons or critters are not saved, and must be reset each time the player reloads.

Functions


remove_attacker_knockback

void remove_attacker_knockback(CritterPtr)
 

remove_target_knockback

void remove_target_knockback(CritterPtr)
 

remove_weapon_knockback

void remove_weapon_knockback(WeaponPtr)
 

set_attacker_knockback

void set_attacker_knockback(CritterPtr, int type, float value)
 

set_target_knockback

void set_target_knockback(CritterPtr, int type, float value)
 

set_weapon_knockback

void set_weapon_knockback(WeaponPtr, int type, float value)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/lists/index.html b/lists/index.html index c7b59274..982c4fd5 100644 --- a/lists/index.html +++ b/lists/index.html @@ -1,6 +1,6 @@ - Lists | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Lists

The list_xxx functions can be used to loop over all items on a map. list_begin takes an argument telling sfall what you want to list (defined in sfall.h). It returns a list pointer, which you iterate through with list_next. Finally, when you’ve finished with the list use list_end on it. Not calling list_end will result in a memory leak. Alternatively, use list_as_array to get the whole list at once as a temp array variable, which can be looped over using len_array and which you don’t need to remember to free afterwards.

Functions


list_as_array

array list_as_array(int type)
+             Lists | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Lists

The list_xxx functions can be used to loop over all items on a map. list_begin takes an argument telling sfall what you want to list (defined in sfall.h). It returns a list pointer, which you iterate through with list_next. Finally, when you’ve finished with the list use list_end on it. Not calling list_end will result in a memory leak. Alternatively, use list_as_array to get the whole list at once as a temp array variable, which can be looped over using len_array and which you don’t need to remember to free afterwards.

Functions


list_as_array

array list_as_array(int type)
 

list_begin

int list_begin(int type)
 

list_end

void list_end(int listid)
 

list_next

int list_next(int listid)
 

party_member_list

array party_member_list(int includeHidden)
-

Returns an array of all current party members (0 - only critters that are alive and visible will be returned, 1 - all objects, including the car trunk, etc.)


This site uses Just the Docs, a documentation theme for Jekyll.
+

Returns an array of all current party members (0 - only critters that are alive and visible will be returned, 1 - all objects, including the car trunk, etc.)


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/locks/index.html b/locks/index.html index 928c57c2..79ad6c4a 100644 --- a/locks/index.html +++ b/locks/index.html @@ -1,4 +1,4 @@ - Locks | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Locks

Functions


lock_is_jammed

sfall.h

bool lock_is_jammed(ObjectPtr obj)
+             Locks | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Locks

Functions


lock_is_jammed

sfall.h

bool lock_is_jammed(ObjectPtr obj)
 

Returns 1 if the lock (container or scenery) is currently jammed, 0 otherwise.


set_unjam_locks_time

sfall.h

void set_unjam_locks_time(int time)
 

Sets after how many hours (up to 127 hours) jammed locks will be unjammed if the player leaves the map. Also disables the auto unjam that occurs at midnight when the player is on the map. Passing 0 will disable the auto unjam mechanism completely. The auto unjam mechanism will be reset each time the player reloads the game.


unjam_lock

sfall.h

void unjam_lock(ObjectPtr obj)
-

Unjams a lock immediately without having to wait until the next day, or leave the map and then return after 24 hours. Does not work in use_skill_on_p_proc procedure.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Unjams a lock immediately without having to wait until the next day, or leave the map and then return after 24 hours. Does not work in use_skill_on_p_proc procedure.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/main-interface/index.html b/main-interface/index.html index fbaa8ad4..2ed7e9e9 100644 --- a/main-interface/index.html +++ b/main-interface/index.html @@ -1,5 +1,5 @@ - Main interface | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Main interface

Functions


intface_hide

sfall.h

void intface_hide()
+             Main interface | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Main interface

Functions


intface_hide

sfall.h

void intface_hide()
 

Hides main interface.


intface_is_hidden

sfall.h

bool intface_is_hidden()
 

Returns 1 if interface is currently hidden, 0 otherwise.


intface_redraw

sfall.h

void intface_redraw(bool winType)
 

Redraws main game interface. Useful after direct changes to current player weapons or stats to reflect changes.

  • redraws main game interface, useful to reflect changes after directly changing current player weapons or stats
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h). Pass -1 to redraw all interface windows.

intface_show

sfall.h

void intface_show()
-

Shows main interface.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Shows main interface.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/maps-and-encounters/index.html b/maps-and-encounters/index.html index 79f71dd8..008a4a19 100644 --- a/maps-and-encounters/index.html +++ b/maps-and-encounters/index.html @@ -1,4 +1,4 @@ - Maps and encounters | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Maps and encounters

Subcategories

Functions


exec_map_update_scripts

sfall.h

void exec_map_update_scripts()
+             Maps and encounters | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Maps and encounters

Subcategories

Functions


exec_map_update_scripts

sfall.h

void exec_map_update_scripts()
 

Executes map_update_p_proc for all objects on map and global/hook scripts as well.


force_encounter

void force_encounter(int map)
 

Can be called either from a global script while traveling on the world map, or from a normal script while on a local map. In either case the encounter occurs shortly after the next time the player moves on the world map. The player will not get an outdoorsman skill check.


force_encounter_with_flags

void force_encounter_with_flags(int map, int flags)
 

Does the same thing as force_encounter, but allows the specification of some extra options (see sfall.h for available flags). Forcing a random encounter on a map that is not normally used for random encounters may cause the player to lose the car, if they have it. In this case use force_encounter_with_flags with the ENCOUNTER_FLAG_NO_CAR flag set.


get_map_enter_position

array get_map_enter_position()
@@ -9,4 +9,4 @@
 

Adjusts how fast time passes while you’re on the world map. It takes a single float as an argument, where 1 is the normal speed. This function works in addition to the WorldMapTimeMod setting in ddraw.ini and the Pathfinder perk, rather than overriding it, so calling set_map_time_multi(0.5) when the player has 2 levels of Pathfinder would result in time passing at 25% the normal speed on the world map.


set_terrain_name

sfall.h

void sfall_func3("set_terrain_name", int x, int y, string name)
 

Overrides the terrain type name for the sub-tile on the world map by the specified coordinates.


set_town_title

void sfall_func2("set_town_title", int areaID, string title)
 

Sets a floating text for a town on the world map when hovering the cursor over the player’s marker.

- areaID: the ID number of the town from city.txt
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/math/index.html b/math/index.html index ec5b13d8..6f70d9a8 100644 --- a/math/index.html +++ b/math/index.html @@ -1,4 +1,4 @@ - Math | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Math

Functions


^

x^y
+             Math | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Math

Functions


^

x^y
 

Exponentiation. Use as any other arithmetic operator, like 5^(1/3). If exponent is an integer, you can use a negative base, otherwise you will get “NaN” with a negative base. If both arguments are integers, the result will be an integer.


abs

int/float abs(int/float x)
 

Absolute (positive) value of x.


arctan

float arctan(float x, float y)
 

Arctangent of x. Pass 1 as y (don’t ask…).


ceil

int ceil(float x)
@@ -11,4 +11,4 @@
 

Round x to the nearest integer.


sin

float sin(float x)
 

Sine of x


sqrt

float sqrt(float x)
 

Square root of x.


tan

float tan(float x)
-

Tangent of x


This site uses Just the Docs, a documentation theme for Jekyll.
+

Tangent of x


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/npc-perks/index.html b/npc-perks/index.html index 36f40e8d..3bdc6cbf 100644 --- a/npc-perks/index.html +++ b/npc-perks/index.html @@ -1,6 +1,6 @@ - NPC perks | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

NPC perks

These functions are similar to has_fake_*/set_fake_*/set_selectable_perk functions, but apply to the specified party member NPC (including dude_obj)

Functions


has_fake_perk_npc

sfall.h

int has_fake_perk_npc(object npc, string namePerk)
+             NPC perks | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

NPC perks

These functions are similar to has_fake_*/set_fake_*/set_selectable_perk functions, but apply to the specified party member NPC (including dude_obj)

Functions


has_fake_perk_npc

sfall.h

int has_fake_perk_npc(object npc, string namePerk)
 

has_fake_trait_npc

sfall.h

int has_fake_trait_npc(object npc, string nameTrait)
 

set_fake_perk_npc

sfall.h

void set_fake_perk_npc(object npc, string namePerk, int level, int image, string desc)
 

set_fake_trait_npc

sfall.h

void set_fake_trait_npc(object npc, string nameTrait, int active, int image, string desc)
 

set_selectable_perk_npc

sfall.h

void set_selectable_perk_npc(object npc, string namePerk, int active, int image, string desc)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/objects-and-scripts/index.html b/objects-and-scripts/index.html index 67583cb1..85b62500 100644 --- a/objects-and-scripts/index.html +++ b/objects-and-scripts/index.html @@ -1,4 +1,4 @@ - Objects and scripts | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Objects and scripts

Functions


dialog_obj

sfall.h

ObjectPtr dialog_obj()
+             Objects and scripts | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Objects and scripts

Functions


dialog_obj

sfall.h

ObjectPtr dialog_obj()
 

Returns a pointer to the object (critter) the player is having a conversation or bartering with.


get_flags

sfall.h

int get_flags(ObjectPtr obj)
 

Gets the current value of object flags (see define_extra.h for available flags).


get_object_data

sfall.h

get_object_data(ObjectPtr object, int offset)
 

Returns the data at the specified offset of an object (see OBJ_DATA_* constants in define_extra.h for offsets).


get_script

int get_script(ObjectPtr obj)
@@ -15,4 +15,4 @@
 

Overrides the name of the script object that was set from scrname.msg.

  • The changed name will be reset each time the player leaves the map or reloads the game
  • Passing an empty string (“”) to the name argument or omitting it will allow the game to get the name for the object from pro_*.msg files
  • NOTE: this function is intended for use in normal game scripts and overrides the name only once for the same object until reset

set_script

void set_script(ObjectPtr obj, int scriptID)
 

Accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6). If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided. If you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.


set_self

void set_self(ObjectPtr setObj)
 

Overrides the script’s self_obj for the next function call.

  • It is primarily used to allow the calling of functions which take an implicit self_obj parameter (e.g. drop_obj) from global scripts, but it can also be used from normal scripts.
  • self_obj will be reverted to its original value after the next function call.
  • Calling set_self(0) will also revert self_obj to its original value. It is recommended to call this after each use of set_self in normal scripts in order to avoid unforeseen side effects.
  • source_obj, target_obj, and similar functions will not work if preceded by set_self.
  • NOTE: for use_obj, use_obj_on_obj vanilla functions to work correctly, it is required to call set_self twice. You can also access the local variables in the script of an object after calling set_self twice.

set_unique_id

sfall.h

int set_unique_id(ObjectPtr object, int flag)
-

Assigns a unique ID number to the object and returns it. If a unique ID number has already been assigned to an object, then ID number is returned without reassignment. flag is optional.

  • items with unique IDs will not stack with other items of the same type in the inventory
  • to just get the current ID number of an object, use get_object_data(object, OBJ_DATA_ID)
  • unique ID numbers are saved in your savegame, and have a range from 0x10000000 to 0x7FFFFFFF
  • there is also a unique ID number range for the player and party members from 18000 to 83535
  • to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument

This site uses Just the Docs, a documentation theme for Jekyll.
+

Assigns a unique ID number to the object and returns it. If a unique ID number has already been assigned to an object, then ID number is returned without reassignment. flag is optional.

  • items with unique IDs will not stack with other items of the same type in the inventory
  • to just get the current ID number of an object, use get_object_data(object, OBJ_DATA_ID)
  • unique ID numbers are saved in your savegame, and have a range from 0x10000000 to 0x7FFFFFFF
  • there is also a unique ID number range for the player and party members from 18000 to 83535
  • to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/optimization/index.html b/optimization/index.html index 3cce1084..06d5e053 100644 --- a/optimization/index.html +++ b/optimization/index.html @@ -1,4 +1,4 @@ - Optimization | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Optimization

The execution speed of scripts is not typically important in an unmodded game, given the difference in performance between a modern computer and what Fallout was designed for. When you start adding mods to the mix there’s the potential for problems again, since sfall’s global script system means that you can have a large amount of scripts being run every single frame.

sslc -O option

The sfall build of sslc supports a -O command line option to perform an optimization pass over the generated code. This isn’t a magic make-my-code-go-faster bullet; most of what it does is very limited in scope. It’s primary purpose was to strip out the procedures and variables which get automatically pulled into every script that includes define.h, whether you use them or not, and to do something about the additional variables that get created by foreach loops.

There are several levels of optimization available:

  • -O1 - Basic, only removes unreferenced variables and procedures, code itself remains untouched.
  • -O2 - Full, most code optimizations are on, but only those that were tested on complex scripts.
  • -O3 - Experimental, provides the most efficiency, but tends to break some complex code due to bugs.

The following optimizations are performed:

  • constant expression folding: if an expression depends only on values which are known at compile time, then the expression is replaced by its result.
    a := 2 + 2;  -> a := 4;
    +             Optimization | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

    Optimization

    The execution speed of scripts is not typically important in an unmodded game, given the difference in performance between a modern computer and what Fallout was designed for. When you start adding mods to the mix there’s the potential for problems again, since sfall’s global script system means that you can have a large amount of scripts being run every single frame.

    sslc -O option

    The sfall build of sslc supports a -O command line option to perform an optimization pass over the generated code. This isn’t a magic make-my-code-go-faster bullet; most of what it does is very limited in scope. It’s primary purpose was to strip out the procedures and variables which get automatically pulled into every script that includes define.h, whether you use them or not, and to do something about the additional variables that get created by foreach loops.

    There are several levels of optimization available:

    • -O1 - Basic, only removes unreferenced variables and procedures, code itself remains untouched.
    • -O2 - Full, most code optimizations are on, but only those that were tested on complex scripts.
    • -O3 - Experimental, provides the most efficiency, but tends to break some complex code due to bugs.

    The following optimizations are performed:

    • constant expression folding: if an expression depends only on values which are known at compile time, then the expression is replaced by its result.
      a := 2 + 2;  -> a := 4;
       
    • constant variable initialization: All variables are initialised to some value, (‘0’, if you don’t specify anything else,) so sslc attempts to make use of that fact to remove the first assignment to a variable if the first assignment is a constant expression.
      variable a;  -> variable a := 4;
       a := 4;      ->
       
    • constant propagation: checks for values assigned to variables which can be computed at compile time, and replaces relevant references to the symbol by the constant. The original store is not removed by this optimization. Global variables are considered for this optimization only if they are not marked import or export, and are not assigned to anywhere in the script.
      a := 4;  -> a := 4;
      @@ -35,4 +35,4 @@ end                                           -> end
         ...                                         -> while i < tmp do begin
       end                                           ->   ...
                                                     -> end
      -
    • Mark functions with pure or inline where relevant.

      • pure is a hint to the optimizer that a procedure has no side effects. (i.e. there’s no way to tell that it’s been called aside from its return value.) Pure procedures cannot modify global variables, or call any other procedure that isn’t itself pure. Functions marked with pure can only be used in expressions (i.e. you cannot use the call <procedure> syntax to call them.) If there are non-pure terms in an expression, it prevents that expression being considered for dead store removal. Where no such optimizations can be performed, or if optimization is disabled, marking a procedure with pure will have no effect on the compiled code.

      • inline is an instruction to the compiler to replace calls to the marked procedure with a copy of the procedures code instead of having a separate call. Inlined procedures cannot use the return command, cannot be predefined, and cannot be used as part of an expression. Inlining if a procedure is only going to be called once is always a win, but if there are multiple calls to a procedure you will end up bloating the size of the generated code.


    This site uses Just the Docs, a documentation theme for Jekyll.
    +
  • Mark functions with pure or inline where relevant.

    • pure is a hint to the optimizer that a procedure has no side effects. (i.e. there’s no way to tell that it’s been called aside from its return value.) Pure procedures cannot modify global variables, or call any other procedure that isn’t itself pure. Functions marked with pure can only be used in expressions (i.e. you cannot use the call <procedure> syntax to call them.) If there are non-pure terms in an expression, it prevents that expression being considered for dead store removal. Where no such optimizations can be performed, or if optimization is disabled, marking a procedure with pure will have no effect on the compiled code.

    • inline is an instruction to the compiler to replace calls to the marked procedure with a copy of the procedures code instead of having a separate call. Inlined procedures cannot use the return command, cannot be predefined, and cannot be used as part of an expression. Inlining if a procedure is only going to be called once is always a win, but if there are multiple calls to a procedure you will end up bloating the size of the generated code.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/other/index.html b/other/index.html index 2aa9412b..4bdc45dc 100644 --- a/other/index.html +++ b/other/index.html @@ -1,4 +1,4 @@ - Other | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Other

Functions


active_hand

int active_hand
+             Other | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Other

Functions


active_hand

int active_hand
 

add_g_timer_event

sfall.h

void add_g_timer_event(int time, int fixedParam)
 

Adds a timer event that calls the timed_event_p_proc procedure in the current global script time: the number of ticks after which the event timer is triggered fixedParam: the value that is passed to the timed_event_p_proc procedure for the fixed_param function


create_message_window

void create_message_window(string message)
 

create_spatial

ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius)
@@ -47,4 +47,4 @@
 

Returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise. This calls an internal engine function which is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION).


stop_game

void stop_game()
 

toggle_active_hand

void toggle_active_hand
 

unwield_slot

void sfall_func2("unwield_slot", object critter, int slot)
-

unequips an item from the specified slot for a critter or the player can take off player’s equipped item when the inventory is opened, or the player is in the barter screen slot: 0 - armor slot, 1 - right slot, 2 - left slot (see INVEN_TYPE_* in define.h)


This site uses Just the Docs, a documentation theme for Jekyll.
+

unequips an item from the specified slot for a critter or the player can take off player’s equipped item when the inventory is opened, or the player is in the barter screen slot: 0 - armor slot, 1 - right slot, 2 - left slot (see INVEN_TYPE_* in define.h)


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/outline/index.html b/outline/index.html index 8a4923f4..be142021 100644 --- a/outline/index.html +++ b/outline/index.html @@ -1,4 +1,4 @@ - Outline | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Outline

Functions


get_outline

sfall.h

int get_outline(ObjectPtr obj)
+             Outline | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Outline

Functions


get_outline

sfall.h

int get_outline(ObjectPtr obj)
 

Gets the current outline color for an object.


outlined_object

sfall.h

ObjectPtr outlined_object()
 

Returns an object that is currently highlighted by hovering the mouse above it.


set_outline

sfall.h

void set_outline(ObjectPtr obj, int color)
-
  • sets the outline color of an object (see OUTLINE_* constants in sfall.h)
  • can also set a custom color from the game palette by shifting the color index value left by 8 bits: 0xCC00 where CC is the palette index (available since sfall 4.2.7/3.8.27)
  • passing 0 will disable the outline

This site uses Just the Docs, a documentation theme for Jekyll.
+
  • sets the outline color of an object (see OUTLINE_* constants in sfall.h)
  • can also set a custom color from the game palette by shifting the color index value left by 8 bits: 0xCC00 where CC is the palette index (available since sfall 4.2.7/3.8.27)
  • passing 0 will disable the outline

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/perks-and-traits/index.html b/perks-and-traits/index.html index b1d8b817..944a6692 100644 --- a/perks-and-traits/index.html +++ b/perks-and-traits/index.html @@ -1,4 +1,4 @@ - Perks and traits | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Perks and traits

Subcategories

Functions


add_trait

sfall.h

void add_trait(int traitID)
+             Perks and traits | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Perks and traits

Subcategories

Functions


add_trait

sfall.h

void add_trait(int traitID)
 

adds the specified trait to the player


apply_heaveho_fix

void apply_heaveho_fix
 

clear_selectable_perks

void clear_selectable_perks()
 

Restores the “select a perk” box to its default state.


get_perk_available

int get_perk_available(int perk)
@@ -38,4 +38,4 @@
 

set_selectable_perk

void set_selectable_perk(string name, int active, int image, string desc)
 

Used to add additional items to “select a perk” box by setting the ‘active’ parameter to 1, and to remove them again by setting it to 0.


set_swiftlearner_mod

void set_swiftlearner_mod(int bonus)
 

show_real_perks

void show_real_perks()
-

Reverts the effect os hide_real_perks.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Reverts the effect os hide_real_perks.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/pip-boy/index.html b/pip-boy/index.html index a3712557..6d221424 100644 --- a/pip-boy/index.html +++ b/pip-boy/index.html @@ -1,2 +1,2 @@ - Pip-Boy | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Pip-Boy

Functions


set_quest_failure_value

void sfall_func2("set_quest_failure_value", int gvarNumber, int thresholdValue)
-
  • sets the threshold value (failure_threshold) for the quest at which the quest will be considered failed (its description in the pipboy will be crossed out and colored red)
  • gvarNumber: the number of the global variable controlling the quest
  • thresholdValue: the value of the global variable at which the quest is counted as a failure

This site uses Just the Docs, a documentation theme for Jekyll.
+ Pip-Boy | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Pip-Boy

Functions


set_quest_failure_value

void sfall_func2("set_quest_failure_value", int gvarNumber, int thresholdValue)
+
  • sets the threshold value (failure_threshold) for the quest at which the quest will be considered failed (its description in the pipboy will be crossed out and colored red)
  • gvarNumber: the number of the global variable controlling the quest
  • thresholdValue: the value of the global variable at which the quest is counted as a failure

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/read_xxx/index.html b/read_xxx/index.html index f187c305..f56793b8 100644 --- a/read_xxx/index.html +++ b/read_xxx/index.html @@ -1,5 +1,5 @@ - read_xxx | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

read_xxx

These functions take a memory address as the parameter and can read arbitrary pieces of Fallout’s address space.

Functions


read_byte

int read_byte(int address)
+             read_xxx | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

read_xxx

These functions take a memory address as the parameter and can read arbitrary pieces of Fallout’s address space.

Functions


read_byte

int read_byte(int address)
 

read_int

int read_int(int address)
 

read_short

int read_short(int address)
 

read_string

int read_string(int address)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/rest/index.html b/rest/index.html index 2dd1922d..1b492a7f 100644 --- a/rest/index.html +++ b/rest/index.html @@ -1,3 +1,3 @@ - Rest | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Rest

Functions


get_can_rest_on_map

sfall.h

get_can_rest_on_map(int mapNum, int elev)
+             Rest | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Rest

Functions


get_can_rest_on_map

sfall.h

get_can_rest_on_map(int mapNum, int elev)
 
  • returns the set rest value of the map after using the set_can_rest_on_map function
  • Returns -1 if the rest value of the map was not previously set (i.e. no data for the map in sfalldb.sav)
  • the can_rest_here values from maps.txt are ignored.

set_can_rest_on_map

sfall.h

void set_can_rest_on_map(int mapNum, int elev, bool value)
-

Allows/disallows to rest on the map for the specified level, overrides the can_rest_here values in maps.txt.

  • mapNum is the map index from maps.txt
  • passing -1 to the elev argument will set the rest value for all map elevations
  • the set rest value will be stored in sfalldb.sav file (in savegame)

This site uses Just the Docs, a documentation theme for Jekyll.
+

Allows/disallows to rest on the map for the specified level, overrides the can_rest_here values in maps.txt.

  • mapNum is the map index from maps.txt
  • passing -1 to the elev argument will set the rest value for all map elevations
  • the set rest value will be stored in sfalldb.sav file (in savegame)

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/sfall-funcx-macros/index.html b/sfall-funcx-macros/index.html index 3d40f0b6..eeeef9da 100644 --- a/sfall-funcx-macros/index.html +++ b/sfall-funcx-macros/index.html @@ -1,4 +1,4 @@ - Sfall funcX macros | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Sfall funcX macros

Functions


add_extra_msg_file

sfall.h

int add_extra_msg_file(string fileName)
+             Sfall funcX macros | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Sfall funcX macros

Functions


add_extra_msg_file

sfall.h

int add_extra_msg_file(string fileName)
 

Loads the custom message file, and returns the file ID number assigned to it in range from 0x3000 to 0x3FFF for the message_str_game function to get messages from the file.

  • fileName: the name of the custom message file (including the .msg extension) in text\<language>\game\ directory.

Alternative form: int add_extra_msg_file(string fileName, int fileNumber)

  • fileNumber: the file ID number for the message_str_game function. The available range is from 0x2000 to 0x2FFF (see ExtraGameMsgFileList setting in ddraw.ini) Use fileNumber only if you want to add a message file without editing ddraw.ini or existing scripts to support the old way.

critter_inven_obj2

sfall.h

ObjectPtr critter_inven_obj2(ObjectPtr obj, int type)
 

Works just like vanilla critter_inven_obj, but correctly reports item in player’s inactive hand slot.


dialog_message

sfall.h

void dialog_message(string text)
 

Displays a message in the NPC response window in dialog or barter screen.


get_current_inven_size

sfall.h

get_current_inven_size(ObjectPtr object)
@@ -22,4 +22,4 @@
 

Compares two strings case-insensitive, and returns True if the two strings are matched.


sfall_func3(“string_compare”, string str1, string str2, int codePage)

sfall.h

bool sfall_func3("string_compare", string str1, string str2, int codePage)
 

Compares two strings case-insensitive, and returns True if the two strings are matched

  • codePage: code page number to properly compare national characters in the range 128-255 of the ASCII code table available encodings: 1250-1252, 866

spatial_radius

sfall.h

int spatial_radius(ObjectPtr obj)
 

Returns radius of spatial script, associated with given dummy-object (returned by create_spatial).


void sfall_func0(“remove_timer_event”)

sfall.h

void sfall_func0("remove_timer_event")
-

Clears all set timer events for the current global script.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Clears all set timer events for the current global script.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/sfall/index.html b/sfall/index.html index df48252e..94a9e577 100644 --- a/sfall/index.html +++ b/sfall/index.html @@ -1 +1 @@ - Sfall | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Sfall

Subcategories


This site uses Just the Docs, a documentation theme for Jekyll.
+ Sfall | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Sfall

Subcategories


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/skills/index.html b/skills/index.html index dc554a20..c7c6dd5a 100644 --- a/skills/index.html +++ b/skills/index.html @@ -1,4 +1,4 @@ - Skills | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Skills

Functions


get_available_skill_points

int get_available_skill_points()
+             Skills | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Skills

Functions


get_available_skill_points

int get_available_skill_points()
 

get_critter_skill_points

int get_critter_skill_points(int critter, int skill)
 

Will get the number of additional points a critter has in a skill, on top of whatever they have from their stats and other bonuses


mod_skill_points_per_level

void mod_skill_points_per_level(int value)
 

Accepts a value of between -100 and 100, and modifies the number of skill points the player recieves when they level up. This is a modification of what would otherwise happen, rather than a replacement. The value is not saved into the save game, so should be reset in the game_loaded section of a script.


set_available_skill_points

void set_available_skill_points(int value)
@@ -6,4 +6,4 @@
 

set_critter_skill_mod

void set_critter_skill_mod(CritterPtr, int max)
 

set_critter_skill_points

void set_critter_skill_points(int critter, int skill, int value)
 

Will set the number of additional points a critter has in a skill, on top of whatever they have from their stats and other bonuses. Note that skill points are part of the proto, so calling it on a critter will affect all critters that share the same proto.


set_skill_max

void set_skill_max(int value)
-

Can’t be used to increase the skill cap above 300.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Can’t be used to increase the skill cap above 300.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/sslc/index.html b/sslc/index.html index c82f8a70..3b57c328 100644 --- a/sslc/index.html +++ b/sslc/index.html @@ -1,4 +1,4 @@ - SSLC | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

SSLC

This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional script functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.

Unlike the original script compiler, this has not been compiled as a DOS program. When using this in place of the original compile.exe but still using p.bat, you need to get rid of the dos4gw.exe reference from p.bat.

When compiling global or hook scripts for sfall 3.4 or below, you must include the line procedure start; before any #include files that define procedures to avoid a few weird problems. This is no longer required starting from 3.5.

This version of compiler was designed primarily for new sfall functions, but it can be safely used (and is recommended) with non-sfall scripts as well.

The original unmodified sslc source is over here: https://teamx.ru/site_arc/utils/index.html

Command line options

-q  don't wait for input on error
+             SSLC | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

SSLC

This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional script functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.

Unlike the original script compiler, this has not been compiled as a DOS program. When using this in place of the original compile.exe but still using p.bat, you need to get rid of the dos4gw.exe reference from p.bat.

When compiling global or hook scripts for sfall 3.4 or below, you must include the line procedure start; before any #include files that define procedures to avoid a few weird problems. This is no longer required starting from 3.5.

This version of compiler was designed primarily for new sfall functions, but it can be safely used (and is recommended) with non-sfall scripts as well.

The original unmodified sslc source is over here: https://teamx.ru/site_arc/utils/index.html

Command line options

-q  don't wait for input on error
 -n  no warnings
 -b  use backward compatibility mode
 -l  no logo
@@ -136,4 +136,4 @@ end
   if (itemPid == pid) then
     itemPrice := price;
 end
-

If you want to add additional condition for continuing the loop, use syntax: foreach (<symbol> in <expression> while <expression>). In this case loop will iterate over elements of an array until last element or until “while” expression is true (whatever comes first).

NOTE: Just like for loop, continue statement will respect increments of a hidden counter variable, so you can safely use it inside foreach.

Fixes

  • playmoviealpharect was using the token for playmoviealpha, breaking both functions in the process.
  • addbuttonflag had an entry in the token table, and could be parsed, but was missing an entry in the emit list. This resulted in the compiler accepting it as a valid function, but not outputting any code for it into the compiled script.
  • The function tokenize was missing an entry in the token table, and so would not be recognised by the compiler.
  • Fixed the check for the call "foo" syntax so that non-string constants will no longer be accepted.

Backward compatibility

There are several changes in this version of sslc which may result in problems for previously working scripts. A new command line option -b is available, which will turn off all new fixes and features which have the possibility of causing a previously compiling script to change its behaviour. (And only those features; anything which would not compile under the old sslc is not affected.) This includes the following:

  • Since for, foreach, break, continue, in and tokenize are now hardcoded names, existing scripts that use any of them as a variable or procedure name will no longer compile.
  • Missing a semicolon after a variable declaration is now a hard error. (Originally sslc would check for the semicolon, but would not complain if it was missing.)
  • The function addbuttonflag used to be recognised by the compiler, but would not emit any code into the int file.
  • The function playmoviealpharect compiled as playmoviealpha.

int2ssl note

int2ssl by Anchorite (TeamX) is included in sfall modderspack package. It was updated to support all additional opcodes of sfall, along with some syntax features. You can use it to decompile any sfall or non-sfall script.


This site uses Just the Docs, a documentation theme for Jekyll.
+

If you want to add additional condition for continuing the loop, use syntax: foreach (<symbol> in <expression> while <expression>). In this case loop will iterate over elements of an array until last element or until “while” expression is true (whatever comes first).

NOTE: Just like for loop, continue statement will respect increments of a hidden counter variable, so you can safely use it inside foreach.

Fixes

  • playmoviealpharect was using the token for playmoviealpha, breaking both functions in the process.
  • addbuttonflag had an entry in the token table, and could be parsed, but was missing an entry in the emit list. This resulted in the compiler accepting it as a valid function, but not outputting any code for it into the compiled script.
  • The function tokenize was missing an entry in the token table, and so would not be recognised by the compiler.
  • Fixed the check for the call "foo" syntax so that non-string constants will no longer be accepted.

Backward compatibility

There are several changes in this version of sslc which may result in problems for previously working scripts. A new command line option -b is available, which will turn off all new fixes and features which have the possibility of causing a previously compiling script to change its behaviour. (And only those features; anything which would not compile under the old sslc is not affected.) This includes the following:

  • Since for, foreach, break, continue, in and tokenize are now hardcoded names, existing scripts that use any of them as a variable or procedure name will no longer compile.
  • Missing a semicolon after a variable declaration is now a hard error. (Originally sslc would check for the semicolon, but would not complain if it was missing.)
  • The function addbuttonflag used to be recognised by the compiler, but would not emit any code into the int file.
  • The function playmoviealpharect compiled as playmoviealpha.

int2ssl note

int2ssl by Anchorite (TeamX) is included in sfall modderspack package. It was updated to support all additional opcodes of sfall, along with some syntax features. You can use it to decompile any sfall or non-sfall script.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/stats/index.html b/stats/index.html index 5d0edc04..f616489d 100644 --- a/stats/index.html +++ b/stats/index.html @@ -1,4 +1,4 @@ - Stats | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Stats

The get/set_pc_base/extra_stat functions are equivalent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat.

Subcategories

Functions


get_critter_base_stat

int get_critter_base_stat(CritterPtr, int StatID)
+             Stats | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Stats

The get/set_pc_base/extra_stat functions are equivalent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat.

Subcategories

Functions


get_critter_base_stat

int get_critter_base_stat(CritterPtr, int StatID)
 

get_critter_extra_stat

int get_critter_extra_stat(CritterPtr, int StatID)
 

get_pc_base_stat

int get_pc_base_stat(int StatID)
 

get_pc_extra_stat

int get_pc_extra_stat(int StatID)
@@ -8,4 +8,4 @@
 

set_critter_extra_stat

void set_critter_extra_stat(CritterPtr, int StatID, int value)
 

set_pc_base_stat

void set_pc_base_stat(int StatID, int value)
 

set_pc_extra_stat

void set_pc_extra_stat(int StatID, int value)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/strings/index.html b/strings/index.html index 72784bff..ca2afb7f 100644 --- a/strings/index.html +++ b/strings/index.html @@ -1,4 +1,4 @@ - Strings | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Strings

Functions


charcode

int charcode(string text)
+             Strings | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Strings

Functions


charcode

int charcode(string text)
 

Returns ASCII code for the first character in given string.


get_string_pointer

sfall.h

int get_string_pointer(string text)
 

(DEPRECATED) Returns a pointer to a string variable or to a text

  • NOTE: this function is intended for use only in HOOK_DESCRIPTIONOBJ. Starting from sfall 4.4/3.8.40, you can return normal strings directly in the hook without calling the function

string_find

sfall.h

int string_find(string haystack, string needle)
 

Returns the position of the first occurrence of a needle string in a haystack string, or -1 if not found. The first character position is 0 (zero).


string_find_from

sfall.h

int string_find_from(string haystack, string needle, int pos)
@@ -10,4 +10,4 @@
 

Converts all letters in the given string to the specified case.

toCase: 0 - lowercase, 1 - uppercase
 

NOTE: this function works only for English letters of A-Z/a-z.


strlen

int strlen(string text)
 

Returns string length.


substr

string substr(string text, int start, int length)
-

Cuts a substring from a string starting at “start” up to “length” characters. The first character position is 0 (zero).

  • If start is negative - it indicates a position starting from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: “st”).
  • If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: “te”).
  • If length is zero - it will return a string from the starting position to the end of the string. New behavior for sfall 4.2.2/3.8.22

This site uses Just the Docs, a documentation theme for Jekyll.
+

Cuts a substring from a string starting at “start” up to “length” characters. The first character position is 0 (zero).

  • If start is negative - it indicates a position starting from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: “st”).
  • If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: “te”).
  • If length is zero - it will return a string from the starting position to the end of the string. New behavior for sfall 4.2.2/3.8.22

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/tags/index.html b/tags/index.html index 8591eacc..2e90c0da 100644 --- a/tags/index.html +++ b/tags/index.html @@ -1,6 +1,6 @@ - Tags | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Tags

show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 0 for SNEAK (starting from sfall 4.4.4/3.8.44), 3 for LEVEL, 4 for ADDICT, and 5 to (4 + the value of BoxBarCount in ddraw.ini) for custom boxes. Remember to add your messages to intrface.msg and set up the font colours in ddraw.ini if you’re going to use custom boxes. Starting from sfall 4.1/3.8.12, is_iface_tag_active can also be used to check 0 for SNEAK, 1 for POISONED, and 2 for RADIATED.

Functions


add_iface_tag

sfall.h

void add_iface_tag()
+             Tags | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Tags

show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 0 for SNEAK (starting from sfall 4.4.4/3.8.44), 3 for LEVEL, 4 for ADDICT, and 5 to (4 + the value of BoxBarCount in ddraw.ini) for custom boxes. Remember to add your messages to intrface.msg and set up the font colours in ddraw.ini if you’re going to use custom boxes. Starting from sfall 4.1/3.8.12, is_iface_tag_active can also be used to check 0 for SNEAK, 1 for POISONED, and 2 for RADIATED.

Functions


add_iface_tag

sfall.h

void add_iface_tag()
 

Adds one custom box to the current boxes, and returns the number of the added tag (-1 if the tags limit is exceeded. The maximum number of boxes is limited to 126 tags.


hide_iface_tag

void hide_iface_tag(int tag)
 

is_iface_tag_active

int is_iface_tag_active(int tag)
 

set_iface_tag_text

sfall.h

void set_iface_tag_text(int tag, string text, int color)
 

Sets the text messages and colors for custom notification boxes to the interface without the need to add messages to intrface.msg and set up the font colors in ddraw.ini. Tag value is the same as used in show_iface_tag, hide_iface_tag, and is_iface_tag_active. The valid range is from 5 to (4 + the value of BoxBarCount in ddraw.ini) or the number of the last custom box added using the add_iface_tag function. The text is limited to 19 characters.


show_iface_tag

void show_iface_tag(int tag)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/tiles-and-paths/index.html b/tiles-and-paths/index.html index 67dd9ab2..2f58b977 100644 --- a/tiles-and-paths/index.html +++ b/tiles-and-paths/index.html @@ -1,4 +1,4 @@ - Tiles and paths | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Tiles and paths

Functions


get_tile_fid

int get_tile_fid(int tileData)
+             Tiles and paths | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Tiles and paths

Functions


get_tile_fid

int get_tile_fid(int tileData)
 
  • Returns FID information about the square under the given tile at elevation 0
  • Pass elevation as 4-bit number in bits 25-28 to access other elevations
  • Pass result mode in bits 29-32: 0 - ground FID, 1 - roof FID, 2 - raw data.

get_tile_ground_fid

sfall.h

int get_tile_ground_fid(int tileNum, int elevation)
 

Returns FID of a ground tile at given tile number and elevation.


get_tile_roof_fid

sfall.h

int get_tile_roof_fid(int tileNum, int elevation)
 

Returns FID of a roof tile at given tile number and elevation. Note that FID of 1 is used when there is no actual roof.


obj_blocking_line

ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType)
@@ -9,4 +9,4 @@
 

Returns an array of all objects at given tile. It will include any hidden, dead or system objects (like cursor), so make sure to check properly when iterating.


tile_light

int tile_light(int elevation, int tileNum)
 

Returns light intensity at the given tile in range from 0 to 65535.


tile_refresh_display

void tile_refresh_display()
 

Redraws the game scene (tiles, walls, objects, etc.).


tile_under_cursor

int tile_under_cursor
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/utility/index.html b/utility/index.html index 151145b3..0a7bd6a8 100644 --- a/utility/index.html +++ b/utility/index.html @@ -1,5 +1,5 @@ - Utility | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Utility

Subcategories

Functions


atof

float atof(string text)
+             Utility | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Utility

Subcategories

Functions


atof

float atof(string text)
 

atoi

int atoi(string text)
 

sprintf

string sprintf(string format, any value)
 

Formats given value using standart syntax of C printf function (google “printf” for format details). However, it is limited to formatting only 1 value.

  • Can be used to get character by ASCII code (“%c”).

typeof

int typeof(any value)
-

Returns type of the given value: VALTYPE_INT, VALTYPE_FLOAT or VALTYPE_STR.


This site uses Just the Docs, a documentation theme for Jekyll.
+

Returns type of the given value: VALTYPE_INT, VALTYPE_FLOAT or VALTYPE_STR.


This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/version/index.html b/version/index.html index 49d321b2..0527bc7d 100644 --- a/version/index.html +++ b/version/index.html @@ -1,4 +1,4 @@ - Version | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Version

Functions


sfall_ver_build

int sfall_ver_build()
+             Version | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Version

Functions


sfall_ver_build

int sfall_ver_build()
 

sfall_ver_major

int sfall_ver_major()
 

sfall_ver_minor

int sfall_ver_minor()
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/virtual-file-system/index.html b/virtual-file-system/index.html index f70965a6..7a634931 100644 --- a/virtual-file-system/index.html +++ b/virtual-file-system/index.html @@ -1,4 +1,4 @@ - Virtual file system | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Virtual file system

The fs_* functions are used to manipulate a virtual file system. Files saved here should have paths relative to the data folder, and use backslashes as the directory separator. They will take precedence over files stored in the normal data folder. They will also be saved into save games if you set a flag for them using fs_resize(fileId, -1), so be avoid creating large files. Using fs_copy followed by fs_read_xxx, you can read the contents of existing files.

Functions


fs_copy

int fs_copy(string path, string source)
+             Virtual file system | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Virtual file system

The fs_* functions are used to manipulate a virtual file system. Files saved here should have paths relative to the data folder, and use backslashes as the directory separator. They will take precedence over files stored in the normal data folder. They will also be saved into save games if you set a flag for them using fs_resize(fileId, -1), so be avoid creating large files. Using fs_copy followed by fs_read_xxx, you can read the contents of existing files.

Functions


fs_copy

int fs_copy(string path, string source)
 

fs_create

int fs_create(string path, int size)
 

fs_delete

void fs_delete(int id)
 

fs_find

int fs_find(string path)
@@ -16,4 +16,4 @@
 

fs_write_int

void fs_write_int(int id, int data)
 

fs_write_short

void fs_write_short(int id, int data)
 

fs_write_string

void fs_write_string(int id, string data)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/weapons-and-ammo/index.html b/weapons-and-ammo/index.html index bf99936c..bc3ac7df 100644 --- a/weapons-and-ammo/index.html +++ b/weapons-and-ammo/index.html @@ -1,5 +1,5 @@ - Weapons and ammo | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Weapons and ammo

Functions


get_weapon_ammo_count

int get_weapon_ammo_count(ObjectPtr weapon)
+             Weapons and ammo | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Weapons and ammo

Functions


get_weapon_ammo_count

int get_weapon_ammo_count(ObjectPtr weapon)
 

This also allows to get current charges of a misc item (Geiger counter, etc).


get_weapon_ammo_pid

int get_weapon_ammo_pid(ObjectPtr weapon)
 

set_weapon_ammo_count

void set_weapon_ammo_count(ObjectPtr weapon, int count)
 

This also allows to set current charges of a misc item (Geiger counter, etc).


set_weapon_ammo_pid

void set_weapon_ammo_pid(ObjectPtr weapon, int pid)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/windows-and-images/index.html b/windows-and-images/index.html index 3e77b80b..16bffd32 100644 --- a/windows-and-images/index.html +++ b/windows-and-images/index.html @@ -1,4 +1,4 @@ - Windows and images | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Windows and images

Functions


art_frame_data

sfall.h

array art_frame_data(string/int artFile/artId, int frame, int rotation)
+             Windows and images | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Windows and images

Functions


art_frame_data

sfall.h

array art_frame_data(string/int artFile/artId, int frame, int rotation)
 
  • returns the dimensions of a given PCX or FRM frame as a temp array in the form [width, height]
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format) optional arguments:
  • frame: frame number, the first frame starts from zero
  • rotation: rotation to get the frame for, useful when reading FRM files by path

create_win

sfall.h

void create_win(string winName, int x, int y, int width, int height, int flags)
 

flags argument is optional. Works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if the flags argument is not specified, and allows to set additional flags for the created window. MoveOnTop flag allows the created window to be placed on top of the game interface.


draw_image

sfall.h

void draw_image(string/int artFile/artId, int frame, int x, int y, bool noTransparent)
 
  • displays the specified PCX or FRM image in the active window created by vanilla CreateWin or sfall’s create_win script function
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format) optional arguments:
  • frame: frame number, the first frame starts from zero
  • x/y: offset relative to the top-left corner of the window
  • noTransparent: pass True to display an image without transparent background
  • NOTE: to omit optional arguments starting from the right, call the functions with different sfall_funcX (e.g. sfall_func4("draw_image", pathFile, frame, x, y))

draw_image_scaled

sfall.h

void draw_image_scaled(string/int artFile/artId, int frame, int x, int y, int width, int height)
@@ -19,4 +19,4 @@ optional arguments:
 - color1/color2: the color index in the game palette. `color1` sets the text color for the first line, and `color2` for all subsequent lines of text (default color is 145)
 

set_window_flag

sfall.h

void set_window_flag(string winName/int winID, int flag, bool value)
 

Changes the specified flag for the created script or game interface window.

  • winName: the window name, assigned to the window by the CreateWin/create_win function
  • winID: the ID number of the interface or script window obtained with the get_window_under_mouse function, or 0 for the current game interface
  • flag: the flag to change (see WIN_FLAG_* constants in define_extra.h)
  • value: True - set the flag, False - unset the flag

win_fill_color

int win_fill_color(int x, int y, int width, int height, int color)
-

Fills the rectangle area of the currently selected script window with the specified color, or clears the window with transparent (index 0) color (call the function without arguments).

  • color: the color index in the game palette (from 0 to 255)

This site uses Just the Docs, a documentation theme for Jekyll.
+

Fills the rectangle area of the currently selected script window with the specified color, or clears the window with transparent (index 0) color (call the function without arguments).

  • color: the color index in the game palette (from 0 to 255)

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/worldmap/index.html b/worldmap/index.html index feb40780..532b8c6f 100644 --- a/worldmap/index.html +++ b/worldmap/index.html @@ -1,4 +1,4 @@ - Worldmap | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Worldmap

The mapper manual lists the functions world_map_x_pos and world_map_y_pos, which supposedly return the player’s x and y positions on the world map. get_world_map_x/y_pos are included here anyway, because I was unable to get those original functions to work, or even to find any evidence that they existed in game.

Functions


get_world_map_x_pos

int get_world_map_x_pos()
+             Worldmap | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

Worldmap

The mapper manual lists the functions world_map_x_pos and world_map_y_pos, which supposedly return the player’s x and y positions on the world map. get_world_map_x/y_pos are included here anyway, because I was unable to get those original functions to work, or even to find any evidence that they existed in game.

Functions


get_world_map_x_pos

int get_world_map_x_pos()
 

get_world_map_y_pos

int get_world_map_y_pos()
 

set_world_map_pos

void set_world_map_pos(int x, int y)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.
diff --git a/write_xxx/index.html b/write_xxx/index.html index 894b7477..1cbf8f60 100644 --- a/write_xxx/index.html +++ b/write_xxx/index.html @@ -1,5 +1,5 @@ - write_xxx | sfall Skip to main content Link Menu Expand (external link) Document Search Copy Copied

write_xxx

These functions take a memory address as the parameter and can write to arbitrary pieces of Fallout’s address None of these functions will work unless AllowUnsafeScripting is enabled in ddraw.ini.

Functions


write_byte

UNSAFE

void write_byte(int address, int value)
+             write_xxx | sfall                        Skip to main content   Link      Menu      Expand       (external link)    Document      Search       Copy       Copied        

write_xxx

These functions take a memory address as the parameter and can write to arbitrary pieces of Fallout’s address None of these functions will work unless AllowUnsafeScripting is enabled in ddraw.ini.

Functions


write_byte

UNSAFE

void write_byte(int address, int value)
 

write_int

UNSAFE

void write_int(int address, int value)
 

write_short

UNSAFE

void write_short(int address, int value)
 

write_string

UNSAFE

void write_string(int address, string value)
-

This site uses Just the Docs, a documentation theme for Jekyll.
+

This site uses Just the Docs, a documentation theme for Jekyll.