I need help with a script error

Started by v3nge, Sun 21/02/2010 15:56:28

Previous topic - Next topic

v3nge

Hello, I just joined the forums becuase I came across a problem that I need help from a more experienced user with. I am getting the error "room4.asc(-10): Runtime error: Function still open, missing }" in this script:
//room script

function oObject1_AnyClick()
{
 int key;
 if (GetGlobalInt(key) == 2) {
 Display("Ypo have already chosen a key.");
}
else {
 SetGlobalInt (key,  1);
 oObject1.SetPosition(900, 900);
}

function oObject0_AnyClick;
{
 if (GetGlobalInt(key) == 1) {
 Display("You have already chosen a key.");
}
else {
  SetGlobalInt (key,  2);
  oObject0.SetPosition(900, 900);
}

function hHotspot1_WalkOn;
{
Penguin.StopMoving();
Penguin.ChangeRoomAutoPosition(3);
 Penguin.x = 145;
 Penguin.y = 145;
 Penguin.PlaceOnWalkableArea();
 Penguin.StopMoving();
}

Thanks in advance.  :)

NsMn

Always add 1 } after every function.
like, after the first one:
Code: ags

  oObject1.SetPosition(900, 900);
}
}

and then they will be closed and the error won't appear.

Rocco

Quote from: v3nge on Sun 21/02/2010 15:56:28

function oObject0_AnyClick; <-- wrong - also is one bracket missing in this function - format your code more clearly
{
 
   if (GetGlobalInt(key) == 1) {
   Display("You have already chosen a key.");
   }
  else {
  SetGlobalInt (key,  2);
  oObject0.SetPosition(900, 900);
    }
} - missing bracket

function hHotspot1_WalkOn;  <-- wrong
{
Penguin.StopMoving();
Penguin.ChangeRoomAutoPosition(3);
 Penguin.x = 145;
 Penguin.y = 145;
 Penguin.PlaceOnWalkableArea();
 Penguin.StopMoving();
}

Thanks in advance.  :)

function definitions should look like your first one -> function oObject1_AnyClick()
without semicolons

v3nge


SMF spam blocked by CleanTalk