ID:155991
 
I've been trying for a while now to get the volume of all sounds in my game to change depending on a user defined variable. Like so:

mob
var
master_volume = 50
verb
SoundUpdate() // Updates when slider is adjusted.
var/volume = winget(usr,"control.slider","value")
usr.master_volume = round(volume,1)

//Sound code for all sounds played in-game.
usr<<sound('soundfile.wav', volume=usr.master_volume)
//usr.master_volume or src.master_volume depending on what it's under.


So I guess the overall question is, how will I be able to assign a variable to the volume portion of the sound proc. Because ever time I round the variable the value result is always "0" and if I don't the value results in decimals. Neither way works, every time I adjust the slider all throughout the game the sound mutes.

Need any further explanation just ask.
When I used "usr.master_volume" instead of "var/volume" which to my knowledge, I thought was a num var when I define it with a number.

BTW, thanks that helped. Usually the small stuff I forget..