ID:139866
 
Code:
        MusicVolume()
var/A = winget(src, "Options.MusicVolume", "value")
src.MusicVolume=round(A)
src<<"Music volume set to [round(src.MusicVolume)]%"


Problem description: For some reason, this verb is returning a value of 0 when I use the round proc. The verb executes by an adjustable bar. When I remove the round proc I get large values such as '27.284252'%. I'm trying to get it set to 27. Also, when I play the sound with the modified volume without rounding and having numbers such as the one above, the sound doesn't play at all. Here is the code I'm using to execute the sound.

src<<sound('Song.mid',1,0,0,src.MusicVolume)


When I leave the 'MusicVolume' unmodified without even laying a finger on the bar, the sound plays just fine. I can't seem to figure out whats the problem.
Use round(#,1) #=the number you're rounding

It may or may not work but it's worth a shot.
In response to Bravo1
Bravo1 wrote:
Use round(#,1) #=the number you're rounding

It may or may not work but it's worth a shot.

Thanks but no difference at all.
winget() is giving you a text string, not a number. You need to use text2num() to get a number out of it.
In response to Garthor
Garthor wrote:
winget() is giving you a text string, not a number. You need to use text2num() to get a number out of it.

Thanks ( : Learnin new things everyday ^.^