diff --git a/array-functions/index.html b/array-functions/index.html index b9df69de..781c5994 100644 --- a/array-functions/index.html +++ b/array-functions/index.html @@ -1,14 +1,14 @@ 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.


arrayexpr

int arrayexpr(mixed key, mixed value)
-

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


create_array

int create_array(int size, int nothing)
-

Creates permanent array (but not “saved”).


fix_array

void fix_array(int arrayID)
+

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)
 

Changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames).


free_array

void free_array(int arrayID)
-

Deletes any array.


get_array

mixed get_array(int arrayID, mixed key)
-

Returns array value by key or index (shorthand: arrayID[key]).

  • If array with given arrayID doesn’t exist, returns 0.

len_array

int len_array(int arrayID)
-

Returns number of elements or key=>value pairs in a given array.


load_array

int load_array(mixed key)
-

Load array from savegame data by the same key provided in “save_array”.


resize_array

void resize_array(int arrayID, int size)
-

Changes array size.


save_array

void save_array(mixed key, int arrayID)
-

Array is saved (arrayID is associated with given “key”).


scan_array

mixed scan_array(int arrayID, mixed value)
-

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


set_array

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

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


temp_array

int temp_array(int size, int nothing)
-

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

+

Deletes any array.


get_array

mixed get_array(int arrayID, mixed key)
+

Returns array value by key or index (shorthand: arrayID[key]).


len_array

int len_array(int arrayID)
+

Returns number of elements or key=>value pairs in a given array.


load_array

int load_array(mixed key)
+

Loads array from savegame data by the same key provided in save_array.


resize_array

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.


save_array

void save_array(mixed key, int arrayID)
+

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


scan_array

mixed scan_array(int arrayID, mixed value)
+

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


set_array

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

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


temp_array

int temp_array(int size, int nothing)
+

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

diff --git a/arrays/index.html b/arrays/index.html index 344827a5..a279d6a8 100644 --- a/arrays/index.html +++ b/arrays/index.html @@ -64,4 +64,4 @@ // kaboom!!! end end -

Array operators reference

*mixed means any type

Backward compatibility notes

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


Table of contents

+

Array operators reference

*mixed means any type

Backward compatibility notes

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


Table of contents

diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js index 6e47159e..60b64197 100644 --- a/assets/js/just-the-docs.js +++ b/assets/js/just-the-docs.js @@ -473,6 +473,7 @@ function scrollNav() { if (targetLink) { const rect = targetLink.getBoundingClientRect(); document.getElementById('site-nav').scrollBy(0, rect.top - 3*rect.height); + targetLink.removeAttribute('href'); } } @@ -483,7 +484,6 @@ 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'))) { diff --git a/assets/js/search-data.json b/assets/js/search-data.json index c1093cff..476ef147 100644 --- a/assets/js/search-data.json +++ b/assets/js/search-data.json @@ -36,7 +36,7 @@ },"5": { "doc": "Array functions", "title": "Functions", - "content": ". | array_key | arrayexpr | create_array | fix_array | free_array | get_array | len_array | load_array | resize_array | save_array | scan_array | set_array | temp_array | . array_key . mixed array_key(int arrayID, int index) . Don’t use it directly; it is generated by the compiler in foreach loops. arrayexpr . int arrayexpr(mixed key, mixed value) . Don’t use it directly; it is used by compiler to create array expressions. create_array . int create_array(int size, int nothing) . Creates permanent array (but not “saved”). fix_array . void fix_array(int arrayID) . Changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames). free_array . void free_array(int arrayID) . Deletes any array. get_array . mixed get_array(int arrayID, mixed key) . Returns array value by key or index (shorthand: arrayID[key]). | If array with given arrayID doesn’t exist, returns 0. | . len_array . int len_array(int arrayID) . Returns number of elements or key=>value pairs in a given array. load_array . int load_array(mixed key) . Load array from savegame data by the same key provided in “save_array”. resize_array . void resize_array(int arrayID, int size) . Changes array size. save_array . void save_array(mixed key, int arrayID) . Array is saved (arrayID is associated with given “key”). scan_array . mixed scan_array(int arrayID, mixed value) . Searches for a first occurence of given value inside given array. set_array . void set_array(int arrayID, mixed key, mixed value) . Sets array value (shorthand: arrayID[key] := value). temp_array . int temp_array(int size, int nothing) . Works exactly like “create_array”, only created array becomes “temporary.” . ", + "content": ". | array_key | arrayexpr | create_array | fix_array | free_array | get_array | len_array | load_array | resize_array | save_array | scan_array | set_array | temp_array | . 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) . Changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames). free_array . void free_array(int arrayID) . Deletes any array. | if array was “saved”, it will be removed from a savegame. | . get_array . mixed get_array(int arrayID, mixed key) . Returns array value by key or index (shorthand: arrayID[key]). | if key doesn’t exist or index is not in valid range, returns 0. | . len_array . 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). | . load_array . 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. | . resize_array . 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. save_array . void save_array(mixed key, int arrayID) . 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”. ", "url": "/sfall/array-functions/#functions", "relUrl": "/array-functions/#functions" @@ -78,7 +78,7 @@ },"11": { "doc": "Arrays", "title": "Array operators reference", - "content": "*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) | . | 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 | . | 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 | . | . ", + "content": "*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 | . | . ", "url": "/sfall/arrays/#array-operators-reference", "relUrl": "/arrays/#array-operators-reference" @@ -309,7 +309,7 @@ },"44": { "doc": "Hook functions", "title": "Functions", - "content": ". | get_sfall_arg | get_sfall_arg_at | get_sfall_args | init_hook | register_hook | register_hook_proc | register_hook_proc_spec | set_sfall_arg | set_sfall_return | . 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() . The hook script equivalent of game_loaded; it returns 1 when the script is loaded for the first time or when the player reloads the game, and 0 otherwise. register_hook . void register_hook(int hookID) . Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, start procedure will be executed in current global script. You can use all above functions like normal. register_hook_proc . void register_hook_proc(int hookID, proc procedure) . The same as register_hook, except that you specifically define which procedure in the current script should be called as a hook (instead of “start” by default). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script with no conflicts) and flexibility. You can place all related hook scripts for a specific mod in one global script! . Use zero (0) as second argument to unregister hook script from current global script. NOTE: you can hook several scripts to a single hook point, for example if it’s different mods from different authors or just some different aspects of one larger mod. When one of the scripts in a chain returns value with set_sfall_return, the next script may override this value if calls set_sfall_return again. Example: Sometimes you need to multiply certain value in a chain of hook scripts. Let’s say we have a Mod A which reduces all “to hit” chances by 50%. The code might look like this: . original_chance = get_sfall_arg; set_sfall_return(original_chance / 2); . Mod B also want to affect hit chances globally, by increasing them by 50%. Now in order for both mods to work well together, we need to add this line to Mod A hook script: . set_sfall_arg(0, (original_chance / 2)); . This basically changes hook argument for the next script. Mod B code: . original_chance = get_sfall_arg; set_sfall_return(original_chance * 1.5); set_sfall_arg(0, (original_chance * 1.5)); . 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(int 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. ", + "content": ". | get_sfall_arg | get_sfall_arg_at | get_sfall_args | init_hook | register_hook | register_hook_proc | register_hook_proc_spec | set_sfall_arg | set_sfall_return | . 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() . The hook script equivalent of game_loaded; it returns 1 when the script is loaded for the first time or when the player reloads the game, and 0 otherwise. register_hook . void register_hook(int hookID) . Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, start procedure will be executed in current global script. You can use all above functions like normal. register_hook_proc . void register_hook_proc(int hookID, proc procedure) . The same as register_hook, except that you specifically define which procedure in the current script should be called as a hook (instead of “start” by default). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script with no conflicts) and flexibility. You can place all related hook scripts for a specific mod in one global script! . Use zero (0) as second argument to unregister hook script from current global script. NOTE: you can hook several scripts to a single hook point, for example if it’s different mods from different authors or just some different aspects of one larger mod. When one of the scripts in a chain returns value with set_sfall_return, the next script may override this value if calls set_sfall_return again. Example: Sometimes you need to multiply certain value in a chain of hook scripts. Let’s say we have a Mod A which reduces all “to hit” chances by 50%. The code might look like this: . original_chance = get_sfall_arg; set_sfall_return(original_chance / 2); . Mod B also want to affect hit chances globally, by increasing them by 50%. Now in order for both mods to work well together, we need to add this line to Mod A hook script: . set_sfall_arg(0, (original_chance / 2)); . This basically changes hook argument for the next script. Mod B code: . original_chance = get_sfall_arg; set_sfall_return(original_chance * 1.5); set_sfall_arg(0, (original_chance * 1.5)); . 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. ", "url": "/sfall/hook-functions/#functions", "relUrl": "/hook-functions/#functions" @@ -757,7 +757,7 @@ },"108": { "doc": "Lists", "title": "Lists", - "content": "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. ", + "content": "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. ", "url": "/sfall/lists/", "relUrl": "/lists/" diff --git a/combat/index.html b/combat/index.html index d1a83f48..0c0ac1fb 100644 --- a/combat/index.html +++ b/combat/index.html @@ -1,7 +1,7 @@ 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)
+
  • 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)
 

