WAIT is not a command in SmileBasic V1. However, the effects of the command
WAIT N can be achieved with
VSYNC 0:VSYNC N.
WAIT is a command which takes one numerical parameter, which gets rounded down, and pauses the execution of the program: in that respect, it is very similar to
VSYNC, but the details differ.
Once every 1/60 of a second, i.e. once every frame, the physical displays are updated to reflect the current state of the display buffers. The
WAIT command will always end immediately after this update, unless the parameter is zero. (A negative parameter will generate an
Out of range (WAIT) error.)
When the parameter is zero,
WAIT takes very little time.
When the parameter is one,
WAIT will wait until the next 'tick' of the frame clock (unless, when the command is started, it is very close to a 'tick': parsing and processing the command may take the system to after that close tick, so that when the command starts executing it will wait for the next tick after that).
When the parameter is two,
WAIT will wait until the second tick (unless it starts very close to a tick, then it will wait for the third tick), etc..
One common usage of
WAIT is to reduce animation flicker. If clearing the screen and drawing the display takes less than one frame, then a
WAIT 1 immediately before will ensure that the screens never display half-drawn images. Another usage is to slow down animations, or simply to pause the program so that e.g. there is time for a user to read a message displayed on the screen.
WAIT 0 takes a very little amount of time and may terminate at any phase relative to the frame clock, and
WAIT N where
N is positive will take between (
N-1 frames plus a little) and (
N frames plus a little), and will terminate just after a 'tick'.
No information on SmileBasic V3.