18,700
edits
m (lede wording) |
(→schedule ... repeat ... every ...: pseudocode fix) |
||
Line 667: | Line 667: | ||
====schedule ... repeat ... every ...==== | ====schedule ... repeat ... every ...==== | ||
Allows you to schedule a function call to repeat x times at a rate of y ticks. Unused in Oni's scripts, but here's a working example: | Allows you to schedule a function call to repeat ''x'' times at a rate of ''y'' ticks. Unused in Oni's scripts, but here's a working example: | ||
schedule dprint("Is this annoying yet?") repeat 50 every 20; | schedule dprint("Is this annoying yet?") repeat 50 every 20; | ||
This is | This is equivalent to the following loop in a C-style programming language: | ||
int i = 1; | |||
do | |||
{ | { | ||
print("Is this annoying yet?"); | print("Is this annoying yet?"); | ||
wait(20); | wait(20); | ||
} | i++; | ||
} while (i != 50); | |||
To create an infinite loop, you can use "0" or a negative number as the repeat value: | To create an infinite loop, you can use "0" or a negative number as the repeat value: |