diff options
author | shennetsind <ind@henn.et> | 2014-02-08 19:39:35 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2014-02-08 19:39:35 -0200 |
commit | 51805d1f2cedc084fea6cc390ca23a24291edbec (patch) | |
tree | a1c4b4743df1fa5c1c43b95cc1cf75f60c24574e /doc/script_commands.txt | |
parent | afcb4bcae5d28a4156cce4d0f833e95432d45797 (diff) | |
parent | f2383946d9e52f61844a9f6e3ec679c99f697e04 (diff) | |
download | hercules-51805d1f2cedc084fea6cc390ca23a24291edbec.tar.gz hercules-51805d1f2cedc084fea6cc390ca23a24291edbec.tar.bz2 hercules-51805d1f2cedc084fea6cc390ca23a24291edbec.tar.xz hercules-51805d1f2cedc084fea6cc390ca23a24291edbec.zip |
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r-- | doc/script_commands.txt | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index c0b848663..aa8698418 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -7359,20 +7359,31 @@ setitemscript 2637,""; --------------------------------------- -*atoi ("<string>") -*axtoi ("<string>") +*atoi("<string>") +*axtoi("<string>") +*strtol("string", base) These commands are used to convert strings to numbers. 'atoi' will interpret given string as a decimal number (base 10), while 'axtoi' -interprets strings as hexadecimal numbers (base 16). +interprets strings as hexadecimal numbers (base 16). 'strtol' lets +the user specify a base (valid range is between 2 and 36 inclusive, +or the special value0, which means auto-detection). -Hexadecimal number set: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} +The atoi and strtol functions conform to the C functions with the same +names, and axtoi is the same as strtol, with a base of 16. Results are +clamped to signed 32 bit int range (INT_MIN ~ INT_MAX) Example: -set @var, atoi("11"); // Sets @var to 11 -set @var, axtoi("FF"); // Sets @var to 255 -mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16) +.@var = atoi("11"); // Sets .@var to 11 +.@var = axtoi("FF"); // Sets .@var to 255 +mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16) +.@var = strtol("11", 10); // Sets .@var to 11 (11 base 10) +.@var = strtol("11", 16); // Sets .@var to 17 (11 base 16) +.@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected) +.@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix) +.@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix) +.@var = strtol("11", 2); // Sets .@var to 3 (binary 11) --------------------------------------- |