Iron Realms Entertainment
Extract one or more words from a string. A word, in this case, is a sequence of non-whitespace characters. If the ‘last’ word (as in the parameter ‘last’) is 0, it means extract everything from the first through the end of the string. The numbers are inclusive, so:
words$("this is a test", 1, 2) = "this is"
Note that the first and last values are automatically clipped to the largest values possible Also, the whitespace is preserved between the first and last words (but whitespace on the front or back is stripped).
words$("this is a test",
A string containing the words between first and last inclusive.
Find the first occurance of a substring in a string starting at a given position. Searching begins at position start + 1, and a return value of 0 indicates no match found, otherwise the position of the first character of the search string is returned.
You might think that the start + 1 searching mechanism is odd, but it allows easy construction of enumeration loops (and is more consistent with other search routines such as database searching). For an example see the following.
i = pos(str$, "foo", 0);
Some examples of use might illustrate the behavior better.
pos("blahb", "a", 0) = 3
The position of the first character of needle$ in haystack$ or 0 if no match is found.
Generate a hexadecimal representation of an MD5 hash of the string. An MD5 hash is a hashing algorithm for generating a signature of a string. This routine returns a hexadecimal representation of the 16 byte hash value.
A 32 character hexadecimal string representing the hash value.
Generate a string representation of a blowfish hash of the string. Blowfish is a cryptographically strong hashing algorithm for generating a signature of a string.
You can pass a salt to use, or an empty string to generate a random one (recommended).
A string representing the hash value.
Generate an ANSI color code sequence for the specified foreground and background combination. The ansi colors are listed below. Note that only the lower 8 colors may be used for background colors (this is a limitation of the ANSI standard). Bold colors are generally interpreted as brighter on most client programs, but they can also make the font used actually bold as well. A color value of -1 will generate a color code sequence that sets only the other color. For example ansicolor$(1, -1) will leave the background color alone and set the foreground to red.
] Color Name FG? BG? ] -1 (Default color) y y ] 0 Black y y ] 1 Red y y ] 2 Green y y ] 3 Yellow y y ] 4 Blue y y ] 5 Magenta y y ] 6 Cyan y y ] 7 White y y ] 8 Grey (Bold Black) y - ] 9 Bold red y - ] 10 Bold green y - ] 11 Bold yellow y - ] 12 Bold blue y - ] 13 Bold magenta y - ] 14 Bold cyan y - ] 15 Bold white y -
An ANSI color code sequence (string) that can be sent to a player to instruct his/her client to change the color of any incoming text.
Match a text against a provided regular expression. The compiled expression is cached, making the matching very fast. Note that character groups (\d, \w, ...) need to have the backslash doubled.
Index of the matching substring, or 0 if no match found.