summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2020-03-28 19:21:24 -0400
committergumi <git@gumi.ca>2020-05-07 16:03:40 -0400
commitef2564a4e826b24aeef704654dacc0ecf9959206 (patch)
tree3895b9f4f60c4e90d8fd8e5e831729601dd04639 /doc
parentac8d0f6ade21721e7946bdda5b9d712fc176e0f2 (diff)
downloadhercules-ef2564a4e826b24aeef704654dacc0ecf9959206.tar.gz
hercules-ef2564a4e826b24aeef704654dacc0ecf9959206.tar.bz2
hercules-ef2564a4e826b24aeef704654dacc0ecf9959206.tar.xz
hercules-ef2564a4e826b24aeef704654dacc0ecf9959206.zip
add documentation for the octal and binary literals
Diffstat (limited to 'doc')
-rw-r--r--doc/script_commands.txt17
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 392aa0c1f..64ba17ab7 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -434,12 +434,27 @@ marked as usable in pet scripts to work in there reliably.
Numbers
-------
+The Hercules scripting engine supports 4 types of number literals:
+
+type base syntax
+----------------------------------------------
+decimal 10 255
+hexadecimal 16 0xFF
+octal 8 0o377
+binary 2 0b11111111
+
Beside the common decimal numbers, which are nothing special whatsoever
(though do not expect to use fractions, since ALL numbers are integer in
this language), the script engine also handles hexadecimal numbers, which
are otherwise identical. Writing a number like '0x<hex digits>' will make
it recognized as a hexadecimal value. Notice that 0x10 is equal to 16.
-Also notice that if you try to 'mes 0x10' it will print '16'.
+Also notice that if you try to 'mes 0x10' it will print '16'. If you wish
+to make calculations in base 8, you can also use the octal notation like
+'0o<octal digits>'. To make calculations in base 2 (binary), you can use
+the binary notation like '0b<binary digits>'.
+
+The following are all equivalent:
+ 255 == 0xFF == 0o377 == 0b11111111
Number values can't exceed the limits of an integer variable: Any number
greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will