Allows overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) stops a weapon from making aimed shots even if it normally coulld. Affects player and NPCs alike. The list of edited weapons is not saved over game loads, so you need to call the function once at each reload. Use a pid of 0 to represent unarmed.


force_aimed_shots

void force_aimed_shots(int pid)
 

Allows overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) Will allow a weapon to make aimed shots even if it normally couldn’t. Affects player and NPCs alike. Does not override the effects of the fast shot trait. The list of edited weapons is not saved over game loads, so you need to call the function once at each reload. Use a pid of 0 to represent unarmed.


get_attack_type

int get_attack_type
 

get_bodypart_hit_modifier

int get_bodypart_hit_modifier(int bodypart)
diff --git a/feed.xml b/feed.xml
index f9a6d0a2..fe93c501 100644
--- a/feed.xml
+++ b/feed.xml
@@ -1 +1 @@
-Jekyll2023-10-07T13:16:15+00:00/sfall/feed.xmlsfallSfall documentation
\ No newline at end of file
+Jekyll2023-10-16T03:36:00+00:00/sfall/feed.xmlsfallSfall documentation
\ No newline at end of file
diff --git a/graphics/index.html b/graphics/index.html
index ed89210e..f245eb80 100644
--- a/graphics/index.html
+++ b/graphics/index.html
@@ -12,6 +12,6 @@
 

set_shader_float

void set_shader_float(int ID, string param, float value)
 

set_shader_int

void set_shader_int(int ID, string param, int value)
 

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)
+

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)
 
diff --git a/hook-functions/index.html b/hook-functions/index.html index 4358033b..cb0665d9 100644 --- a/hook-functions/index.html +++ b/hook-functions/index.html @@ -10,7 +10,7 @@

This basically changes hook argument for the next script. Mod B code:

original_chance = get_sfall_arg;
 set_sfall_return(original_chance * 1.5);
 set_sfall_arg(0, (original_chance * 1.5));
-

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)
+

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(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.

diff --git a/lists/index.html b/lists/index.html index c58152e1..2646451d 100644 --- a/lists/index.html +++ b/lists/index.html @@ -1,4 +1,4 @@ - 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)
diff --git a/main-interface/index.html b/main-interface/index.html
index d012c0a5..758d2e52 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()
 

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()
+

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.

diff --git a/maps-and-encounters/index.html b/maps-and-encounters/index.html index 278f020a..50eebfaf 100644 --- a/maps-and-encounters/index.html +++ b/maps-and-encounters/index.html @@ -1,7 +1,7 @@ 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()
+

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()
 

Returns an array of the player’s position data (index: 0 - tile, 1 - elevation, 2 - rotation) when entering the map through exit grids. If entering from the world map, the tile value will be -1. Should be called in map_enter_p_proc procedure to get the correct position data.


get_terrain_name

sfall.h

string sfall_func2("get_terrain_name", int x, int y)
 

Returns the terrain type name for the sub-tile on the world map by the specified coordinates, or by the player’s current position if called without arguments.


in_world_map

bool in_world_map
 

Returns 1 if the player is looking at the world map, or 0 at any other time. Obviously this is only useful in global scripts, since normal scripts will never get the chance to run on the world map.


set_map_enter_position

void set_map_enter_position(int tile, int elevation, int rotation)
diff --git a/objects-and-scripts/index.html b/objects-and-scripts/index.html
index 7adeeccc..73b0883f 100644
--- a/objects-and-scripts/index.html
+++ b/objects-and-scripts/index.html
@@ -1,7 +1,7 @@
              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)
+

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)
 
  • accepts a pointer to an object and returns its scriptID (line number in scripts.lst), or 0 if the object is unscripted.
  • returns -1 on argument error.

loot_obj

sfall.h

ObjectPtr loot_obj()
 

Returns a pointer to the target object (container or critter) of the loot screen.


obj_is_carrying_obj

