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.txt77
1 files changed, 64 insertions, 13 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 8b8326862..28e25679f 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -730,6 +730,7 @@ the common mathematical operations or conditional operators:
strings.
- - will subtract two numbers.
* - will multiply two numbers.
+** - will raise the first number to the power of the second number.
/ - will divide two numbers. Note that this is an integer division, i.e.
7/2 is not equal 3.5, it's equal 3.
% - will give you the remainder of the division. 7%2 is equal to 1.
@@ -930,42 +931,45 @@ Precedence | Description | Associativity
| ! Logical NOT |
| ~ Bitwise NOT (One's Complement) |
---------------------------------------------------------------------------
-3 | * Multiplication | Left to right
+3 | ** Exponentiation | Left to right
+---------------------------------------------------------------------------
+4 | * Multiplication | Left to right
| / Division |
| % Modulo (remainder) |
---------------------------------------------------------------------------
-4 | + Addition | Left to right
+5 | + Addition | Left to right
| - Subtraction |
---------------------------------------------------------------------------
-5 | << Bitwise left shift | Left to right
+6 | << Bitwise left shift | Left to right
| >> Bitwise right shift |
---------------------------------------------------------------------------
-6 | < Less than | Left to right
+7 | < Less than | Left to right
| <= Less than or equal to |
| > Greater than |
| >= Greater than or equal to |
---------------------------------------------------------------------------
-7 | == Equal to | Left to right
+8 | == Equal to | Left to right
| != Not equal to |
| ~= Regexp match |
| ~! Regexp non-match |
---------------------------------------------------------------------------
-8 | & Bitwise AND | Left to right
+9 | & Bitwise AND | Left to right
---------------------------------------------------------------------------
-9 | ^ Bitwise XOR (exclusive or) | Left to right
+10 | ^ Bitwise XOR (exclusive or) | Left to right
---------------------------------------------------------------------------
-10 | | Bitwise OR (inclusive or) | Left to right
+11 | | Bitwise OR (inclusive or) | Left to right
---------------------------------------------------------------------------
-11 | && Logical AND | Left to right
+12 | && Logical AND | Left to right
---------------------------------------------------------------------------
-12 | || Logical OR | Left to right
+13 | || Logical OR | Left to right
---------------------------------------------------------------------------
-13 | ?: Ternary conditional | Right to left
+14 | ?: Ternary conditional | Right to left
---------------------------------------------------------------------------
-14 | = Direct assignment | Right to left
+15 | = Direct assignment | Right to left
(lowest) | += Assignment by sum |
| -= Assignment by difference |
| *= Assignment by product |
+ | **= Assignment by power |
| /= Assignment by quotient |
| %= Assignment by remainder |
| <<= Assignment by bitwise left shift |
@@ -2437,6 +2441,17 @@ If you do this:
---------------------------------------
+*getarrayindex(<array name>)
+
+This command returns the index of the passed array. This is useful when
+used in combination with getarg()
+
+Example:
+
+ getarrayindex(.@foo[42]) // 42
+
+---------------------------------------
+
*getelementofarray(<array name>, <index>)
This command retrieves the value of the element of given array at given
@@ -7773,6 +7788,21 @@ OnAtcommand:
---------------------------------------
+*add_group_command("<command>", <group id>, <use on self>, <use on other>)
+
+Allows to explicitly change the command permissions for a specific group.
+
+This command bypasses group inheritance, which means groups inheriting from
+the specified <group id> will NOT inherit the specified permission. You should
+use add_group_command() for every group you want to give permission to.
+
+Example:
+ bindatcmd("foobar", "NPC::OnUseCommand", 99, 99, 0); // define the command
+ add_group_command("foobar", 2, true, false); // allow group 2 to use @foobar
+ add_group_command("foobar", 5, true, true); // allow group 5 to use @foobar and #foobar
+
+---------------------------------------
+
*unbindatcmd("command")
This command will unbind a NPC event label from an atcommand.
@@ -7790,7 +7820,8 @@ scripts-atcommands this way.
*can_use_command("<command>"{, <account id>})
Checks if the attached or specified player can use the specified
-atcommand and returns true or false accordingly.
+atcommand and returns true or false accordingly. Works for both
+built-in atcommands and custom atcommands.
---------------------------------------
@@ -8028,11 +8059,19 @@ instead if they want it so much.
*pow(<number>, <power>)
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ @ /!\ This command is deprecated @
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
Returns the result of the calculation.
Example:
.@i = pow(2, 3); // .@i will be 8
+This command is deprecated and it should not be used in new scripts, as it is
+likely to be removed at a later time. Please use the exponentiation operator,
+ie: (2 ** 3) instead of pow(2, 3)
+
---------------------------------------
*log10(<number>)
@@ -8247,6 +8286,18 @@ else.
---------------------------------------
+*isstr(<argument>)
+
+This command checks if the given <argument> is a string (1),
+an integer (0) or something else (2).
+
+Example:
+
+ isstr(69); // outputs 0
+ isstr("69"); // outputs 1
+
+---------------------------------------
+
*charisalpha("<string>", <position>)
This function will return true if the character number Position in the given