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 / Could not close nest line...

Author
Message
Mr Potato
14
Years of Service
User Offline
Joined: 3rd Feb 2010
Location:
Posted: 27th May 2010 06:15
No matter how much I try to do this, I just don't get what I'm doing wrong.Begin:
print "This game you are about to take part in will work in to what you're searching for: the item I made you. Work through this game, and you'll understand."
input " " ;input1$
goto Begin1

Begin1:
CLS
print "Press enter to begin the first test."
input " " ;input2$
CLS
goto Test1p1

Test1p1:
print "Test 1"
print "Test 1 will test your problem-solving abilities."
print "Do you understand?"
input "> " ;input3$
if input3$ = "Yes" then goto Test1p2
if input3$ = "Yes." then goto Test1p2
if input3$ = "yes" then goto Test1p2
if input3$ = "yes." then goto Test1p2
goto Confused1

Confused1:
CLS
print "Well, I guess you don't understand."
print "Try again: "
goto Test1p1

Test1p2:
print "Good. Now, this test will test your endurance. When you're ready, press enter."
input " " ;input4$
CLS
print "Press the space bar this many times: " "100"
space = 100
input " " ;input5$
if spacekey()= 1
do space = space -1
endif
if space = 0 then goto Test1p3
endif


Test1p3:
CLS
print "Good!"
wait key
zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 27th May 2010 16:55 Edited at: 27th May 2010 16:56
These are were you are getting problems from:
do space = space -1
endif
if space = 0 then goto Test1p3
endif

The "DO" is only for "DO"-"LOOP"s.

The endif there needs to be deleted. On the line before, if space = 0 then goto Test1p3 already takes care of the "endif" because the outcome of the statement is already on the same line.

Example:


I see what you are trying to do at the end. You might try this at the end:


Hopefully this helps!

My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 28th May 2010 01:08
CoughMist Good job!
Mr Potato Get away from goto use gosub when you need it!Use CODE button in the mostright above emotes :


Where there is a will, there is a way.
I often edit my posts, that`s who i am
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 29th May 2010 11:41 Edited at: 29th May 2010 12:06
@Mr Potato - you might be wondering why using gosub is fine but goto isn't ...

I see it like this - imagine you are the foreman in a workshop and you have just taken on a new apprentice - if you simply tell that new apprentice to go over to the processing plant - the equivalent of 'goto newplant' - chances are he'll get lost or maybe go down the pub and get blabbared or something instead. However, if you tell him to go to the processing plant, do a specific task and report straight back to your office when done - this time 'gosub newplant', chances are you won't lose him for the day. see the difference?

In the fun game of computer programming, your code is the new apprentice and you're the foreman charged with making it work efficiently. hope this helps, owlman

if effort>reward : gosub home : endif
Levanthus
21
Years of Service
User Offline
Joined: 17th Apr 2003
Location: Cumbria, UK
Posted: 30th May 2010 19:19
That has to be the best example of gosub ever...

Windows 7 64 bit, AMD Phenom II x4 Black edition, 4 GB Ram, Radeon HD 4650, 540 GB HDD

I can see from your smile, you're not here for the sunset.

Login to post a reply

Server time is: 2024-09-28 18:17:21
Your offset time is: 2024-09-28 18:17:21