summaryrefslogtreecommitdiff
path: root/doc/script_commands.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r--doc/script_commands.txt136
1 files changed, 66 insertions, 70 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 8a7767cf0..bcb632443 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -6511,6 +6511,12 @@ directly. It probably determines which directory to play the effect from.
It's certain that giving 0 for the number will play sound files from '\data\wav\',
but where the other numbers will read from is unclear.
+The sound files themselves must be in the PCM format, and file names should also
+have a maximum length of 23 characters including the .wav extension:
+
+soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
+soundeffect "12345678901234567890.wav", 0; // throw gravity error
+
You can add your own effects this way, naturally.
---------------------------------------
@@ -6694,7 +6700,7 @@ expression pattern is, see a few web pages:
http://www.regular-expressions.info/
http://www.weitz.de/regex-coach/
-For an example of this in use, see doc/sample/npc_pcre.txt
+For an example of this in use, see doc/sample/npc_test_pcre.txt
With this you could, for example, automatically punish players for asking for
Zeny in public places, or alternatively, automatically give them Zeny instead if
@@ -6859,10 +6865,9 @@ The first letter is position 0.
*charat(<string>,<index>)
- Returns char at specified index. If index is out of range,
- returns empty string.
+Returns char at specified index. If index is out of range, returns empty string.
- Example:
+Example:
charat("This is a string", 10); //returns "s"
@@ -6870,12 +6875,11 @@ The first letter is position 0.
*setchar(<string>,<char>,<index>)
- Returns the original string with the char at the specified
- index set to the specified char. If index out of range, the
- original string will be returned.
- Only the 1st char in the <char> parameter will be used.
+Returns the original string with the char at the specified index set to the
+specified char. If index out of range, the original string will be returned.
+Only the 1st char in the <char> parameter will be used.
- Example:
+Example:
setchar("Cat", "B", 0); //returns "Bat"
@@ -6883,12 +6887,11 @@ The first letter is position 0.
*insertchar(<string>,<char>,<index>)
- Returns the original string with the specified char inserted
- at the specified index. If index is out of range, the char
- will be inserted on the end of the string that it is closest.
- Only the 1st char in the <char> parameter will be used.
+Returns the original string with the specified char inserted at the specified
+index. If index is out of range, the char will be inserted on the end of the
+string that it is closest. Only the 1st char in the <char> parameter will be used.
- Example:
+Example:
insertchar("laughter", "s", 0); //returns "slaughter"
@@ -6896,10 +6899,10 @@ The first letter is position 0.
*delchar(<string>,<index>)
- Returns the original string with the char at the specified index
- removed. If index is out of range, original string will be returned.
+Returns the original string with the char at the specified index removed.
+If index is out of range, original string will be returned.
- Example:
+Example:
delchar("Diet", 3); //returns "Die"
@@ -6908,10 +6911,10 @@ The first letter is position 0.
*strtoupper(<string>)
*strtolower(<string>)
- Returns the specified string in it's uppercase/lowercase form.
- All non-alpha characters will be preserved
+Returns the specified string in it's uppercase/lowercase form.
+All non-alpha characters will be preserved.
- Example:
+Example:
strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
@@ -6920,11 +6923,10 @@ The first letter is position 0.
*charisupper(<string>,<index>)
*charislower(<string>,<index>)
- Returns 1 if character at specified index of specified string is
- uppercase/lowercase. Otherwise, 0. Characters not of the alphabelt
- will return 0.
+Returns 1 if character at specified index of specified string is
+uppercase/lowercase. Otherwise, 0. Characters not of the alphabelt will return 0.
- Example:
+Example:
charisupper("rAthena", 1); //returns 1
@@ -6932,12 +6934,11 @@ The first letter is position 0.
*substr(<string>,<start_index>,<end_index>)
- Returns the sub-string of the specified string inclusively between
- the set indexes.
- If indexes are out of range, or the start index is after the end
- index, an empty string will be returned.
+Returns the sub-string of the specified string inclusively between the set
+indexes. If indexes are out of range, or the start index is after the end
+index, an empty string will be returned.
- Example:
+Example:
substr("foobar", 3, 5); //returns "bar"
@@ -6945,13 +6946,12 @@ The first letter is position 0.
*explode(<dest_array>,<string>,<delimiter>)
- Breaks a string up into substrings based on the specified delimiter.
- Substrings will be stored within the specified string array.
- Only the 1st char of the delimiter parameter will be used.
- If an empty string is passed as a delimiter, the string will be placed
- in the array in it's original form.
-
- Example:
+Breaks a string up into substrings based on the specified delimiter. Substrings
+will be stored within the specified string array. Only the 1st char of the
+delimiter parameter will be used. If an empty string is passed as a delimiter,
+the string will be placed in the array in it's original form.
+
+Example:
explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
//.@my_array$ contents will be...
@@ -6965,10 +6965,10 @@ The first letter is position 0.
*implode(<string_array>{,<glue>})
- Combines all substrings within the specified string array into a single string.
- If the glue parameter is specified, it will be inserted inbetween each substring.
+Combines all substrings within the specified string array into a single string.
+If the glue parameter is specified, it will be inserted inbetween each substring.
- Example:
+Example:
setarray .@my_array$[0], "This", "is", "a", "test";
implode(.@my_array$, " "); //returns "This is a test"
@@ -6976,13 +6976,11 @@ The first letter is position 0.
*sprintf(<format>[,param[,param[,...]]]) [Mirei]
- C style sprintf. The resulting string is returned same as in PHP. All C format
- specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
- The number of params is only limited by eA's script engine.
-
- See thread: http://www.eathena.ws/board/index.php?showtopic=190410
-
- Example:
+C style sprintf. The resulting string is returned same as in PHP. All C format
+specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
+The number of params is only limited by rA's script engine.
+
+Example:
.@format$ = 'The %s contains %d monkeys';
dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
@@ -6991,13 +6989,11 @@ The first letter is position 0.
*sscanf(<string>,<format>[,param[,param[,...]]]) [Mirei]
- C style sscanf. All C format specifiers are supported.
- More info: sscanf @ www.cplusplus.com. The number of params is only limited
- by eA's script engine.
-
- See thread: http://www.eathena.ws/board/index.php?showtopic=191157
-
- Example:
+C style sscanf. All C format specifiers are supported.
+More info: sscanf @ www.cplusplus.com. The number of params is only limited
+by rA's script engine.
+
+Example:
sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
dispbottom(.@num + " " + .@str$); //prints "42 foobar"
@@ -7005,12 +7001,12 @@ The first letter is position 0.
*strpos(<haystack>,<needle>{,<offset>})
- PHP style strpos. Finds a substring (needle) within a string (haystack).
- The offset parameter indicates the index of the string to start searching.
- Returns index of substring on successful search, else -1.
- Comparison is case sensitive.
-
- Example:
+PHP style strpos. Finds a substring (needle) within a string (haystack).
+The offset parameter indicates the index of the string to start searching.
+Returns index of substring on successful search, else -1.
+Comparison is case sensitive.
+
+Example:
strpos("foobar", "bar", 0); //returns 3
strpos("foobarfoo", "foo", 0); //returns 0
strpos("foobarfoo", "foo", 1); //returns 6
@@ -7019,12 +7015,12 @@ The first letter is position 0.
*replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
- Replaces all instances of a search string in the input with the specified
- replacement string. By default is case sensitive unless <usecase> is set
- to 0. If specified it will only replace as many instances as specified
- in the count parameter.
-
- Example:
+Replaces all instances of a search string in the input with the specified
+replacement string. By default is case sensitive unless <usecase> is set
+to 0. If specified it will only replace as many instances as specified
+in the count parameter.
+
+Example:
replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
replacestr("Donkey", "don", "mon", 0); //returns "monkey"
replacestr("test test test test test", "yay", 0, 3); //returns "yay yay yay test test"
@@ -7032,11 +7028,11 @@ The first letter is position 0.
---------------------------------------
*countstr(<input>, <search>{, <usecase>})
-
- Counts all instances of a search string in the input. By default is case
- sensitive unless <usecase> is set to 0.
-
- Example:
+
+Counts all instances of a search string in the input. By default is case
+sensitive unless <usecase> is set to 0.
+
+Example:
countstr("test test test Test", "test"); //returns 3
countstr("cake Cake", "Cake", 0); //returns 2