[Solved] Parse error?

Started by arj0n, Tue 06/07/2010 10:54:42

Previous topic - Next topic

arj0n

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"){
}
}
}
}

Dualnames

Code: ags
else if (Label11.Text == "Chronological order, no loop"){ //You forgot a dot. Label11Text is what you had.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

arj0n

Darn. Thanx Dual but I still got the same error after adding the forgotten dot....

Khris

There's a missing } before the else if.

Indent your code:

Code: ags
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") {

    }
  }
}

arj0n

#4
Thanx Khris, that seemed to be the final problem.

SMF spam blocked by CleanTalk