ID:147795
 
OK when I play a wave like
usr <<sound('Birds.wav',1)I want it to play as long as your in a spot but How can I stop the wav when Its needed to?
turf
Enter()
loopsound
usr <<sound('Birds.wav',1)
goto loopsound
In response to ZDarkGoku
ZDarkGoku wrote:
turf
Enter()
loopsound
usr <<sound('Birds.wav',1)
goto loopsound

This will cause and infinite loop, and (in most cases) will crash the game. Not to mention the evilness of GOTO. :P
In response to Malver
Malver wrote:
This will cause and infinite loop, and (in most cases) will crash the game. Not to mention the evilness of GOTO. :P

And the evilness of usr in Enter().

I'd suggest playing the sound with the repeat option on, and setting it to a specific sound channel (from 1 to 8). When you want it to stop, play "null" with wait=0 and the same channel specfied. (Not sure if this actually works, but if it doesn't then it should. =P )

<code>sound('blah.wav', 1, channel=3) //Turn on sound(null, wait=0, channel=3) //Turn off</code>