Sets the volume for playback of background music (see
Music).
local iVolume;
func Initialize()
{
iVolume = 100;
}
func Timer()
{
iVolume--;
MusicLevel(iVolume);
if(iVolume <= 0)
{
Music();
RemoveObject();
}
}
Script for an object which will fade out background music: the "Timer" function will decrease the volume step by step until it is 0. Then the music will be turned off and the helper object deleted.