• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows music and Rooms?

Dwighty4000

Member
Is there a way I can do, that I can play a music that does not restart every time if I enter a new Room?
The music "audio_play_sound(music, 100, true);" restart every time if the codeline: "room_goto(room1);" is in the same moment running...
 

Ricardo

Member
audio_play_sound returns a value which represents the music playing. You can store it in a global variable and then use audio_is_playing function to check it avoid the undesired behavior.
 

Chaser

Member
if !audio_exists(YOUR_SOUND) /// if the sound is playing it will DO NOTHING and if it isn't playing it will PLAY sound.
{
audio_play_sound(YOUR_SOUND,1,true);
}
else
{
// do nothing
}

Thats how i do it anyway, not the best way im sure, but hey, it works for me. :)
 

Chaser

Member
just read this again, Music that 'Restarts' every time you enter a room. My guess is here you have the same object that controls the music in EVERY room, so when the room starts it just restarts the music. Why not just have one object that controls your music thats at the beginning of your first room and make it 'Persistent'. That may work. :)
 
Top