int (ObjectPtr invenObj, ObjectPtr itemObj)
 

Returns number of itemObj inside invenObj’s inventory, note that both arguments are object pointers. useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID.)


obj_is_openable

sfall.h

bool obj_is_openable(object obj)
diff --git a/other/index.html b/other/index.html
index 6c725df4..16c77514 100644
--- a/other/index.html
+++ b/other/index.html
@@ -22,7 +22,7 @@
 

Takes a party member PID or an NPC name (deprecated, for compatibility with sfall 4.1.5/3.8.15 or earlier) as an argument. The NPC must be in your party. This function ignores player level requirements and the minimum 3 player level delay between NPC level gains. It also ignores the random element, regardless of sfall’s NPCAutoLevel setting.


input_funcs_available

int input_funcs_available()
 

The input functions are only available if the user has the input hook turned on in ddraw.ini. Use input_funcs_available to check.


mark_movie_played

void mark_movie_played(int id)
 

message_str_game

string message_str_game(int fileId, int messageId)
-

Works exactly the same as message_str, except you get messages from files in text/english/game folder. Use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file

  • Additional game msg files added by ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000 to 0x2FFF. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.).
  • If a file has a specific number assigned in ExtraGameMsgFileList, its fileId will be (0x2000 + assigned number). (e.g. with ExtraGameMsgFileList=foo,bar:2,foobar in ddraw.ini, bar.msg will be associated with 0x2002 and foobar.msg with 0x2003.)

mod_kill_counter

void mod_kill_counter(int critterType, int amount)
+

Works exactly the same as message_str, except you get messages from files in text/english/game folder. Use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file

  • Additional game msg files added by ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000 to 0x2FFF. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.).
  • If a file has a specific number assigned in ExtraGameMsgFileList, its fileId will be (0x2000 + assigned number). (e.g. with ExtraGameMsgFileList=foo,bar:2,foobar in ddraw.ini, bar.msg will be associated with 0x2002 and foobar.msg with 0x2003.)

mod_kill_counter

void mod_kill_counter(int critterType, int amount)
 

nb_create_char

int nb_create_char()
 

nb_* functions are reserved for the brotherhood tactical training mod, and should be avoided. Not implemented, always returns 0.


resume_game

void resume_game()
 

set_base_hit_chance_mod

void set_base_hit_chance_mod(int max, int mod)
@@ -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)

+

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)

diff --git a/outline/index.html b/outline/index.html index a2bec597..1b3a0fc5 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)
 

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
+
  • 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
diff --git a/sfall-funcx-macros/index.html b/sfall-funcx-macros/index.html index 3dcc08a5..d00302eb 100644 --- a/sfall-funcx-macros/index.html +++ b/sfall-funcx-macros/index.html @@ -4,15 +4,15 @@

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)
 

Returns the current inventory size of the container or the critter.


get_metarule_table

sfall.h

array get_metarule_table
 

Returns names of all currently available script functions.


get_object_ai_data

sfall.h

int get_object_ai_data(ObjectPtr object, int aiParam)
-

Returns the setting value from the AI packet of an object (critter). Use AI_CAP_* constants from define_extra.h for the aiParam argument to get AI value.


get_text_width

sfall.h

int get_text_width(string text)
+

Returns the setting value from the AI packet of an object (critter). Use AI_CAP_* constants from define_extra.h for the aiParam argument to get AI value.


get_text_width

sfall.h

int get_text_width(string text)
 

Returns the text width in pixels for the currently set font.


item_weight

sfall.h

int item_weight(ObjectPtr obj)
 

Gets the current weight of an object.


metarule_exist

sfall.h

bool metarule_exist(string metaruleName)
 

Returns True if the specified name of metarule (sfall_funcX) function exists in the current version of sfall.


npc_engine_level_up

sfall.h

void npc_engine_level_up(bool toggle)
 

Enables/disables the engine function that increases the level of party members in the player leveling process. If the engine function is disabled, the process of leveling up party members should be performed by script functions.


objects_in_radius

sfall.h

objects_in_radius", int tile, int radius, int elevation, int type)
-
  • returns an array of objects of a type (see OBJ_TYPE_* constants in define_extra.h) within the specified radius from the given tile
  • passing -1 to the type argument or not specifying it will return all objects within the radius
  • the radius is limited to 50 hexes

set_drugs_data

sfall.h

