Page 1 of 1

Stop Music

PostPosted: Fri Feb 25, 2005 9:18 pm
by Dark RyNo
Is there a way to stop music from playing once its started?
I tryed event disable but that didnt work.
Anyone know?
When I switch onto the end of level screen I need the music to stop.

PostPosted: Fri Feb 25, 2005 10:12 pm
by willg101
First of all, you need your music to be a sound.
Create a variable, say, "mysound".
In scrpit editor do this:

Code: Select all
mysound=PlaySound2("<sound file>", 1.000000, 1, 0.000000);

Use stopSound with mysound when you load a level.
Note: you cannot stop any music, only sounds.

PostPosted: Sat Feb 26, 2005 10:10 am
by Dark RyNo
I cant select my music in th play sound menu.
It must be because of the file extension.
surely there must be a way to stop music!
If not there should be in the next version.

PostPosted: Sat Feb 26, 2005 10:22 am
by jazz_e_bob
surely there must be a way to stop music!
If not there should be in the next version.


Use stopSound


You can stop music and sound with stopSound.

PostPosted: Sat Feb 26, 2005 1:56 pm
by Dark RyNo
I tryed this.
stopSound("LEVEL 1.mid");
it says illegal cast operation.

PostPosted: Sat Feb 26, 2005 8:59 pm
by jazz_e_bob
Nah nah nah. :)

Code: Select all
mysound = PlaySound2("<sound file>", 1.000000, 1, 0.000000);


then

Code: Select all
stopsound( mysound );

PostPosted: Sun Mar 06, 2005 3:51 pm
by Dark RyNo
i tryed that.
It came up like this:
music = PlayMusic2("C:\\Documents and Settings\\Ryan\\My Documents\\Games\\Mario\\data\\LEVEL1.MID", 1.000000, 99, HIGH_PRIORITY_MUSIC);

The pink bits are actually white. You just cant see white on here.
Theres an error in the script.
Im sure those colours cant be correct?

PostPosted: Sun Mar 06, 2005 8:21 pm
by jazz_e_bob
OK.

I have taken this example code from a working game. Give it a go.

PLAY
globalMusicChannel = PlayMusic2("data/walkakt1.mid", 1.000000, 335, HIGH_PRIORITY_MUSIC);


STOP
stopSound(globalMusicChannel);