As is pointed out by @Turrican the video handle will continue to have a value. So this...
while(handle_intro_played){wait(1);}
...will continue forever.
while(media_playing(handle_intro_played)) {wait(1);}
This is pointless...
media_stop(handle_intro_played);
...as the media_play function is self terminating at end of file.
Try this..
while(1)
{
if(intro_played == 1)
{
intro_played = 0;
var handle_intro_played = media_play("demo.ogg",NULL,100);
while(media_playing(handle_intro_played)) {wait(1);}
start_loop1 = 1;
}
if(start_loop1 == 1)
{
start_loop1 = 0;
var handle_start_loop1 = media_loop("demo.ogg",NULL,100);
}
wait(1);
}
A handle is a reference to an engine object. Not the same but similar to a Pointer. A var set to a handle holds the same handle forever unless explicitly reset to some other value. i.e. var x= handle; x=NULL; --- Using a handler as a boolean value in a clause like WHILE or IF will always equal out to 1 unless the var holding has been reset.
Edit- One last point, you made the loop WHILE(1) ---> Does this loop really need to run forever? Isn't it better to terminate it at some point and save resources.