void set_drugs_data(int type, int pid, int value)
+
  • returns an array of objects of a type (see OBJ_TYPE_* constants in define_extra.h) within the specified radius from the given tile
  • passing -1 to the type argument or not specifying it will return all objects within the radius
  • the radius is limited to 50 hexes

set_drugs_data

sfall.h

void set_drugs_data(int type, int pid, int value)
 

Overrides the parameters of drugs set in the configuration file (DrugsFile setting in ddraw.ini). Type: 0 - changes the value of NumEffects for the drug (see Drugs.ini for the description of NumEffects), 1 - changes the duration of the addiction effect for the drug (a value of 1 = one game minute).


set_rest_heal_time

sfall.h

void set_rest_heal_time(int time)
 

Sets the time interval in minutes for healing during resting. The default is 180. Note: The interval will be reset each time the player reloads the game.


set_rest_mode

sfall.h

void set_rest_mode(int flags)
-

Sets the bit flags for the rest mode (see RESTMODE_* constants in sfall.h). Passing 0 will reset the rest mode. It will also be reset each time the player reloads the game.


sfall_func0(“hide_window”)

sfall.h

void sfall_func0("hide_window")
+

Sets the bit flags for the rest mode (see RESTMODE_* constants in sfall.h). Passing 0 will reset the rest mode. It will also be reset each time the player reloads the game.


sfall_func0(“hide_window”)

sfall.h

void sfall_func0("hide_window")
 

Hides currently active (selected) script window.


sfall_func0(“show_window”)

sfall.h

void sfall_func0("show_window")
 

Displays the script window previously hidden with the sfall_func0("hide_window") function.


sfall_func1(“hide_window”, string winName)

sfall.h

void sfall_func0("hide_window")
 

Hides the specified script window.

  • winName: the window name, assigned to the window by the CreateWin/create_win function

sfall_func1(“remove_timer_event”, int fixedParam)

sfall.h

void sfall_func1("remove_timer_event", int fixedParam)
diff --git a/tiles-and-paths/index.html b/tiles-and-paths/index.html
index ecebbccb..567e35bd 100644
--- a/tiles-and-paths/index.html
+++ b/tiles-and-paths/index.html
@@ -2,7 +2,7 @@
 
  • 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)
-

Returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h). If path is clear (no blocker was encountered by selected function) - returns 0. objFrom is always excluded from calculations, but is required to be a valid object.


obj_blocking_tile

ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType)
+

Returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h). If path is clear (no blocker was encountered by selected function) - returns 0. objFrom is always excluded from calculations, but is required to be a valid object.


obj_blocking_tile

ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType)
 

Returns first object blocking given tile using given blocking function or 0 if tile is clear.


path_find_to

array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType)
 

Returns the shortest path to a given tile using given blocking function as an array of tile directions (0..5) to move on each step. Array length equals to a number of steps. Empty array means that specified target cannot be reached.


tile_by_position

sfall.h

int tile_by_position(int x, int y)
 
  • returns the tile number at the x, y position relative to the top-left corner of the screen
  • if the position is outside of the range of tiles, it will return -1

tile_get_objs

array tile_get_objs(int tileNum, int elevation)
diff --git a/windows-and-images/index.html b/windows-and-images/index.html
index 60114fa0..dfdaf9d5 100644
--- a/windows-and-images/index.html
+++ b/windows-and-images/index.html
@@ -2,12 +2,12 @@
 

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)
 
  • 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
  • width/height: the new width/height to scale the image to. Pass -1 to either width or height to keep the aspect ratio when scaling
  • 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))
  • if called without x/y/width/height arguments, the image will be scaled to fit the window without transparent background

get_window_attribute

int sfall_func1("get_window_attribute", int winType)
-

Alternative form: int sfall_func2("get_window_attribute", int winType, int attrType) Returns the attribute of the specified interface window by the attrType argument.

  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • attrType: 0 - checks and returns a value of 1 if the specified interface window is created by the game (same as without the argument) 1 - X position, 2 - Y position (relative to the top-left corner of the game screen) 3 - interface width size, 4 - interface height size -1 - returns an associative array of keys (left, top, right, bottom) and values that define the position of the window rectangle (use standard syntax to access array values, e.g. winRect.top, winRect.bottom)
  • returns -1 if the specified attribute cannot be obtained

get_window_under_mouse

int get_window_under_mouse()
+

