parse error at "else"

Started by , Sun 14/03/2004 18:55:00

Previous topic - Next topic

Pzycho

Well, I was happily scripting away when this little wonder came up, I just can't work out what I've done wrong, this is where the problem is apparently:

-script beings-

function hotspot4_a() {
 // script for hotspot4: Interact hotspot
if (GetGlobalInt(2)==0)

SetGlobalInt (2, 1);
DisplaySpeech  (PZY , "what the hell is this and what is it doing in the sofa?");
AddInventory (4);

else

DisplaySpeech (PZY , "what are the odd's of finding TWO giant mushrooms in the sofa?");
}
 
-script ends-

don't ask me what's up with the giant mushroom, it makes sence in the game.

I realise it's probably something really painfully obvious, so thanks for your help.

Alynn

if (GetGlobalInt(2)==0)
{
SetGlobalInt (2, 1);
DisplaySpeech (PZY , "what the hell is this and what is it doing in the sofa?");
AddInventory (4);
}
else
{
DisplaySpeech (PZY , "what are the odd's of finding TWO giant mushrooms in the sofa?");
}


If you are doing more than one line of code you need to define the code blocks with the braces { and }

I added the second set just because you ended the code with a brace but doing
else DisplaySpeech (PZY , "what are the odd's of finding TWO giant mushrooms in the sofa?");
would also be acceptable.

Pzycho

oh fantastic, thanks for the help.

Ginny

Actually, the last brace belongs to the function, so make sure there are two braces at the end. Just pointing out. :)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

SMF spam blocked by CleanTalk