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.

Newcomers DBPro Corner / Cant Close Nest

Author
Message
mad computer user
16
Years of Service
User Offline
Joined: 9th Nov 2008
Location: New Zealand
Posted: 17th Jun 2010 06:37 Edited at: 17th Jun 2010 07:21
Hey

Real noob here, iv had DBP for a while but haven't actually used it till now, and im making a small title generator because i can, im gonna have loads of options but i started small with just 4 of each(nouns and adjectives) but whenever i try to run it i get a "Could not close nest at line..." heres the code:


Any help appreciated

thanks
Keeghan
sneaky smith12
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Like id tell you, oh wait i just did
Posted: 17th Jun 2010 09:12 Edited at: 17th Jun 2010 09:12
Your problems lie with the last else statement of them...

You list Else Adjective = 4.
Since Else has no parameters "Adjective = 4" is unnecessary and also your problem.
What you could do is either just delete "Adjective = 4" or make the line read as: "Else : Adjective = 4"

The same is true for your noun line.

Also keep in mind that if you use Goto is your programs you will be eaten alive on this forum.

If at first you dont succeed, LOWER YOUR STANDARDS.
mad computer user
16
Years of Service
User Offline
Joined: 9th Nov 2008
Location: New Zealand
Posted: 17th Jun 2010 13:09
ok thanks

and i changed the goto to a do loop but now i just get a command out of place error, heres the code:

nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 17th Jun 2010 16:03
sneaky

At work at the moment so cant knock this up for you, but try having a look at CASE it might be more use to you.

If I remember the Syntax would be something along the lines of:


SELECT Adjective
CASE 1:
PRINT "aback ";

CASE 2:
PRINT "Wistful";

CASE 3:
PRINT "ruthless ";

ENDCASE

I cant remember off the top of my head whether DBPro has an OTHERWISE command to capture your default statement "Secretive ". If it doesnt just set a flag in the other case statements and use an if to capture this.
sneaky smith12
18
Years of Service
User Offline
Joined: 30th Apr 2006
Location: Like id tell you, oh wait i just did
Posted: 17th Jun 2010 16:24
Talk about reminiscence... I'm over here in QuickBASIC still

Either way... the problem lies with having 3 If statements and one EndIf statement. It probably flags at the last line because of this? That's because it should expect the endifs before the end of the loop.

So, I will own up to my previous mistake... Sorry!

Also with a Do... Loop like you have it will be so much better if you add a few of the following commands.

Just read the comments:



If at first you dont succeed, LOWER YOUR STANDARDS.
Digger412
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location:
Posted: 17th Jun 2010 16:50
@Nitrohaze - I think you're looking for case default

From help files:
nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 17th Jun 2010 19:34
Quote: "@Nitrohaze - I think you're looking for case default"


lol thats the one!
mad computer user
16
Years of Service
User Offline
Joined: 9th Nov 2008
Location: New Zealand
Posted: 17th Jun 2010 23:53
sweet, thanks so much sneaky smith12 works perfectly, made a few adjustments though, to the text only. And i assume that if i want more adjectives and nouns i just up the RND number and add more if statements?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Jun 2010 20:31
First of all, look up how to indent your code properly. You'd be surprised how much easier it is to spot nested loop errors. When your code is indented, they leap out of the screen and smack you in the face...

Quote: "And i assume that if i want more adjectives and nouns i just up the RND number and add more if statements?"


You might want to take a look at arrays and Data Statements for that.

TDK

mad computer user
16
Years of Service
User Offline
Joined: 9th Nov 2008
Location: New Zealand
Posted: 18th Jun 2010 23:42
ok, ill make sure to indent my code now, and i think in my other post about text files people are saying about data statements though i would prefer it to be an external file... any way thanks guys for your help
nitrohaze
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location:
Posted: 19th Jun 2010 13:31
MCU

Solution is now on your other thread.

http://forum.thegamecreators.com/?m=forum_view&t=171584&b=7

many regards.

Login to post a reply

Server time is: 2024-11-23 14:15:45
Your offset time is: 2024-11-23 14:15:45