Ive been messing around with a few ideas from using a variable [PLAY sound#switch#.wav] where the variable #switch# is switched between 1 and 0 from a LeftMouseUpAction, and the names of the .wavs are the name + 1.wav (example = bell1.wav) This gave a nasty effect of when the variable was set to 0, it gave the Windows error sound seeings how there was no sound to play. Outside of creating a .wav that has no sound in it and naming it the corresponding file "bell0.wav" I'm coming up empty. That's not really an option I want to use when I know the solution is probably simple and is just eluding me.
In a nutshell, all sounds work fine, but a nice way to turn them all off and on with a master switch is the goal.
Here's the coding I have now trying wiggle in a master switch for one of the sounds (eventually for all of them) trying to use an EnableMeasure from a Measure so I can calc to see if the Variable is correct to Play the .wav
[Variables]
Num=0
tubes0=0
tubes1=1
TubeSound=1
[Image]
Meter=Image
ImageName=switch#Num#.png
LeftMouseUpAction=!Execute [!ShowMeter "MeterTubes#tubes1#"][!HideMeter "MeterTubes#tubes0#"][!SetVariable Num (1-#Num#)][!SetVariable tubes0 (1-#tubes0#)][!SetVariable tubes1 (1-#tubes1#)]
DynamicVariables=1
X=10
Y=29
W=50
H=72
[MeasureTubeSwitch]
Measure=Calc
Formula=#tubes0#
IfEqualValue=1
IfEqualAction=!Execute [!HideMeter "MeterTubes0"][!ShowMeter "MeterTubes1"][!EnableMeasure "MeasureAnimation"][!ShowMeter "MeterTubesStart"][!EnableMeasure MeasureFritzSwitch][!EnableMeasure "MeasureTubeSound"]
;---This is where I attempted to use another Measure [EnableMeasure "MeasureTubeSound"] to Calc if the variable #TubeSound# was set to 1 (play sound) or 0 ignore.
IfBelowValue=1
IfBelowAction=!Execute [!ShowMeter "MeterTubes0"][!HideMeter "MeterTubes1"][!DisableMeasure "MeasureAnimation"][!HideMeter "MeterTubesStart"][!DisableMeasure MeasureFritzSwitch][!HideMeter "MeterTubesFritz"][PLAY SwitchOff#TubeSound#.wav]
DynamicVariables=1
;---This [PLAY] command works fine, but will always PLAY every time-----
[MeasureTubeSound]
Measure=Calc
Formula=#TubeSound#
IfEqualValue=1
IfEqualAction=!Execute [PLAY TubesTurnOn.wav][DisableMeasure "MeasureTubeSound"]
DynamicVariables=1
;---And this would be the Measure that doesn't Play the .wav when enabled and Variable is set to "1"
ok that measure will [Play] any time I use a Measure LeftMouseUpAction button to set the Variable #TubeSounds# to 1 unless I put in a [PLAYSTOP] on that switch, but it seems this particular Measure won't fire off another measure that checks to see if the variable is correct to PLAY sound.
I suspect there is an entirely different method in approaching this.
Well......... IDK. After fiddling with this trying to find an elegant coding and looking at some other scripts that actually just toggle to a second script with no sounds, ekk!, Just simply having a doppelganger .wav file with no sound and with the same name except for a "0" instead of "1" at the end seems to work smoothly.
Now the actions will always PLAY a .wav, but weather if it's the sound for the event or a 1/10 second .wav of silence is determined by the variable. This seems a little clunky to me because of the extra .wav file needed per .wav, but no as icky as having the entire script toggle to another one with no sounds.
If there is coding way to do this without the extra .wav file, lemme know, this situation might come up again with something different and might not have "just make a second file called "filename0". Hell, as far as I know I figured out the simplest way to do it
I had considered that, but that brings me back to needing a Enable measure to Calc weather a Variable is set "turned off" to utilize PLAYSTOP rather then PLAY. Basically the same dilemma, just wasn't able to get it to work.
Interesting. Ive been working on other aspects of the skin I'm building and have just been using the sound1.wav/sound0.wav method for now, but that last suggestion just got me thinking. cool twist on it I hadn't thought about. screw with the actual bang as a variable. hmm. Everything are going to be based off of "switches" on a and off. so the same button clicked to turn on and off. But building this with giving the options to turn on/off so many different options, I knew the method I've bee using wouldn't eventually work for a master "everything off" switch. I'm going to have to play with that when I finally get this damn time consuming artwork aspect of the skin done. Too damn tedious, much more fun when I'm banging my head against a wall because of coding issues