Added "string_format" script function

Some code refactoring.
This commit is contained in:
NovaRain
2019-12-01 12:09:58 +08:00
parent 84076a2586
commit 2a2849537c
11 changed files with 105 additions and 51 deletions
+7 -7
View File
@@ -707,29 +707,29 @@ CreditsAtBottom=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;To change the path and filename of the critical table file, uncomment the next line
;OverrideCriticalFile=CriticalOverrides.ini
;OverrideCriticalFile=sfall\CriticalOverrides.ini
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
;See the Stats.ini in the modders pack for an example file
;DerivedStats=Stats.ini
;DerivedStats=sfall\Stats.ini
;Allows you to edit the skill tables
;Point the next line to an ini file containing the replacement skill data
;SkillsFile=Skills.ini
;SkillsFile=sfall\Skills.ini
;To add additional perks to the game, uncomment the next line and set it to point to a file containing perk information
;PerksFile=Perks.ini
;PerksFile=sfall\Perks.ini
;To add additional books to the game, uncomment the next line and point to a file containing book information
;See the Books.ini in the modders pack for an example file
;BooksFile=Books.ini
;BooksFile=sfall\Books.ini
;Allows you to change some parameters for drugs and their addictions
;See the Drugs.ini in the modders pack for an example file
;DrugsFile=Drugs.ini
;DrugsFile=sfall\Drugs.ini
;Point to an ini file containing elevator data
;ElevatorsFile=Elevators.ini
;ElevatorsFile=sfall\Elevators.ini
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Scripts]
+1
View File
@@ -320,6 +320,7 @@
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define string_compare(str1, str2) sfall_func2("string_compare", str1, str2)
#define string_compare_locale(str1, str2, codePage) sfall_func3("string_compare", str1, str2, codePage)
#define string_format(format, a1, a2) sfall_func3("string_format", format, a1, a2)
#define tile_refresh_display sfall_func0("tile_refresh_display")
#define unjam_lock(obj) sfall_func1("unjam_lock", obj)
#define unset_unique_id(obj) sfall_func2("set_unique_id", obj, -1)
+5 -1
View File
@@ -262,7 +262,7 @@ Some utility/math functions are available:
- you can use this to search for a substring in a string like this: strlen(get_array(string_split(haystack, needle), 0))
> string substr(string, start, length)
- cuts a substring from a string starting at "start" up to "length" characters. The first character position starts with 0 (zero).
- cuts a substring from a string starting at "start" up to "length" characters. The first character position is 0 (zero).
- If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st").
- If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te").
- If length is zero - it will return a string from the starting position to the end of the string **New behavior** for sfall 4.2.2/3.8.22
@@ -682,6 +682,10 @@ optional argument:
- codePage: code page number to properly compare national characters in the range 128-255 of the ASCII code table
available encodings: 1250-1252, 866
> string sfall_func3("string_format", string format, any val1, any val2, ...)
- formats given value using standard syntax of C printf function (google "printf" for format details). However it is limited to formatting up to 4 values
- formatting is only supported for %s and %d. The format string is limited to 1024 characters
------------------------
------ MORE INFO -------
------------------------