Author Topic: Attempting to create a Global sound via sciaudio  (Read 6541 times)

0 Members and 1 Guest are viewing this topic.

Offline Cloudee1

Attempting to create a Global sound via sciaudio
« on: September 16, 2014, 09:01:17 PM »
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.
Code: [Select]
(use "sciaudio")
Then I created a global variable.
Code: [Select]
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.
Code: [Select]
(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.
Code: [Select]
(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.
Code: [Select]
(procedure public (shakeRattle)
// Print(950 6)
= rattleSound  TRUE
)

Now to trigger it from the actual roomscripts,
Code: [Select]
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.


Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline gumby

Re: Attempting to create a Global sound via sciaudio
« Reply #1 on: September 17, 2014, 10:43:32 AM »
Yeah, that seems like it should work just fine.  I'm going to have to play with it later to figure out why that's not working.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Attempting to create a Global sound via sciaudio
« Reply #2 on: September 17, 2014, 07:17:45 PM »
Cloudee, this worked fine for me.  Took the template game, put your code in and it worked without any modifications (except for the sound being played).

I wired in the call to the procedure to toggle the flag in the 'look' if statement in rm001.  I didn't test multiple rooms, but I should work.  I've zipped it up and attached it here.
« Last Edit: September 17, 2014, 07:19:17 PM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Cloudee1

Re: Attempting to create a Global sound via sciaudio
« Reply #3 on: September 18, 2014, 07:01:09 AM »
Well crap I wonder why it didn't work when I tried it. Going to give it another go around and see what happens. Kind of sucks really because I have already gone through about 20 rooms and added the play call to each of them. Good news I guess is that there are still more that I didn't add it to than there are ones I did.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.096 seconds with 23 queries.