
shadowslayer123
Joined: Feb 22, 2009
Not the american average
|
Posted: Jan 23, 2010 05:56 PM
Msg. 1 of 4
i am trying to make it so that when i activate a control panel, a sound plays. the problem is that when i activate it, it plays the first 2 seconds then it repeats itsself, and i cant stop it. here is my script: (script continuous play_song (sleep_until ( = (device_get_position "thewin") 1 ) ) (begin (sound_impulse_start "sound\ss\music\lolz\youwin" none 1)) )
if anyone knows how to fix it, help would be appreciated.
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Jan 23, 2010 10:08 PM
Msg. 2 of 4
That's because it's a continuous script. The moment the sound is played, the script loops and sleeps until the control panel is once again 1. But, since the control panel is already at 1, it just goes ahead and plays the sound again. And again. And again...
So, just add this line below (sound_impulse_start):
(device_set_position "thewin" 0)
This will set the device back to "0" so it doesn't automatically loop. You could still cut it short and restart it by hitting the switch again, but that doesn't really matter.
|
|
|

shadowslayer123
Joined: Feb 22, 2009
Not the american average
|
Posted: Jan 24, 2010 01:22 PM
Msg. 3 of 4
this didnt work, and i also made it a startup script, and the sound doesnt even play then
|
|
|

Gamma927
Joined: Jun 12, 2008
Steam: gamma927
|
Posted: Jan 24, 2010 02:32 PM
Msg. 4 of 4
(script startup play_song (sleep_until ( = (device_get_position "thewin") 1 ) ) (sound_impulse_start "sound\ss\music\lolz\youwin" none 1)) (device_set_position thewin 0) )
|
|
|