Strange problem with 'Missing Brackets' error (SOLVED)

Started by Emerald, Fri 08/02/2008 18:53:11

Previous topic - Next topic

Emerald

I searched around the forum, and although I found some related threads, none of them helped, really.


The problem itself makes no sense. My current script works fine, and I can save the game without any errors.
But as soon as I change it even slightly, the whole thing unravels, even if I undo the changes immediately.

It gives me a "Nested function unknown - possible missing closing brackets" error (or something to that effect) and points me towards parts of the script which I'm sure work fine (and which I haven't altered in the slightest).

I know it's not a matter of a bracket simply being omitted, because everything works fine beforehand (and because I checked several hundred times...)



I feel like I'm missing something obscenely simple... I can't remember the code off the top of my head, but it's something like

function inventory xx() {
    GUIOn (3);
    CentreGUI (3);
}

Something simple like that. And I didn't even write the first part - I did it through the 'Interactions' -> 'Look at object' -> 'Run Script' action. And it works fine until I add a completely unrelated line of script elsewhere (also, that isn't the only block that's affected)

Matti

What exact line is the problem according to the error message?
This one: "function inventory xx() {"    ?

Emerald

yeah, basically. It points to all the lines starting with 'function' which I've added since starting this game. I can't post the exact code right now, but I'm wondering if something like this has been precedented, and I just didn't notice...

When I delete what it points to, it'll point to something else, until I've cleared pretty much everything I've scripted so far...

Radiant

The message means that you omitted a closing bracket at some point earlier in the code - specifically, in the previous function.

The easiest way to find this is to selectively /* comment out */ half of that function (take the other half, if this doesn't work at first), then progressively comment out smaller sections instead.

Emerald


Quotespecifically, in the previous function.

Ahh, that makes much more sense. Turns out it was a missing bracket about 40 lines back (I used 2 closing brackets instead of 3 - Coding is so goddamn anal retentive :P)

I don't know why it didn't just point me to line 88 (the problem) instead of line 131 (a totally unrelated function) though...

Thanks for your help, guys!

VK Dan

QuoteI don't know why it didn't just point me to line 88 (the problem) instead of line 131 (a totally unrelated function) though...
Mostly because it's very hard for the compiler to point out where something *missing* is. ;) All it could do was show you that there should not have been a function declaration at line 131.

Khris

Indent your code properly (AGS even does it for you automatically) and you'll find the anal probe will get retracted pretty quickly.

SMF spam blocked by CleanTalk