Chapter
10
I
BASIC Keywords
PLAY/Trap Statement
PLAY
action
Turns on, turns
off,
or
temporarily halts background music event
trapping.
Action
may be any
of
the following:
ON
enables play event trapping.
OFF
disables play event trapping.
STOP
Use the PLAY/Trap statement in
a
background music trap rou-
tine with the
ON
PLAY GOSUB statement
to
detect when the
number
of
notes in the background music queue goes from
num-
ber
to
number
minus
1.
The PLAY
ON
statement turns on the trap. BASIC checks the
number
of
notes in the background music queue after each pro-
gram line. If the number is equal
to
that in the
ON
PLAYO
GO-
SUB statement, BASIC transfers program control
to
the line
number specified.
The PLAY STOP statement temporarily halts background music
trapping. If the number
of
notes equals the specified number,
BASIC does not transfer program control
to
the
ON
PLAYO GO-
SUB statement until you turn on trapping again by executing a
PLAY
ON
statement. BASIC remembers that the number
of
notes was equal and branches
to
the subroutine immediately
after trapping is turned on again.
The PLAY
OFF
statement turns
off
background music trapping.
BASIC does not remember if the number
of
notes in the queue is
equal
to
the number specified when trapping is turned
on
again.
See
ON
PLAYO GOSUB
for
more information about background
music trapping.
temporarily suspends play event trapping.
265