Game Development Reference
Loops and conditional statements
TScripts supports the Do. . .Loop command, and the If. . .Else. . .EndIf
Do. . .Loop() command
The syntax for the Do. . .Loop command is:
' script commands
Loop ( condition )
The script commands inside the loop will be processed each time through
the loop while the condition in the Loop brackets equate to TRUE . Once
the condition equates to FALSE , the loop terminates. The condition must
be in brackets.
You can also terminate a loop by inserting the break statement.
Each index of the array score is incremented by 10 until either all eight in
the array are incremented, or one the array values exceeds 100.
Set num = 0
Set score(num) = score(num) + 10
If (score(num) > 100)
Set num = num+1
Loop (num <= 7)
If. . .Else. . .EndIf command
The syntax for the If. . .Else. . .EndIf command is:
If ( condition )
' script commands to run if condition is TRUE
' script commands to run if condition is FALSE