PlayMusic(id[, table])
id
. This music object
must have been opened with either the @MUSIC preprocessor command or the
OpenMusic() command.
Please note that before Hollywood 6.0 only one music could be played at a time. Starting
with Hollywood 6.0 this limit is no longer there, but it is still enforced in order to
be compatible with older scripts. Thus, if a music object is already playing and you call this
command, that music will be stopped first before playback of the new music starts. If
you need to play multiple music objects at the same time, you will have to explicitly disable
this behaviour by calling LegacyControl() and setting the
SingleMusic
tag to False
. PlayMusic()
will no longer stop any playing music.
See LegacyControl for details.
Prior to Hollywood 4.5, the second argument was optional and specified how many times the music object should be played. Starting with Hollywood 4.5, the second argument is now an optional table argument. Of course, the old syntax is still supported for compatibility. New scripts should use the new syntax though. The optional table argument recognizes the following tags:
Times:
Volume:
Channel:
PlayMusic()
will automatically choose a vacant channel and will fail if there
is no vacant channel. To override this behaviour, you can use
this field. When specified, it will always enforce playback on the
very channel specified here. If the channel is already playing, it will
be stopped first. (V6.1)