diff options
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r-- | doc/script_commands.txt | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 9328cfa56..1afff5377 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -577,7 +577,9 @@ Variables --------- The meat of every programming language is variables - places where you store -data. +data. + +In the eAthena scripting language, variable names are not case sensitive. Variables are divided into and uniquely identified by the combination of: prefix - determines the scope and extent (or lifetime) of the variable @@ -614,7 +616,9 @@ nothing - A permanent variable attached to the character, the default variable "." - A NPC variable. They exist in the NPC and disappear when the server restarts or the NPC is reloaded. Can be accessed from inside the NPC or by calling - 'getvariableofnpc'. + 'getvariableofnpc'. Function objects can also have .variables which + are accessible from inside the function, however 'getvariableofnpc' + does NOT work on function objects. ".@" - A scope variable. They are unique to the instance and scope. Each instance has it's own scope that ends when the script ends. Calling a function with @@ -1304,6 +1308,9 @@ Example(s): //This will set the .var variable of TargetNPC to 1. set getvariableofnpc(.var,"TargetNPC"),1; +Note: even though function objects can have .variables, +getvariableofnpc will not work on them. + --------------------------------------- *goto <label>; @@ -2167,6 +2174,7 @@ Whatever it returns is determined by type. 1 - The visible part of the NPC's display name 2 - The hidden part of the NPC's display name 3 - The NPC's unique name (::name) + 4 - The name of the map the NPC is in. --------------------------------------- @@ -2195,11 +2203,14 @@ This will make @arraysize == 6. But if you try this: This command retrieves the value of the element of given array at given index. This is equivalent to using: - array[index] + <array name>[<index>] The reason for this is, that this short form is internally converted into a call to getelementofarray, when the script is loaded. +Also useful when passing arrays to functions. +getelementofarray(getarg(0),<index>) will work, but getarg(0)[<index>] will not. + --------------------------------------- *readparam(<parameter number>) @@ -3690,7 +3701,7 @@ is executing this script, unless it's some kind of "chosen" script. Example: -warpchar "prontera",150,100,20000001; +warpchar "prontera",150,100,150001; --------------------------------------- @@ -6128,13 +6139,14 @@ the NPC with the said name. *rand(<number>{,<number>}); -This function returns a number, randomly positioned between 0 and the number you -specify (if you only specify one) and the two numbers you specify if you give it -two. +This function returns a number ... +(if you specify one) ... randomly positioned between 0 and the number you specify -1. +(if you specify two) ... randomly positioned between the two numbers you specify. -rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9 +rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9 +rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9 -rand(2,10) would result in 2,3,4,5,6,7,8,9 or 10 +rand(2,5) would result in 2,3,4 or 5 --------------------------------------- |