Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: arj0n on Tue 06/07/2010 10:54:42

Title: [Solved] Parse error?
Post by: arj0n on Tue 06/07/2010 10:54:42
Why is this litle code resulting in a parse error?:

Error:"GlobalScript.asc(72): Error (line 72): PE04: parse error at 'else' [Line72 is the "else if" line]

Code:
function repeatedly_execute() {
mouse.UseModeGraphic (eModePointer);
if (Label11.Text == "Random order, infinite loop"){
 if (IsTimerExpired(1)) player.ChangeRoom(Random(4) + 1); // (highest room number-1) + (1)
 if (IsGamePaused() == 1) return;

 if (IsKeyPressed(eKeyEscape)){
   mouse.Visible = true;
   QuitGame(1) ;
   mouse.Visible = false;
else if (Label11.Text == "Chronological order, no loop"){
}
}
}
}
Title: Re: Parse error?
Post by: Dualnames on Tue 06/07/2010 11:01:15
else if (Label11.Text == "Chronological order, no loop"){ //You forgot a dot. Label11Text is what you had.
Title: Re: Parse error?
Post by: arj0n on Tue 06/07/2010 11:11:56
Darn. Thanx Dual but I still got the same error after adding the forgotten dot....
Title: Re: Parse error?
Post by: Khris on Tue 06/07/2010 11:22:04
There's a missing } before the else if.

Indent your code:

function repeatedly_execute() {
  mouse.UseModeGraphic (eModePointer);
  if (Label11.Text == "Random order, infinite loop") {
    if (IsTimerExpired(1)) player.ChangeRoom(Random(4) + 1); // (highest room number-1) + (1)
    if (IsGamePaused()) return;

    if (IsKeyPressed(eKeyEscape)) {
      mouse.Visible = true;
      QuitGame(1) ;
      mouse.Visible = false;
    }                            //   <<--- ### WAS MISSING
    else if (Label11.Text == "Chronological order, no loop") {

    }
  }
}
Title: [Solved] Re: Parse error?
Post by: arj0n on Tue 06/07/2010 11:27:08
Thanx Khris, that seemed to be the final problem.