: : Ya thats what i was thinking...did you simply change it, or did you have to kill it and replay it again?
: : Oh and if you find a better way to kill the music than just killing all sounds, let me know...
: Instead of kill all sounds you can use sound_set_kill, like this...
: &music is a global, so is &track, I copied your idea of using &music as a local variable too, but have yet to determine what, if any advantages/diadvantages this has.
: //script 1, to start song1 rolling
: void main(void)
: {
: int &music = playsound(2,22050,0,0,1);
: sound_set_survive(&music, 1);
: &track = &music;
: &music = 1;
: }
: //script 2, to stop it
: void main(void)
: {
: if (&music == 1)
: {
: sound_set_kill(&track);
: }
: }
: So, I wonder if that is better or worse than killing all sounds? I suppose, if you had another sound_set_survive running, like maybe dink saying "ow,ow,ow" cuz he was walking on hot sand, then using sound_set_kill would allow you to stop the music, but keep the "ow,ow,ow" going. Whereas killing all sounds would stop them both. I haven't tried this yet though.
: And here is an interesting note, no pun intended,
: I tried adding the line
: load_sound("song2.wav", 2);
: at the end of script1 in hopes that when song1 went to repeat it would simply start playing song2, but no, it keeps playing song1. Further, using playsound(2,22050,0,0,1); in a another script, without having told song1 to stop, actually lets both songs play at the same time! I guess this is because song1 is still loaded into memory.
: Of what value this is, I don't know. I suppose it could mean that changing songs at screen changes could be done much faster, but having both songs loaded into memory at the same time might cause the game to run slower. Seems like a six of one, half a dozen of the other situation.
: In short, you can have both songs loaded into memory at the same time, on the same bank, it just means that your next playsound command will play the song most recently loaded. And if you don't ever kill the first song, you'll have both playing at the same time.
Ok, very interesting on the loading over sounds..hrm..
About your script...if you were to call track in another script, wouldn't it need to be a global like music?
And i think it would be easier to just do:
void main(void)
{
&track = playsound(2,22050,0,0,1);
sound_set_survive(&track, 1);
&music = 1;
}
//script 2, to stop it
void main(void)
{
if (&music == 1)
{
sound_set_kill(&track);
}
}
I'm going to try this out some time...so ya...if you try it first, let me know..just start a new thread tho.