Game Development Reference
In-Depth Information
Loops and conditional statements
TScripts supports the Do. . .Loop command, and the If. . .Else. . .EndIf
condition.
Do. . .Loop() command
The syntax for the Do. . .Loop command is:
Do
' script commands
break
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.
Example
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.
On NewFrame
Set num = 0
Do
Set score(num) = score(num) + 10
If (score(num) > 100)
break
EndIf
Set num = num+1
Loop (num <= 7)
End NewFrame
If. . .Else. . .EndIf command
The syntax for the If. . .Else. . .EndIf command is:
If ( condition )
' script commands to run if condition is TRUE
Else
' script commands to run if condition is FALSE
EndIf
Search Nedrilad ::




Custom Search