diff options
author | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-27 15:26:14 +0000 |
---|---|---|
committer | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-27 15:26:14 +0000 |
commit | ceae8e59d6eb9601b2cb4e886a0aeb3f6354f738 (patch) | |
tree | b99c3b1a30b7be652bda501d0545da229954ae1c /doc/script_commands.txt | |
parent | c18f438dd8363b0abee5fdb42336f9e240699a97 (diff) | |
download | hercules-ceae8e59d6eb9601b2cb4e886a0aeb3f6354f738.tar.gz hercules-ceae8e59d6eb9601b2cb4e886a0aeb3f6354f738.tar.bz2 hercules-ceae8e59d6eb9601b2cb4e886a0aeb3f6354f738.tar.xz hercules-ceae8e59d6eb9601b2cb4e886a0aeb3f6354f738.zip |
- Updated script documentation to reflect changes applied in r15979, r15981 and r15982
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15983 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r-- | doc/script_commands.txt | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 18dcb1291..424a87bac 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -546,6 +546,40 @@ notable exception is Zeny, which you can and often will address directly - setting it will make the character own this number of Zeny. If you try to set Zeny to a negative number, the script will be terminated with an error. +Assigning variables +--------- --------- + +As of rAthena revision 15982, variables can be accessed and assigned values directly +without the use of the built-in 'set' function. This means that variables can be +accessed and modified much like other programming languages. + + @x = 100; + @x = @y = 100; + +Support for modifying variable values using 'set' is still supported (and required +to exist for this new method to work) so previous scripts will continue to work. + +When assigning values, all operator methods are supported which exist in the below +'Operators' section. For instance: + + @x += 100; + @x -= 100; + @x *= 2; + @x /= 2; + @x %= 5; + @x >>= 2; + @x <<= 2; + +Will all work. For more information on available operators, see the Operators section +described below. All operators listed there may be placed in-front of the '=' sign +when modifying variables to perform the action as required. + +Note: + + !! Currently the scripting engine does not support directly copying array variables. + !! In order to copy arrays between variables the use of 'copyarray' function is still + !! required. + Strings ------- @@ -1440,6 +1474,26 @@ generally cleaner: return 1;// it's odd } +Alternately, as of rAthena revision 15979 and 15981, user-defined functions +may be called directly without the use of the 'callfunc' script command. + + function<tab>script<tab>SayHello<tab>{ + mes "Hello " + getarg(0); + return 0; + } + + place,50,50,6<tab>script<tab>Man<tab>115,{ + mes "[Man]"; + SayHello strcharinfo(0); + close; + } + +Note: + + !! A user-defined function must be declared /before/ a script attempts to + !! call it. That is to say, any functions should be placed above scripts or NPCs + !! (or loaded in a seperate file first) before attempting to call them directly. + --------------------------------------- *callsub <label>{,<argument>,...<argument>}; |