Here is the code for my intro page. The goal is for one background to shown for 12 seconds, then a sound plays and the screen changes again. The sound plays, but the screen doesn't change. I have the background loaded in the animation files. And I figure repeatedly execute is the correct location for this code, since it is dependant on the timer changing.
function room_a() {
// script for room: Player enters screen (before fadein)
SetTimer (1, 12*GetGameSpeed());
SetBackgroundFrame (0);
}
function room_b() {
// script for room: Repeatedly execute
SetCursorMode (8);
if (IsTimerExpired (1) ==1) {
PlaySound (1);
}
if (IsTimerExpired (1) ==1) {
SetBackgroundFrame (1);
}
}
You see IsTimerExpired (1) returns 1 only first time you call it therefore you need to place all the code inside the whole if () {}:
function room_b() {
// script for room: Repeatedly execute
SetCursorMode (8);
if (IsTimerExpired (1) ==1) {
   PlaySound (1);
   while (IsSoundPlaying()==1) Wait(1); //wait for sound to finish playing
   SetBackgroundFrame (1);
}