Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Technocrat on Sat 29/05/2010 09:55:48

Title: "Unexpected '}'"? But I don't have any of them!
Post by: Technocrat on Sat 29/05/2010 09:55:48

This is a strange one. Every time I try to compile, it complains about this one bit of script -

<222> if(UnitSelected>-1){
<223> if(SqContent[50]==5) Display("Hello");
<224>}
<225>

The game claims that, in line 223, there's an unexpected } but unless I'm going blind, I can see no such thing. I have many other similar instances of code all over the script, but this is the first time it's started complaining, even if I copy/paste it from other parts. What on earth is it complaining about, and how can I fix it?

The exact message it gives is:

GlobalScript.asc(223): Error (line 223): Unexpected '}'
Title: Re: "Unexpected '}'"? But I don't have any of them!
Post by: tzachs on Sat 29/05/2010 11:57:55
From my experience the error messages/lines given by AGS can sometimes be misleading.
Try looking at the lines before 222 and search for a missing/extra { or } or "...
Title: Re: "Unexpected '}'"? But I don't have any of them!
Post by: Dualnames on Sat 29/05/2010 14:07:15
No point at all, and it's definitely not what causes your thing, but I'd do that.

if ((UnitSelected>-1) && (SqContent[50]==5)) {
      Display("Hello");
}