Ozapell Basic Learn Programming #11

Sometimes you will need to add delays in your program.

Let’s assume you wrote a program in Ozapell Basic to draw a white pixel on a black screen in graphics mode:

BACKCOLOR=COLORBLACK
MODE=1
SETMODE
TEXTCOLOR=COLORWHITE
X=10
Y=10
COLORXY

You run the program and nothing happens. The program executed properly and drew its pixel, but then it returned to text mode when the program ended.

This could also be a problem if a wave audio sound was loaded, played and the program ended. The sound would stop immediately and it might seem as though the sound wasn’t playing correctly.

Here are some delays you can add to the end of your program:

REPEAT
UNTIL FALSE

This will create an infinite loop. Only pressing the ESC key will end the program.

REPEAT
INPUT
UNTIL RESULT

This will loop until a key is pressed. INPUT will return a string character in RESULT. If it is an empty string (length of zero), the loop will continue. If a key is pressed (associated with a string character), then the loop will end.

TIME
OLDTIME=RESULT
REPEAT
TIME
RESULT-OLDTIME
RESULT>1000
UNTIL RESULT

This will loop for 1000 milliseconds (one second).

Ozapell Basic on Steam

 

Advertisements
Ozapell Basic Learn Programming #11

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s