Community
SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on February 13, 2020, 08:20:02 AM
-
This is mainly a question for Gumby, since he made the SCIAudio script. I was wondering a couple things:
1. How would I set up a volume toggle for the audio. Everything in the script (including volume) is set to -111, and that baffles me.
2. Assuming the volume can be toggled easily, could I do this without having to load the SCIAudio script at all times? Since the volume would be accesed via the menubar, would it be as easy as setting up a global variable and using that in the SCIAudio script?
-
Perhaps store it as a global and every time you invoke an sciAudio script have the first thing the script does is to get the volume variable?
-
So volume can be a value from 0 to about 300. If it's set to -111 that indicates to use the default of 100? To retain the selected volume setting in-game between rooms/scripts, a global in main sounds right to me.
-
So volume can be a value from 0 to about 300. If it's set to -111 that indicates to use the default of 100? To retain the selected volume setting in-game between rooms/scripts, a global in main sounds right to me.
Cool, got it. That explains the -111 I see all through the script.
I'm a little confused still. In the properties I see the following (In Studio Script, which I'm using for BA 1):
(class sciAudio
(properties
command -111
fileName -111
soundClass -111
volume 9000//-111
fadeInMillisecs -111
fadeOutMillisecs -111
loopFadeInMillisecs -111
loopFadeOutMillisecs -111
loopCount -111
conductorFile -111
playXFadeOutMillisecs -111 // used only for playx command
)I've set Volume to -111, -1, 0, 300, 9000 and at no time did it make any difference to the sound volume. I'm assuming it's checked and set elsewhere also, but all I can find is:
(if(<> volume -111)
StrCat(@msgBuf " volume ")
StrCat(@msgBuf volume)
StrCat(@msgBuf "\n")
)And I'm just not sure what this does.
-
I'm a little confused still. In the properties I see the following (In Studio Script, which I'm using for BA 1)
Have you considered converting to Sierra script? It would be a good excuse to familiarize yourself with it.
-
I'm a little confused still. In the properties I see the following (In Studio Script, which I'm using for BA 1)
Have you considered converting to Sierra script? It would be a good excuse to familiarize yourself with it.
I'm using Sierra Script for the follow-up, but this one was written in the old code and I don't want to go through the process of transcribing it again and then dealing with the compilation errors.
-
I took a look as to how I controlled volume in 120 Below. Make sure your command looks something like this, note that you need quotes around the numerics:
// Play the music
(send snd:
command("playx")
fileName("music\\snow.sciAudio")
volume("10")
loopCount("-1")
init()
)
When I fiddled with the volume and pumped it up to 200, I was able to hear that the volume increased. For additional troubleshooting, verify that the COMMAND.CON file in the sciAudio folder looks something like this:
(sciAudio
command stop
soundClass noSoundClass
)
(sciAudio
command play
fileName "music\snow.sciAudio"
soundClass noSoundClass
volume 10
loopCount -1
)
-
Thanks Gumby. By the looks of it, I will have to have the SCIAudio script at all times loaded to have a volume setting.
Also, when you do this change with playx, will that start the song over in order to adjust the volume?
-
For what I think you want (changing volume on-the-fly), try using the 'change' command which should allow you to adjust the volume of a currently playing sound file. This should work:
(send snd:
command("change")
fileName("music\\snow.sciAudio")
volume("50")
init()
)
-
For what I think you want (changing volume on-the-fly), try using the 'change' command which should allow you to adjust the volume of a currently playing sound file. This should work:
(send snd:
command("change")
fileName("music\\snow.sciAudio")
volume("50")
init()
)
Ah! Perfect. Now the only issue is the added heap to the rest of the game
-
I'm a little confused still. In the properties I see the following (In Studio Script, which I'm using for BA 1)
Have you considered converting to Sierra script? It would be a good excuse to familiarize yourself with it.
I'm using Sierra Script for the follow-up, but this one was written in the old code and I don't want to go through the process of transcribing it again and then dealing with the compilation errors.
Leave that to me. I've been working to convert the game to Sierra Script. I've already replaced the system scripts with those from my newer SCI0 template, and have moved the sciAudio, InitRooms, and Dying scripts into the 800 range (since they're not actually system scripts). Things like the custom window will have to be re-implemented into specific instances.