Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Annoying nesting error keeps coming up!!!!

Author
Message
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 22nd Apr 2007 03:47
OK, I want to create a multiplayer NET game that I can play with my friends. Unfortunately, whenever I try to run my program, it says: "Syntax Error. Nesting Error at line 54." The thing is, there is no line 54. Also, when it says that, it highlights line 50! It's giving me an error on a line that is 5 more lines than my latest line. Does anyone know what is causing this?

What happens when when you mix baking soda, pop rocks, and water?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Apr 2007 04:30
This can be caused if you are using a #Include file with your program.

If you are not then it's just an error in error line reporting. This can sometimes be corrected by turning Sync off.

To do this, look for the command:

Sync On

in your program and if it's there, change it to:

Sync Off

Then see if the reported error line has changed. If not, post your code or download and try DBA Tidy here:

http://forum.thegamecreators.com/?m=forum_view&t=104344&b=5

It makes finding nested loops a little bit easier...

Note: Don't forget to change Sync Off back to Sync On when you've found and corrected the error.

TDK_Man

Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 22nd Apr 2007 06:40 Edited at: 22nd Apr 2007 06:43
Ummmmmm OK then I'll post my code since your "Tidy" program didn't work. Most of it is my cool administrative options.
I didn't finish all of it but I still like it so far

Yes, I know its a huge code

What happens when when you mix coke, pop rocks, vinegar, and baking soda?
I am currently working on 2 projects: The Ultimate Killing Game & The Turtle Game
NanoGamez guy
18
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 22nd Apr 2007 11:16
Try puting a 'return' at the end of the code.


Nothing is impossible...
No really, it isn't.
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 22nd Apr 2007 14:13
Put "end" after gosub mainmenu, because the program doesn't know where to terminate.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Apr 2007 15:05
Yes, it should have an end after Gosub Mainmenu to stop the program crashing into the functions, but that's nothing to do with the nesting error you are getting.

That's caused by having blocks of code (such as If..Endif's and loops), with starts but no ends.

For example, if your program has say 50 'For' lines, then there must be 50 'Next' lines. All Do's must have a Loop and so on.

A common error is to have a 'Then' on the end of a 'For' line, but forget that the 'Next' for that loop isn't then required. The program then has more Next lines than required - and you get a nesting error.

DBA Tidy merely makes the loops stand out so you can spot missing Next's, Loop's, Endif's, Endwhile's, EndSelect's and so on a lot easier.

TDK_Man

Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 22nd Apr 2007 19:00
ohhhhhhh. Because I originally thought that you end a gosub with a return.

What happens when when you mix coke, pop rocks, vinegar, and baking soda?
I am currently working on 2 projects: The Ultimate Killing Game & The Turtle Game
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Apr 2007 21:40
Quote: "I originally thought that you end a gosub with a return"


You end a procedure with a Return and call the procedure with a Gosub. Procedures start with a label - as in:



TDK_Man

Login to post a reply

Server time is: 2025-05-29 02:13:12
Your offset time is: 2025-05-29 02:13:12