Control
Instead of taking the form of block:Action
like most other actions, all parts of the control block's functionality get their own keywords.
Wait¶
Wait exists as a standalone function.
Like other functions in Terracotta, neither arguments nor tags are required. Leaving out arguments will default to a wait time of 1; leaving out tags will default to a unit of ticks.
repeat {
allPlayers:DisplayParticleEffect(par("Flame"),default.Location);
wait; #waits for one tick
}
Return¶
Return uses the return
keyword. For information on how to return values, see Return Value.
End Thread¶
End Thread uses the endthread
keyword.
Continue (Skip Iteration)¶
The continue
word acts as a SkipIteration control block.
The continue keyword does not need to be within a loop. When placed at the top level of a function, it will skip an iteration of the loop that called that function. If the continue keyword is contained by no loops at all, it will do nothing.
FUNCTION Loop;
for (local i on Range(1,10)) {
#this behaves exactly the same as the earlier continue example
call SkipLogic;
default:SendMessage(local i);
}
Break (Stop Repeat)¶
The break
keyword acts as a StopRepeat control block.
All the same placement rules that apply to continue
apply to break
.