QBasic 1.1: ON PLAY Statement

Syntax

PLAY ON
PLAY OFF
PLAY STOP
ON PLAY(queuelimit%) GOSUB line

Description / Parameter(s)

PLAY ON Enables play event trapping.
PLAY OFF Disables play event trapping.
PLAY STOP Suspends play event trapping. Events are processed once event trapping is enabled by PLAY ON.
queuelimit% A number in the range 1 through 32. ON PLAY branches to a subroutine when there are fewer than queuelimit% notes in the music buffer.
line The label or number of the first line of the event-trapping subroutine.

Example

ON PLAY(3) GOSUB Background PLAY ON Music$ = "MBo3L8ED+ED+Eo2Bo3DCL2o2A" PLAY Music$ LOCATE 2, 1: PRINT "Press any key to stop."; DO WHILE INKEY$ = "": LOOP END Background: i% = i% + 1 LOCATE 1, 1: PRINT "Background called "; i%; "time(s)"; PLAY Music$ RETURN