Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AnasAbdin on Sun 20/09/2015 08:19:31

Title: Runtime error at line (-10) [solved]
Post by: AnasAbdin on Sun 20/09/2015 08:19:31
I got this error message and I have no idea what's causing it  :-\

Runtime error: Function still open, missing }    |     GlobalScript.asc     |    line -10

(http://i.imgur.com/cMKslhl.png)

AGS v3.3.3, December 2014
640*400 32 bit
Windows 7 Professional
Title: Re: Runtime error at line (-10)
Post by: AnasAbdin on Sun 20/09/2015 08:22:32
...heh! Found the effin bracket  :-[
Title: Re: Runtime error at line (-10) [solved]
Post by: Slasher on Sun 20/09/2015 10:10:04
Good (nod)

it also pays to save your game very often then you know instinctively your last scripting movements should an error occur ;)

Title: Re: Runtime error at line (-10) [solved]
Post by: AnasAbdin on Sun 20/09/2015 11:08:14
Thanks mate  ;-D
That's exactly how I figured it out.
Title: Re: Runtime error at line (-10) [solved]
Post by: Crimson Wizard on Sun 20/09/2015 15:18:08
How was it possible anyway? First, it sais "runtime error" - did it occur when game was run as opposed to compilation? If it did, then how did it compile at first place.
Second: line -10?

Can you give more info on how did this error occur? I think there might be something wrong with AGS.
Title: Re: Runtime error at line (-10) [solved]
Post by: Cassiebsg on Sun 20/09/2015 15:46:16
I often encounter "-" lines... assumed that's AGS way of saying that it's not sure which script line is the cause?
Can't remember in which occasions I often get that though, sorry.
Title: Re: Runtime error at line (-10) [solved]
Post by: AnasAbdin on Sun 20/09/2015 17:08:44
CW: I will mimic the same conditions to produce the same error and get back to you with this asap.
Title: Re: Runtime error at line (-10) [solved]
Post by: AnasAbdin on Mon 21/09/2015 06:29:29
Thanks Cassiebsg  for the note, and sorry for the double post  :-\
CW, here's exactly what I just did now:

I undid the addition of the bracket } which solved this topic. Then Ran the project (F5) and got exactly the same error:

(http://i.imgur.com/hLOLd5n.png)

(http://i.imgur.com/RTix0r4.png)

(http://i.imgur.com/kQc8H0p.png)

Then:

Quote from: AnasAbdin on Sun 20/09/2015 08:19:31
I got this error message and I have no idea what's causing it  :-\

Runtime error: Function still open, missing }    |     GlobalScript.asc     |    line -10

(http://i.imgur.com/cMKslhl.png)

AGS v3.3.3, December 2014
640*400 32 bit
Windows 7 Professional
Title: Re: Runtime error at line (-10) [solved]
Post by: Gurok on Mon 21/09/2015 07:00:16
From memory, AGS will classify an error as a runtime error if it doesn't have a line number associated with it. Presumably, this means it got to the end of the input stream without finding '}'.
Title: Re: Runtime error at line (-10) [solved]
Post by: Snarky on Mon 21/09/2015 08:57:26
AnasAbdin, I think what would be useful here is to know where the bracket was missing, e.g. from the first function in GlobalScript (and was it the bracket containing the whole function or an internal bracket?), the last function, somewhere in the header, or what.
Title: Re: Runtime error at line (-10) [solved]
Post by: Crimson Wizard on Mon 21/09/2015 09:24:58
Quote from: Snarky on Mon 21/09/2015 08:57:26
AnasAbdin, I think what would be useful here is to know where the bracket was missing, e.g. from the first function in GlobalScript (and was it the bracket containing the whole function or an internal bracket?), the last function, somewhere in the header, or what.
Yes, this is what I wanted to know :).
Title: Re: Runtime error at line (-10) [solved]
Post by: MiteWiseacreLives! on Mon 21/09/2015 09:57:37
I get those negative line errors when I forget a closing bracket at the bottom of a script. :-\ But get Anas' story none-the-less
Title: Re: Runtime error at line (-10) [solved]
Post by: AnasAbdin on Mon 21/09/2015 11:09:07
ok sorry about that.
The bracket was missing from the last function in the Global.asc

The structure of the function is like this:


function pyramid_bgo_OnClick(GUIControl *control, MouseButton button)
{
while ( ... )
{
...
...
if ( ... )
{
...
}
else
{
if ( ... )
{
...
}
else
{
...
return;
}
}
}
...
...
}  // <-- this was the forgotten bracket & the final line in the script
Title: Re: Runtime error at line (-10) [solved]
Post by: Crimson Wizard on Mon 21/09/2015 11:17:16
Okay, thank you, I could reproduce by putting this in the end of the script:
Quote
void F()
{

I will open a new issue, because the error message should be fixed.
Title: Re: Runtime error at line (-10) [solved]
Post by: AnasAbdin on Mon 21/09/2015 11:18:48
Thanks Crimson really appreciate it  :)