If-then-else |
Top Previous Next |
Unlike normal VM Commands, the Global VM can have advanced If condition, with multiple lines and also with else statement.
A normal VM Command if statement looks like this:
if (GPRM1 > 2) LinkPGCN 1
In normal VM code only one command can be used with if. The Global VM script can also use the same if statement plus more advance If-then-else with multiple lines.
Simple statement As described in VM Commands, the simple if statement can have only one command, all next lines will be executed regardless of the if condition.
Example: if (GPRM1 > 2) LinkPGCN 1 GPRM2 = 0
Only LinkPGCN 1 belongs to the condition, the GPRM12 = 0 will be run regardless of the condition result.
Note: DVD system allows only certain commands to be used within line with if condition. For example LinkPGCN is one of them, but JumpSS is not. These can be generally used with one line if command:
For other commands you will need to use Multi-Line if-then-endif command.
Multi-Line Statement 'if - then -endif' A multi-line statement must have word 'then' in the condition line, the commands belonging to the condition body must start on new line and it must be closed by 'endif'
Example if (GPRM1 > 2) then LinkPGCN 1 GPRM2 = 0 endif GPRM3 = 0
Both LinkPGCN 1 and GPRM2 = 0 belongs to the condition body and will be executed only if condition is true. The line GPRM3 = 0 after endif will be executed regardless of the condition.
Multi-Line Statement 'if - then - else - endif' The last type of statement uses else block. If the condition is true then lines between then and else will be executed, if it is false then lines between else and endif will be executed.
Example if (GPRM1 > 2) then LinkPGCN 1 GPRM2 = 0 else GPRM3 = 0 GPRM4 = 0 endif
|