Updated documents for the removal of ArraysBehavior option

Some other minor edits to documents.
This commit is contained in:
NovaRain
2022-01-12 09:40:18 +08:00
parent 5493ed38d3
commit 7c0adc558a
10 changed files with 36 additions and 39 deletions
+3 -6
View File
@@ -51,7 +51,7 @@ Both array types have their pros and cons and are suited for different tasks.
## Arrays syntax
Basically arrays are implemented using number of new operators (scripting functions). But for ease of use, there are some new syntax elements:
Basically arrays are implemented using number of new operators (script functions). But for ease of use, there are some new syntax elements:
* Accessing elements. Use square brackets:
```js
@@ -238,12 +238,9 @@ _*mixed means any type_
For those who used arrays in their mods before sfall 3.4:
* There is an INI parameter **arraysBehavior** in **Misc** section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that `create_array` will create permanent arrays which are "saved" by default and their ID is also permanent. It is 1 by default.
* Previously `create_array` would create permanent arrays which were "saved" by default and their IDs were also permanent. Now permanent arrays from `create_array` are not "saved" by default anymore. Make sure to review your scripts if you need to save arrays into savegames.
* If `arraysBehaviour=0`:
Arrays are created and manipulated with the `xxx_array` functions. An array must first be created with `create_array` or `temp_array`, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The id returned by `create/temp_array` can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call `create_array` from one script, and then use the returned id from another script.) They are also saved across savegames. Arrays created with `temp_array` will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad id or trying to access out of range elements will not crash the script. `create_array` is the only function that returns a permanent array, all other functions which return arrays (`string_split`, `list_as_array` etc,) all return temp arrays. You can use `fix_array` to make a temp array permanent.
* How savegame compatibility is handled?<br>
* How savegame compatibility is handled?\
Saved arrays are stored in **sfallgv.sav** file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), game shouldn't crash, but all arrays will be lost.
* Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays.
+2 -2
View File
@@ -11,7 +11,7 @@ nav_order: 4
* TOC
{: toc}
This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional scripting functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.
This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional script functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.
Unlike the original script compiler, this has not been compiled as a dos program. When using this in place of the original compile.exe but still using p.bat, you need to either get rid of the dos4gw.exe reference from p.bat or replace the original dos4gw.exe with the one in this archive.
@@ -19,7 +19,7 @@ If you use fallout script editor, you can extract `compile.exe` and `dos4gw.exe`
When compiling global or hook scripts for sfall 3.4 or below, you _must_ include the line `procedure start;` before any `#include`s that define procedures to avoid a few weird problems. (this is no longer required starting from 3.5)
This version of compiler was designed primarily for new sfall functions, but it can safely (and is recommended) to be used with non-sfall scripts as well, as long as you don't use any of the arrays syntax and any sfall scripting functions.
This version of compiler was designed primarily for new sfall functions, but it can safely (and is recommended) to be used with non-sfall scripts as well, as long as you don't use any of the arrays syntax and any sfall script functions.
The original unmodified sslc source is over here: [http://www.teamx.ru/eng/files/srcs/index.shtml](http://www.teamx.ru/eng/files/srcs/index.shtml).