English
Chinese
  yTin Online Help  

  中文主页 | Home (english) | 快快下载 | 实战教程 | 命令帮助 | 实用工具 | 常问问题 | 讨论留言 | 友好泥潭 | 我的程序 | 全球镜像 |
if

format:            #if {conditional} {command(s)}

The if command is one of the most powerful commands added since TINTINv3.
It works similar to an if statement in other languages, and is loosely based
on the way C handles its conditional statements.   When an if command
is encountered, the conditional statement is evaluated, and if TRUE
(any non-zero result) the command(s) are executed.   The if statement is
only evaluated if it is read, so you must nest the if statement inside
another statement (most likely an action command).   The conditional is
evaluated exactly the same as in the math command, only instead of storing
the result, the result is used to determine whether to execute the
command(s).   '#help math' for more information.

*!* Warning *!*:   #if can only compare numerical values at this time.   It can't
be used to compare a set of strings (as of yet at least).

examples:
#action {%0 gives you %1 gold coins} {#if {%%1>5000} {thank %%0}}
if someone gives you more than 5000 coins, thank them.
the %%1 and %%0 belong to the action, and not to the if, and that is why
the double % are needed.
#action {^#if {%%0<100} {flee}}
If your status prompt is of the form , this action
will get your hit points, compare them to 100, if less than 100, flee