Alternative form: int sfall_func2("get_window_attribute", int winType, int attrType) Returns the attribute of the specified interface window by the attrType argument.

  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • attrType: 0 - checks and returns a value of 1 if the specified interface window is created by the game (same as without the argument) 1 - X position, 2 - Y position (relative to the top-left corner of the game screen) 3 - interface width size, 4 - interface height size -1 - returns an associative array of keys (left, top, right, bottom) and values that define the position of the window rectangle (use standard syntax to access array values, e.g. winRect.top, winRect.bottom)
  • returns -1 if the specified attribute cannot be obtained

get_window_under_mouse

int get_window_under_mouse()
 

interface_art_draw

int sfall_func4("interface_art_draw", int winType, string artFile/int artID, int x, int y)
 
int sfall_func4("interface_art_draw", int winType, string artFile/int artID, int x, int y)
 int sfall_func5("interface_art_draw", int winType, string artFile/int artID, int x, int y, int frame)
 int sfall_func6("interface_art_draw", int winType, string artFile/int artID, int x, int y, int frame, array param)
-
  • draws the specified PCX or FRM image in the game interface window, returns -1 on any error
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h) this also takes the value of the flag (0x1000000) to prevent immediate redrawing of the interface window
  • 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)
  • x/y: offset relative to the top-left corner of the window

optional arguments:

  • frame: frame number, the first frame starts from zero
  • param: an array which specifies additional parameters, where: index 0 - sprite direction for multi-directional FRM index 1/index 2 - the new width/height to scale the image to. Pass -1 to use the original width/height

interface_print

int sfall_func5("interface_print", string text, int winType, int x, int y, int color)
+
  • draws the specified PCX or FRM image in the game interface window, returns -1 on any error
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h) this also takes the value of the flag (0x1000000) to prevent immediate redrawing of the interface window
  • 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)
  • x/y: offset relative to the top-left corner of the window

optional arguments:

  • frame: frame number, the first frame starts from zero
  • param: an array which specifies additional parameters, where: index 0 - sprite direction for multi-directional FRM index 1/index 2 - the new width/height to scale the image to. Pass -1 to use the original width/height

interface_print

int sfall_func5("interface_print", string text, int winType, int x, int y, int color)
 
int sfall_func5("interface_print", string text, int winType, int x, int y, int color)
 int sfall_func6("interface_print", string text, int winType, int x, int y, int color, int width)
 
  • displays the text in the specified interface window with the current font. Use vanilla SetFont function to set the font
  • returns the count of lines printed, or -1 on any error
  • text: the text to be printed. Use the \n control character to move text to a new line (example: “Hello\nWorld!”)
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • x/y: offset relative to the top-left corner of the window
  • color: the color index in the game palette. Pass 0 if the text color was previously set by vanilla SetTextColor function It can also take additional flags (via bwor) for displaying text:
    • 0x0010000 - adds a shadow to the text, the ‘textshadow’ compiler constant
    • 0x1000000 - prevents immediate redrawing of the interface window, the textdirect compiler constant (works the other way around)
    • 0x2000000 - fills the background of the text with black color, the textnofill compiler constant (works the other way around)
  • width (optional): the maximum width of the text. The text will be wrapped to fit within the specified width

message_box

int sfall_func4("message_box", string message, int flags, int color1, int color2)
@@ -16,6 +16,6 @@ optional arguments:
 - flags: mode flags (see `MSGBOX_*` constants in define_extra.h). Pass -1 to skip setting the flags (default flags are NORMAL and YESNO)
 - 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)
 

nterface_overlay

sfall_func2("interface_overlay", int winType, int mode)
-

Alternative form: int sfall_func6("interface_overlay", int winType, 2, int x, int y, int width, int height).

Creates an additional drawing surface above the graphic layer of the specified interface window. All subsequent calls of interface_art_draw and interface_print functions will draw on it.

  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • mode: 1 - creates a new overlay surface 2 - clears the overlay area or the specified rectangle defined by the x, y, width, height arguments 0 - destroys the created overlay surface (frees up the memory allocated to the surface)

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)
+

Alternative form: int sfall_func6("interface_overlay", int winType, 2, int x, int y, int width, int height).

Creates an additional drawing surface above the graphic layer of the specified interface window. All subsequent calls of interface_art_draw and interface_print functions will draw on it.

  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • mode: 1 - creates a new overlay surface 2 - clears the overlay area or the specified rectangle defined by the x, y, width, height arguments 0 - destroys the created overlay surface (frees up the memory allocated to the surface)

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)