mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Updated documents (mainly array functions)
This commit is contained in:
@@ -193,7 +193,7 @@ _*mixed means any type_
|
||||
#### `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
|
||||
- there are number of special negative values of "size" which perform various operations on the array, see macros `sort_array`, `sort_array_reverse`, `reverse_array`, `shuffle_array`, `sort_map_value`, and `sort_map_reverse` from **sfall.h** header
|
||||
|
||||
#### `void free_array(int arrayID)`
|
||||
- deletes any array
|
||||
@@ -208,17 +208,6 @@ _*mixed means any type_
|
||||
- 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
|
||||
- array ID is associated with given "key"
|
||||
@@ -230,6 +219,17 @@ _*mixed means any type_
|
||||
- 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
|
||||
|
||||
@@ -38,7 +38,7 @@ You can arbitrarily get the value of any argument using the `sfall_func1("get_sf
|
||||
#### `array get_sfall_args()`
|
||||
Returns all hook arguments as a new temp array.
|
||||
|
||||
#### `void set_sfall_return(int value)`
|
||||
#### `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.
|
||||
|
||||
#### `void set_sfall_arg(int argNum, int value)`
|
||||
|
||||
@@ -143,10 +143,10 @@ _^ - These functions require AllowUnsafeScripting to be enabled in ddraw.ini_
|
||||
0x8233 - `int temp_array(int element_count, int flags)`\
|
||||
0x8234 - `void fix_array(int array)`\
|
||||
0x8239 - `int scan_array(int array, int/float var)`\
|
||||
0x8256 - `int array_key(int array, int index)`\
|
||||
0x8257 - `int arrayexpr(any key, any value)`\
|
||||
0x8254 - `void save_array(any key, int array)`\
|
||||
0x8255 - `int load_array(any key)`
|
||||
0x8255 - `int load_array(any key)`\
|
||||
0x8256 - `int array_key(int array, int index)`\
|
||||
0x8257 - `int arrayexpr(any key, any value)`
|
||||
|
||||
0x81a0 - `void set_pickpocket_max(int percentage)`\
|
||||
0x81a1 - `void set_hit_chance_max(int percentage)`\
|
||||
@@ -212,7 +212,7 @@ _^ - These functions require AllowUnsafeScripting to be enabled in ddraw.ini_
|
||||
0x81e4 - `int get_sfall_arg()`\
|
||||
0x823c - `array get_sfall_args()`\
|
||||
0x823d - `void set_sfall_arg(int argnum, int value)`\
|
||||
0x81e5 - `void set_sfall_return(int value)`\
|
||||
0x81e5 - `void set_sfall_return(any value)`\
|
||||
0x81ea - `int init_hook()`
|
||||
|
||||
0x81e6 - `void set_unspent_ap_bonus(int multiplier)`\
|
||||
|
||||
@@ -143,10 +143,10 @@
|
||||
0x8233 - int temp_array(int element_count, int flags)
|
||||
0x8234 - void fix_array(int array)
|
||||
0x8239 - int scan_array(int array, int/float var)
|
||||
0x8256 - int array_key(int array, int index)
|
||||
0x8257 - int arrayexpr(any key, any value)
|
||||
0x8254 - void save_array(any key, int array)
|
||||
0x8255 - int load_array(any key)
|
||||
0x8256 - int array_key(int array, int index)
|
||||
0x8257 - int arrayexpr(any key, any value)
|
||||
|
||||
0x81a0 - void set_pickpocket_max(int percentage)
|
||||
0x81a1 - void set_hit_chance_max(int percentage)
|
||||
@@ -212,7 +212,7 @@
|
||||
0x81e4 - int get_sfall_arg()
|
||||
0x823c - array get_sfall_args()
|
||||
0x823d - void set_sfall_arg(int argnum, int value)
|
||||
0x81e5 - void set_sfall_return(int value)
|
||||
0x81e5 - void set_sfall_return(any value)
|
||||
0x81ea - int init_hook()
|
||||
|
||||
0x81e6 - void set_unspent_ap_bonus(int multiplier)
|
||||
|
||||
Reference in New Issue
Block a user