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.
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.
voidreg_anim_animate_and_hide(ObjectPtr,intanimID,intdelay)
+ Animations | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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.
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.
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" - 2list:=["A","B","C"];
diff --git a/art-and-appearance/index.html b/art-and-appearance/index.html
index ff40c033..3141c088 100644
--- a/art-and-appearance/index.html
+++ b/art-and-appearance/index.html
@@ -1,4 +1,4 @@
- Art and appearance | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
Clears the cache of FRM image files loaded into memory.
art_exists
intart_exists(intartFID)
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
voidrefresh_pc_art
set_hero_race
voidset_hero_race(intstyle)
diff --git a/assets/css/just-the-docs-dark.css b/assets/css/just-the-docs-dark.css
index a3e9e5f0..d5021ac4 100644
--- a/assets/css/just-the-docs-dark.css
+++ b/assets/css/just-the-docs-dark.css
@@ -375,7 +375,7 @@ template { display: none; }
html { font-size: 0.875rem !important; scroll-behavior: smooth; }
@media (min-width: 31.25rem) { html { font-size: 1rem !important; } }
-body { font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif; font-size: inherit; line-height: 1.4; color: #e6e1e8; background-color: #27262b; overflow-wrap: break-word; }
+body { font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif, "Segoe UI Emoji"; font-size: inherit; line-height: 1.4; color: #e6e1e8; background-color: #27262b; overflow-wrap: break-word; }
ol, ul, dl, pre, address, blockquote, table, div, hr, form, fieldset, noscript .table-wrapper { margin-top: 0; }
diff --git a/assets/css/just-the-docs-default.css b/assets/css/just-the-docs-default.css
index c7a03ce7..3ff10812 100644
--- a/assets/css/just-the-docs-default.css
+++ b/assets/css/just-the-docs-default.css
@@ -255,7 +255,7 @@ template { display: none; }
html { font-size: 0.875rem !important; scroll-behavior: smooth; }
@media (min-width: 31.25rem) { html { font-size: 1rem !important; } }
-body { font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif; font-size: inherit; line-height: 1.4; color: #5c5962; background-color: #fff; overflow-wrap: break-word; }
+body { font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif, "Segoe UI Emoji"; font-size: inherit; line-height: 1.4; color: #5c5962; background-color: #fff; overflow-wrap: break-word; }
ol, ul, dl, pre, address, blockquote, table, div, hr, form, fieldset, noscript .table-wrapper { margin-top: 0; }
diff --git a/assets/css/just-the-docs-light.css b/assets/css/just-the-docs-light.css
index 7d659553..342d4103 100644
--- a/assets/css/just-the-docs-light.css
+++ b/assets/css/just-the-docs-light.css
@@ -247,7 +247,7 @@ template { display: none; }
html { font-size: 0.875rem !important; scroll-behavior: smooth; }
@media (min-width: 31.25rem) { html { font-size: 1rem !important; } }
-body { font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif; font-size: inherit; line-height: 1.4; color: #5c5962; background-color: #fff; overflow-wrap: break-word; }
+body { font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif, "Segoe UI Emoji"; font-size: inherit; line-height: 1.4; color: #5c5962; background-color: #fff; overflow-wrap: break-word; }
ol, ul, dl, pre, address, blockquote, table, div, hr, form, fieldset, noscript .table-wrapper { margin-top: 0; }
diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js
index a438bdcf..3ee149d6 100644
--- a/assets/js/just-the-docs.js
+++ b/assets/js/just-the-docs.js
@@ -29,10 +29,7 @@ function initNav() {
}
if (target) {
e.preventDefault();
- const active = target.parentNode.classList.toggle('active');
- const passive = target.parentNode.classList.toggle('passive');
- if (active && passive) target.parentNode.classList.toggle('passive');
- target.ariaPressed = active;
+ target.ariaPressed = target.parentNode.classList.toggle('active');
}
});
@@ -62,7 +59,9 @@ function initNav() {
// The page-specific stylesheet is assumed to have index 1 in the list of stylesheets.
function disableHeadStyleSheet() {
- document.styleSheets[1].disabled = true;
+ if (document.styleSheets[1]) {
+ document.styleSheets[1].disabled = true;
+ }
}
// Site search
@@ -472,13 +471,13 @@ function scrollNav() {
}
// Find the nav-list-link that refers to the current page
-// then make it and all enclosing nav-list-item elements active,
-// and make all other folded collections passive
+// then make it and all enclosing nav-list-item elements active.
function activateNav() {
var target = navLink();
if (target) {
target.classList.toggle('active', true);
+ target.removeAttribute('href');
}
while (target) {
while (target && !(target.classList && target.classList.contains('nav-list-item'))) {
@@ -489,17 +488,6 @@ function activateNav() {
target = target.parentNode;
}
}
- const elements = document.getElementsByClassName("nav-category-list");
- for (const element of elements) {
- const item = element.children[0];
- const active = item.classList.toggle('active');
- if (active) {
- item.classList.toggle('active', false);
- item.classList.toggle('passive', true);
- } else {
- item.classList.toggle('active', true);
- }
- }
}
// Document ready
diff --git a/assets/js/search-data.json b/assets/js/search-data.json
index ba8ef9b2..d65b4a38 100644
--- a/assets/js/search-data.json
+++ b/assets/js/search-data.json
@@ -372,7 +372,7 @@
},"53": {
"doc": "Hook types",
"title": "CalcAPCost",
- "content": "HOOK_CALCAPCOST (hs_calcapcost.int) . Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn’t run for using other item types or moving. Note that the first time a game is loaded, this script doesn’t run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player’s hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn. You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj. Critter arg0 - The critter performing the action int arg1 - Attack Type (see ATKTYPE_* constants) int arg2 - Is aimed attack (1 or 0) int arg3 - The default AP cost Item arg4 - The weapon for which the cost is calculated. If it is 0, the pointer to the weapon can still be obtained by the aforementioned method int ret0 - The new AP cost . ",
+ "content": "HOOK_CALCAPCOST (hs_calcapcost.int) . Runs whenever Fallout calculates the AP cost of using an active item in hand (or unarmed attack). Doesn’t run for moving. Note that the first time a game is loaded, this script doesn’t run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player’s hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn. You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj. Critter arg0 - The critter performing the action int arg1 - Attack Type (see ATKTYPE_* constants) int arg2 - Is aimed attack (1 or 0) int arg3 - The default AP cost Item arg4 - The weapon for which the cost is calculated. If it is 0, the pointer to the weapon can still be obtained by the aforementioned method int ret0 - The new AP cost . ",
"url": "/sfall/hook-types/#calcapcost",
"relUrl": "/hook-types/#calcapcost"
diff --git a/audio/index.html b/audio/index.html
index f1c05049..b0a84ddd 100644
--- a/audio/index.html
+++ b/audio/index.html
@@ -1,4 +1,4 @@
- Audio | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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
voidset_eax_environment(intenvironment)
Obsolete since sfall 2.1a. Has no effect.
stop_sfall_sound
voidstop_sfall_sound(intsoundID)
diff --git a/best-practices/index.html b/best-practices/index.html
index f7c0cf13..976b7c7b 100644
--- a/best-practices/index.html
+++ b/best-practices/index.html
@@ -1,4 +1,4 @@
- Best practices | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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.
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.
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:
#defineNAME"gl_a_myscript"
+ Best practices | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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.
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.
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:
#defineNAME"gl_a_myscript"#definendebug(message)debug_msg(NAME+": "+message+"\n")procedurestartbegin
diff --git a/call_offset_vx/index.html b/call_offset_vx/index.html
index 6f2e5440..c241d3ed 100644
--- a/call_offset_vx/index.html
+++ b/call_offset_vx/index.html
@@ -1,4 +1,4 @@
- call_offset_vX | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 unlessAllowUnsafeScriptingis enabled inddraw.ini.
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 unlessAllowUnsafeScriptingis enabled inddraw.ini.
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
voidset_car_current_town(inttown)
Changes the current town index for the player’s car.
set_car_intface_art
sfall.h
voidset_car_intface_art(intartIndex)
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
diff --git a/combat/index.html b/combat/index.html
index 96432ba3..cda84aee 100644
--- a/combat/index.html
+++ b/combat/index.html
@@ -1,4 +1,4 @@
- Combat | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
Returns 1 if the aimed attack mode is selected, 0 otherwise.
block_combat
voidblock_combat(boolvalue)
Deny the player to enter combat mode.
combat_data
mixedcombat_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
voiddisable_aimed_shots(intpid)
diff --git a/cursor/index.html b/cursor/index.html
index 7d70d6bf..38c59be4 100644
--- a/cursor/index.html
+++ b/cursor/index.html
@@ -1,3 +1,3 @@
- Cursor | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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
intmetarule2_explosions(intarg1,intarg2)
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
voidset_attack_explosion_art(x,y)
diff --git a/feed.xml b/feed.xml
index e3db738f..42a5f988 100644
--- a/feed.xml
+++ b/feed.xml
@@ -1 +1 @@
-Jekyll2023-08-25T17:40:11+00:00/sfall/feed.xmlsfallSfall documentation
\ No newline at end of file
+Jekyll2023-09-30T09:20:09+00:00/sfall/feed.xmlsfallSfall documentation
\ No newline at end of file
diff --git a/funcx/index.html b/funcx/index.html
index 9a9f7da9..5c3da149 100644
--- a/funcx/index.html
+++ b/funcx/index.html
@@ -1,4 +1,4 @@
- funcX | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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
voidset_global_script_type(inttype)
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.
diff --git a/global-scripts/index.html b/global-scripts/index.html
index c79a7518..d667ae41 100644
--- a/global-scripts/index.html
+++ b/global-scripts/index.html
@@ -1 +1 @@
- Global scripts | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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. [Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.] - Obsolete.
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.
+ Global scripts | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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. [Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.] - Obsolete.
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.
diff --git a/global-variables/index.html b/global-variables/index.html
index 1390d295..9ddef32d 100644
--- a/global-variables/index.html
+++ b/global-variables/index.html
@@ -1,4 +1,4 @@
- Global variables | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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.
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.
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.
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.
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
mixedget_sfall_arg_at(intargNum)
Gets the value of hook argument with the specified argument number (first argument of hook starts from 0)
get_sfall_args
intget_sfall_args()
Returns all hook arguments as a new temp array.
init_hook
intinit_hook()
diff --git a/hook-types/index.html b/hook-types/index.html
index cf2c9511..09c0b761 100644
--- a/hook-types/index.html
+++ b/hook-types/index.html
@@ -1,4 +1,4 @@
- Hook types | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied