String functions:
isabbrev
isname
isstring
mobgetid
objidexists
random_coloring
replace
str_split
strlen
substr
valid
isabbrev
returnss 1 if str1 is an abbreviation of str2
Syntax:
(int) isabbrev(string str1, string str2)
Examples:
let tok = isabbrev("lis", "list") - returns 1
isname
provides direct access to isname call that is at the heart of many alias-based
searching (get_obj_in_list_vis etc...)
*
Syntax:
(int) isname(string searchstring, string namelist)
Examples:
let withraw = isname("silvertail_ho", objalias(82326))
isstring
test if variable is string
Syntax:
(int) isstring(variable)
mobgetid
returns unique mob id in format XXXXXXXX-XXXXXXXX
Syntax:
(string) mobgetid(obj)
Examples:
let id = mobgetid(obj)
objidexists
return if object with id exist on world or in rent, soulbount item is never found
Syntax:
(int) objidexists(string)
Examples:
say objexist: @(objidexists("ABCDEFGH/12345678"))
random_coloring
Adds random coloring to uncolored text by adding random color code from
colorlist in front of each letter in text. It is possible to make some
color appear more often by repeating it in colorlist, i.e. colorlist
in the form "rww" would have white twice as often as red, on average,
whereas "rw" would have red and white with the same probability.
Syntax:
(string) random_coloring(string text, string colorlist)
Examples:
let colored_name = random_coloring(name(me), "grwc")
replace
replaces substring from first string with second string
replaces all occurrences defined by second string with third string
Syntax:
(string) replace(string, int, int, string)
(string) replace(string, string, string)
Examples:
let s = replace("abcdef", 0, 3, "123") - returns "123def"
let s = replace("abcdef", 0, 3, "") - returns "def"
let s = replace("abcdef", "abc", "123") - returns "123def"
let s = replace("abcdef", "abc", "") - returns "def"
str_split
returns array of tokens of given text
Syntax:
(array) str_split(string delimiter, string text)
Examples:
let tok = str_split(" ", "This is some text") - returns array("This", "is", "some", "text")
strlen
return length od given string
Syntax:
(char) strlen(string)
substr
returns substring of given string starting at given index and given characters long
Syntax:
(string) substr(string, int, int)
Examples:
let s = substr("abcdef", 0, 3) - returns "abc"
valid
test if variable is still valid
test if string is valid
return allways 1 when argument is int
test if object is valid
test if affect is valid
test if array is valid
Syntax:
(int) valid(char)
(int) valid(string)
(int) valid(int)
(int) valid(obj)
(int) valid(aff)
(int) valid(array)
Examples:
if (valid(ch)) ...