CDAudio (int command, int param)
This function allows you to play and control an audio CD in your game.
Different tasks are performed, depending on the value of the COMMAND
parameter. If there is no CD-ROM drive on the system, the function does
The PARAM parameter is used by some of the functions for various reasons; if
it is not needed for the particular function you are calling, pass zero
The tasks performed are as follows depending on the COMMAND parameter:
0 Query CD-ROM support - checks if there is a CD-ROM drive available on
the system. Returns 1 if there is, and 0 if there is not.
1 Get playing status - checks whether the CD drive is currently playing
an audio track. Returns 1 if it is, and 0 if it is not.
2 Play track - starts playback from track PARAM on the CD. If the track
does not exist, or if it is a data track, nothing happens.
3 Pause playback - pauses the currently playing audio track.
4 Resume playback - continues from where the track was paused.
5 Get number of tracks - returns the number of tracks on the CD
currently in the drive. If the drive is empty, returns 0.
6 Eject - ejects the drive tray if the drive has the ability. This is
a feature you'll play with to start off because it's neat, and then
realize that it has no real use in your game.
Your script does not continue until the drive is fully ejected.
7 Close tray - the reverse of Eject. This will pull the drive tray back
in again. Your script does not continue until the drive has been
8 Get number of CD-ROM drives - returns the number of CD drives in the
system, normally 1.
9 Select current CD-ROM drive - changes the current CD drive to PARAM,
where PARAM ranges from 1 to (number of CD drives). All the other
CD Audio functions operate on the current CD drive.
NOTE: These CD Audio functions are slow compared to all the other script
functions. This will not be noticeable if you call them from most scripts,
but using CDAudio in a repeatedly_execute script will noticeably slow down
NOTE: If the game is run under plain MS-DOS, the user's CD-ROM driver will
need to be loaded in memory for these functions to work. If it is not, the
game assumes that there is no CD-ROM drive on the system.
NOTE: The Windows version of the engine only supports a single CD-ROM drive,
so functions 8 and 9 currently do not work.
Returns the number of the currently playing background music, or -1 if
no music is playing.
Returns 1 if the background music track is still playing. If you are using
the Repeat Music option, this will always return 1 since the music will
loop round when it finishes. Otherwise, this will return 0 once the
current track finishes.
Returns 1 if there is currently a sound effect playing. This could be
a manually started sound (eg. with PlaySound) or an automatic sound (eg.
If the sound has finished, or none was played, returns 0.
NOTE: Be careful with this function for actions like looping sounds, since
if the user doesn't have a sound card this will always return 0.
NOTE: This function does not report if background music is playing.
Returns whether the SPEECH.VOX file is being used by the game.
This could be useful if you have an optional speech download pack, and you want
to know whether the player has it or not.
Returns 1 if the speech files are available, 0 if not.
Example: (Check if the player has a talkie version of
the game )
if (IsVoxAvailable()==1)Display ("You have a
talkie version of the game");
else Display ("In order to hear the voices of the characters you have to
download the vox file from http:...");
PlayFlic (int flic_number, int can_skip_flag)
Plays a FLI or FLC animation. The game checks for FLICx.FLC and
FLICx.FLI (where X is FLIC_NUMBER) and if it finds one, plays it.
CAN_SKIP_FLAG has these meanings:
0 player can't skip animation
1 player can press ESC to skip animation
2 player can press any key or click mouse to skip animation
This is identical to the room interaction command "Play FLI/FLC %d". The game is
paused while the animation plays.
Example: (Let the player skip the flic number 2 by
pressing ESC )
PlayMusic (int music_number)
Changes the currently playing background music to MUSICx.MID, MUSICx.MOD
or MUSICx.XM (where X is MUSIC_NUMBER). The game will search for the files
in that order until it finds one to play.
PlaySound (int sound_number)
Plays a WAV or VOC sound effect. The game will search for SOUNDx.VOC
and SOUNDx.WAV (where x is SOUND_NUMBER) and play it. This is identical to
the room interaction command "Play sound %d".
Pass -1 as SOUND_NUMBER to stop any currently playing sounds.
SeekMODPattern (int pattern)
Jumps directly to PATTERN in the currently playing MOD/XM music. If the
pattern does not exist, the music will stop.
SetMusicMasterVolume (int volume)
Sets the overall music volume, from 0-100. This is slightly mofidied by the
individual room volume settings.
SetMusicRepeat (int loopflag)
Tells the system whether to repeat background music tracks. LOOPFLAG is
either 1 (repeat, default) or 0 (don't repeat).
SetMusicVolume (int volume)
Overrides the room volume setting and sets the volume to VOLUME instead.
The values range from 1 to 5, representing each stage in the RoomEdit
volume options (ie. 1=quietest, 5=loudest).
NOTE: The volume will be reset when the player enters a new room.
SetSoundVolume (int volume)
Sets the sound effect volume. VOLUME ranges from 0-255, where 255 is the
loudest. This also effects MP3, MOD and XM music.