Weird errors in room script

Started by Tomatoworm, Mon 14/11/2011 19:10:57

Previous topic - Next topic

Tomatoworm


The last time I opened my game it seemed to work fine ,but now for some reason I keep on getting errors whenever I try to run it. It is really frustrating, because it seems to choose random lines even if they are correct :-[. Sometimes it even says there is an error on line -10! I tried the game on different computers and reinstalled AGS. Has anyone else had this problem?

Khris

Quote from: Tomatoworm on Mon 14/11/2011 19:10:57even if they are correct

Believe me, they aren't (because if they were, you wouldn't get compiler errors, see?)

Line -10 means you have forgotten a closing quote at the end of a string somewhere.
It's almost always something along the lines of:
Code: ags
  Display("This will throw an error.);


Please post the offending line and surrounding ones next time, and mention the exact error you get (why oh why do we keep having to mention this...?)
And here's the very first result of a forum search for "line -10" in the beginner's tech: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=40671.msg537579#msg537579

Welcome to the forums :)

Tomatoworm

Thank you for the reply! :) Here is the line I've been having trouble with:

function oOpenDoor_Interact()
{
cBert.Walk(171, 240, eBlock, eWalkableAreas);
oOpenDoor.Visible = false;
GiantDoor.Visible = true;
RemoveWalkableArea(2);
RestoreWalkableArea(3);
}

The error says "Nested functions not supported (you may have forgotten a closing brace)". It refers to the top line.

Gilbert

Please post more codes, mainly the part before those you have just posted. It's usually mistakes in the codes above that cause this error.

Khris

Yes, that error suggests you haven't closed the function before the one you posted.
You can see a bracket's counterpart by moving the cursor next to it and pressing Ctrl+B.

I would also recommend you indent your code; if you do this properly from the start you'll save yourself heaps of trouble:

Code: ags
function oOpenDoor_Interact()
{
  cBert.Walk(171, 240, eBlock, eWalkableAreas);
  oOpenDoor.Visible = false;
  GiantDoor.Visible = true;
  RemoveWalkableArea(2);
  RestoreWalkableArea(3);
}

Tomatoworm

I finally got the script to work! You were right the error was in the line above. Thank you for all your help!!  ;D

SMF spam blocked by CleanTalk