syntax.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. CHARACTERS
  2. ----------
  3. The following special characters are defined:
  4. # The hashtag is the default character for starting a command and is
  5. subsequently known as the command character or tintin character.
  6. When loading a command file the command character is set to the
  7. first character in the file. The character can also be redefined
  8. using #config.
  9. ; The semi-colon is used as the command separator and can be used to
  10. separate two commands. Multiple commands can be strung together as
  11. well. Trailing semi-colons are ignored when reading a script file
  12. as this is a common error.
  13. { } Curly brackets aka braces are used for seperating multi word command
  14. arguments, nesting commands, and nesting variables. Braces cannot
  15. easily be escaped and must always be used in pairs.
  16. " " Quote characters are used for strings in the #math, #if, #switch,
  17. and #case commands. It is however suggested to use an extra
  18. set of braces { } to define strings.
  19. ! The exclamation sign is used to repeat commands, see #help history.
  20. The character can be redefined using #config.
  21. \ An input line starting with a backslash is send verbatim if you are
  22. connected to a server. This character can be configured with
  23. #config.
  24. SUBSTITUTIONS
  25. -------------
  26. $&*@ All variable and function names must begin with an alphabetic
  27. character, followed by any number of alphanumeric characters
  28. and underscores.
  29. $ The dollar sign is used to retrieve the value of a variable.
  30. & The ampersand sign is used to retrieve the index of a variable.
  31. * The astrix sign is used to retrieve the name of a variable.
  32. @ The at sign followed by an alphanumeric string is used for functions.
  33. [ ] Brackets are used for nested variables which function as an
  34. associative array. Associative arrays are also known as tables and
  35. maps. Regex can be used within brackets to match multiple variables.
  36. &0- &99 The ampersand sign followed by a number is used for arguments in the
  37. regex command.
  38. %0- %99 The percent sign followed by a number is used for arguments by the
  39. following triggers:
  40. alias, action, button, delay, event, function, substitute, and tick.
  41. <000> Three alphanumeric characters encapsulated by the less- and greater-
  42. than signs are used for 4 and 8 bit color codes.
  43. <0000> Either a B (background) or F (foreground) followed by three
  44. hexadecimal characters encapsulated by < > signs are used for 12
  45. bit color codes. Requires truecolor capable terminal.
  46. <0000000> Either a B (background) or F (foreground) followed by six
  47. hexadecimal characters encapsulated by < > signs are used for 24
  48. bit color codes. Requires truecolor capable terminal.
  49. More information is available at #help color.
  50. \ The back slash is used to escape a character. All available options
  51. are listed at #help escape. Escapes are typically escaped when text
  52. leaves the client, by being send to a server, the shell, or being
  53. displayed on the screen.
  54. \t 08 horizontal tab character.
  55. \n 10 line feed character.
  56. \v 11 vertical tab character.
  57. \r 13 carriage return character.
  58. \e 27 escape character.
  59. \c 6 bit control character, \ca for ctrl-a.
  60. \x 8 bit character using 2 hexadecimal numbers.
  61. \u 16 bit unicode character, \uFFFD for example.
  62. All variables and functions can be escaped by doubling the sign,
  63. like $$variable_name or @@function_name. To escape a variable
  64. twice use $$$var_name. One escape is removed each time tintin
  65. needs to substitute a variable or function.
  66. All command arguments can be escaped by doubling the ampersand,
  67. like &&1. One escape is removed each time tintin substitutes
  68. command arguments.
  69. All trigger arguments can be escaped by double the ampersand,
  70. like %%1. One escape is removed each time tintin substitutes
  71. trigger arguments.
  72. COORDINATES
  73. -----------
  74. When the 0,0 coordinate is in the upper left corner TinTin++ uses
  75. a y,x / rows,cols notation, starting at 1,1. Subsequently -1,-1
  76. will indicate the bottom right corner.
  77. When the 0,0 coordinate is in the bottom left corner tintin uses
  78. a standard x,y notation.
  79. SQUARES
  80. -------
  81. A square argument takes 4 coordinates. The first two coordinates
  82. define the upper left corner, the last two coordinates define the
  83. bottom right corner.
  84. PANES
  85. -----
  86. A panes argument takes 4 size values, which are: top pane, bottom
  87. pane, left pane, right pane. When a negative value is provided the
  88. size is the maximum size, minus the value.
  89. MATH
  90. ----
  91. Operators Priority Function
  92. ------------------------------------------------
  93. ! 0 logical not
  94. ~ 0 bitwise not
  95. * 1 integer multiply
  96. ** 1 integer power
  97. / 1 integer divide
  98. // 1 integer sqrt // 2 or cbrt // 3
  99. % 1 integer modulo
  100. d 1 integer random dice roll
  101. + 2 integer addition
  102. - 2 integer subtraction
  103. << 3 bitwise shift
  104. >> 3 bitwise shift
  105. > 4 logical greater than
  106. >= 4 logical greater than or equal
  107. < 4 logical less than
  108. <= 4 logical less than or equal
  109. == 5 logical equal (can use regex)
  110. != 5 logical not equal (can use regex)
  111. === 5 string equal
  112. !== 5 string not equal
  113. & 6 bitwise and
  114. ^ 7 bitwise xor
  115. | 8 bitwise or
  116. && 9 logical and
  117. ^^ 10 logical xor
  118. || 11 logical or
  119. : The colon can be used in #math to indicate a time value.
  120. 1:30 This means 1 minute and 30 seconds and equals 90 seconds.
  121. 2:1:30 This means 2 hours, 1 minute and 30 seconds.
  122. 6:2:1:30 This means 6 days, 2 hours, 1 minute and 30 seconds.
  123. #math time 6:2:1:30 equals 525690
  124. M,K,m,u These four metric suffixes are allowed for numbers.
  125. { } Braces can be used in #math to perform string operations.
  126. {a} > {b} This checks if the string "a" is greater than "b".
  127. , Commas in numbers are ignored, as well as spaces and tabs.
  128. . Dots can be used in #math to perform floating point calculations.
  129. The precision is set to the highest precision number used in the
  130. calculation.
  131. ( ) Braces can be used in #math to prioritize a calculation.
  132. STATEMENTS
  133. ----------
  134. TT++ has the following commands which behave like statements.
  135. #break
  136. #case {value} {true}
  137. #continue
  138. #default {commands}
  139. #else {commands}
  140. #elseif {expression} {true}
  141. #foreach {list} {variable} {commands}
  142. #if {expression} {true}
  143. #loop {min} {max} {variable} {commands}
  144. #parse {string} {variable} {commands}
  145. #return {value}
  146. #switch {expression} {commands}
  147. #while {expression} {commands}
  148. REGEX
  149. -----
  150. ^ force match of start of line.
  151. $ force match of end of line.
  152. \ escape one character.
  153. %1-%99 lazy match of any text, available at %1-%99.
  154. %0 should be avoided in triggers, and if left alone lists all matches.
  155. { } embed a raw regular expression, matches are stored to %1-%99.
  156. %!{ } embed a raw regular expression, matches are not stored.
  157. [ ] . + | ( ) ? * are treated as normal text unlessed used within
  158. braces. Keep in mind that { } is replaced with ( ) automatically
  159. unless %!{ } is used.
  160. Of the following the (lazy) match is available at %1-%99
  161. %w match zero to any number of word characters.
  162. %W match zero to any number of non word characters.
  163. %d match zero to any number of digits.
  164. %D match zero to any number of non digits.
  165. %s match zero to any number of spaces.
  166. %S match zero to any number of non spaces.
  167. %? match zero or one character.
  168. %. match one character.
  169. %+ match one to any number of characters.
  170. %* match zero to any number of characters.
  171. %i matching becomes case insensitive.
  172. %I matching becomes case sensitive (default).
  173. ESCAPE
  174. ------
  175. \a beep the terminal.
  176. \c send a control character, \ca for ctrl-a.
  177. \e start an escape sequence.
  178. \n send a line feed.
  179. \r send a carriage return.
  180. \t send a horizontal tab.
  181. \x print an 8 bit character using hexadecimal, \xFF for example.
  182. \x7B send the '{' character.
  183. \x7D send the '}' character.
  184. \u print a 16 bit unicode character, \uFFFD for example.
  185. \U print a 21 bit unicode character, \U02AF21 for example.
  186. \v send a vertical tab
  187. COLOR CODES
  188. -----------
  189. <xyz> with x, y, z being parameters
  190. Parameter 'x': VT100 code
  191. 0 - Reset all colors and codes to default
  192. 1 - Bold
  193. 2 - Dim
  194. 4 - Underscore
  195. 5 - Blink
  196. 7 - Reverse
  197. 8 - Skip (use previous code)
  198. Parameter 'y': Foreground color
  199. Parameter 'z': Background color
  200. 0 - Black 5 - Magenta
  201. 1 - Red 6 - Cyan
  202. 2 - Green 7 - White
  203. 3 - Yellow 8 - Skip
  204. 4 - Blue 9 - Default
  205. For xterm 256 colors support use <aaa> to <fff> for RGB foreground
  206. colors and <AAA> to <FFF> for RGB background colors. For the grayscale
  207. foreground colors use <g00> to <g23>, for grayscale background colors
  208. use <G00> to <G23>.
  209. The tertiary colors are as follows:
  210. <acf> - Azure <afc> - Jade
  211. <caf> - Violet <cfa> - Lime
  212. <fac> - Pink <fca> - Orange
  213. Example: #showme <acf>Azure <afc>Jade <caf>Violet
  214. Example: #showme <cfa>Lime <fac>Pink <fca>Orange
  215. For 12 bit truecolor use <F000> to <FFFF> for foreground colors and
  216. <B000> to <BFFF> for background colors.
  217. For 24 bit truecolor use \e[38;2;R;G;Bm where R G B are red/green/blue
  218. intensities between 0 and 255. For example: \e[37;2;50;100;150m. Use
  219. \e[48;2;R;G;Bm for background colors.
  220. HELP
  221. ----
  222. [ ] Argument is optional.
  223. < > Argument is required.
  224. { } Argument is literally the same.
  225. | Used to separate arguments with multiple options.
  226. CONFIGURATION DEFAULTS
  227. ----------------------
  228. [AUTO TAB ] [ 5000] Scroll back buffer lines used for tab completion
  229. [BUFFER SIZE ] [ 20000] The size of the scroll back buffer
  230. [CHARSET ] [ AUTO] The character set encoding used by TinTin++
  231. [CHILD LOCK ] [ OFF] TinTin++ is not child locked.
  232. [COLOR MODE ] [ 256] The color code encoding used by TinTin++
  233. [COLOR PATCH ] [ OFF] TinTin++ will leave color handling to the server
  234. [COMMAND COLOR ] [ <078>] The color of echoed commands
  235. [COMMAND ECHO ] [ ON] Your commands are echoed in split mode
  236. [CONNECT RETRY ] [ 0] Seconds TinTin++ sessions try to connect on failure
  237. [CONVERT META ] [ OFF] TinTin++ doesn't convert meta prefixed characters
  238. [HISTORY SIZE ] [ 1000] The size of the command history
  239. [INHERITANCE ] [ ON] The startup session is inherited
  240. [LOG ] [ RAW] The data format of the log files
  241. [LOG LEVEL ] [ HIGH] TinTin++ only logs high level mud data
  242. [MCCP ] [ ON] MCCP is enabled.
  243. [MOUSE TRACKING] [ OFF] Your terminal does not generate mouse events.
  244. [PACKET PATCH ] [ 0.00] Seconds TinTin++ will try to patch broken packets
  245. [RANDOM SEED ] [ AUTO] Seed value used for the random number engine
  246. [REPEAT ENTER ] [ OFF] You send a carriage return on an enter
  247. [REPEAT CHAR ] [ !] The character used for repeating commands
  248. [SCREEN READER ] [ OFF] You are not using a screen reader
  249. [SCROLL LOCK ] [ ON] You do not see mud output while scrolling
  250. [SPEEDWALK ] [ OFF] Your input is not scanned for speedwalk directions
  251. [TINTIN CHAR ] [ #] The character used for TinTin++ commands
  252. [VERBATIM ] [ OFF] Your keyboard input is parsed by TinTin++
  253. [VERBATIM CHAR ] [ \] The character used for unparsed text
  254. [VERBOSE ] [ OFF] Messages while reading in a script file are gagged
  255. [WORDWRAP ] [ ON] Mud output is word wrapped