The goal is to create a sound that can be triggered in every room, without having to code it to every room. I tried several different ways and this one sticks out in my head that it should work. But I just can't seem to get it accomplished.
Most of this is occuring in the Main script. First off I added the bit to the top.
(use "sciaudio")
Then I created a global variable.
rattleSound = FALSE
Then in the doit method I added the bit about the playing the sound whenever the global variable was true, and of course make our variable false.
(if(rattleSound )
= rattleSound FALSE
(sndRattle:
command("play")
fileName("effects\\rattle.sciAudio")
volume("100")
loopCount("0")
init()
)
)
Of course I added the instance that defines our particular use.
(instance sndRattle of sciAudio(properties)(method (init)(super:init())))
Lastly in our main script, I created a simple procedure to be called from all of the other scripts.
(procedure public (shakeRattle)
// Print(950 6)
= rattleSound TRUE
)
Now to trigger it from the actual roomscripts,
shakeRattle()
So the theory is, call the procedure. It turns the global variable to TRUE. The doit method notices the true value and passes the play command and reset the variable to false. Simple enough of an idea really, just no matter what I have tried I keep getting an oops error.