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 / need help!!!!

Author
Message
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 8th Jan 2009 03:12 Edited at: 8th Jan 2009 03:19
this is my code and it keeps coming up with: Compilation Failed. Could not close nest at line 53.
[a=b

print "You wake up in a daze, you can't see anything."
print "You here a noise coming from up ahead."
print "Do you want to go and investigate? Y/N"
input answer1$

if answer1$=upper$("y") then goto noise_1
if answer1$=upper$("n")
cls
print "Since your scared I won't let you play."
print "Press any key to exit.Have a bad day."
wait key
end


rem This is first group of gotos
noise_1:
cls
print "You walk over and find a man."
input "The man aks for your name..."; Name$
print "Where would you want to go..."
input "Town";town1$

if town1$=upper$("town") then goto town1

town1:
cls
print "You walk out of the dark space into a small village."
print "You see a guild, a lodge, and a way to the forest."
print "You should go to the guild, and find out where you are."
set text to bolditalic
input "Where do you want to go?";location1$

if location1$= upper$("guild") then goto guild

guild:
cls
print "Welcome to the guild."
if a=b
print "Would you like to join?Y/N"
input answer2$
endif
if answer2$=upper$("y") then b=1

if a=1
print "Would you like to do a quest?"
endif
end]
Lucifer
18
Years of Service
User Offline
Joined: 26th Dec 2005
Location:
Posted: 8th Jan 2009 03:24 Edited at: 8th Jan 2009 03:26
you forgot to put an endif here :


try adding an endif command below that end..

in Austrlia, there is a really red sun, u got a red sun in sky too?
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 8th Jan 2009 05:00
how do you do the code snippet thing?
x1b
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location:
Posted: 8th Jan 2009 05:13
click on code button, paste your code, click on code button again.

top right hand corner of where you enter your message.

xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 8th Jan 2009 05:54
thx now i have a new problem:
it doesn't seem to work any suggestions.
Tone Dialer
Valued Member
19
Years of Service
User Offline
Joined: 17th Oct 2005
Location: England, well a town in it !
Posted: 8th Jan 2009 08:47 Edited at: 8th Jan 2009 21:03
@ xxelixx

The 'Endif' needs to be after 'Else', when an If statement is split over a number of lines it needs to follow the sequence, If, Else, EndIf.

Try this...



You are doing well, keep trying.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 9th Jan 2009 00:13
thx for the help
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 14th Jan 2009 00:22 Edited at: 14th Jan 2009 00:24
I have another problem when I type in the right answer it still doesn't move on to the noise_1


here's the code:
May0naise
16
Years of Service
User Offline
Joined: 16th Nov 2008
Location: Lost in Time
Posted: 14th Jan 2009 03:19
This is how i got it to work, i don't know why upper$ wasn't working, i never use it, anyway:

Change

to

-For this "" means it's not printing anything, but Im pretty sure its necessary

And I changed

To

-I basically just took out then, and moved goto noise1 down a line, then ended the 1st if statement. Also, if it didnt understand what the person typed, you had an input statement, not a Print statement.

I also took the Underscore out of "noise_1"

Hope i helped =P
May0

Who you chose to be around you, lets you know who you are.
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 14th Jan 2009 13:20 Edited at: 14th Jan 2009 13:21
Quote: "-For this "" means it's not printing anything, but Im pretty sure its necessary"


Incorrect. Printing text to accompany an INPUT statement is not necessary. For example, try the following code:



As you'll see, it makes no difference if text is included or not.

To elaborate on what May0naise said, this code:



Was wrong because you had an 'IF' statement nested within another 'IF' statement. Now, this is usually absolutely fine and works perfectly. However, you had it checking if the user had answered with yes and then, only if they had pressed yes, it would check if they had pressed no.

Thus, whatever happened, one of the two inputs would be false, which is why it wouldn't work.

One last thing, xxelixx. Use more meaningful titles for your posts next time, please. This makes it easier for people to find a solution which is specific to their particular problem in future when they use the search function.

Thanks,

Tom

xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 15th Jan 2009 01:29
@Tom0001
yeah sorry about that this was an early post
thx
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 15th Jan 2009 01:33
I just tried it and it still doesn't work


o well i don,t need it right now.
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 22nd Jan 2009 00:37
Ok I need a bit more help, when ever I run this code:
it always does the first (if) statement even if you press n.So what's wrong?
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 22nd Jan 2009 01:49


Not sure what you mean by that, and this may not be what's causing the problem, but look at it like this: This input in particular requires that there be one of two responses. Only one of these two responses can be true, thus two IF statements separately is not what should be used.

Since only one of these two conditions can be true at the same time, a better supplement would be:



Also note that using the "IF answer1$ = upper$("y")" will only work if the user inputs Y or N, not y or n in lowercase. To fix this, you should have a line above it of:

answer1$ = upper$(answer1$)

And then check IF answer1$ + "Y"

Good luck,

Tom
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 23rd Jan 2009 06:12 Edited at: 23rd Jan 2009 06:13
ok i got that all figured out.
thx

Login to post a reply

Server time is: 2024-11-25 12:16:47
Your offset time is: 2024-11-25 12:16:47