Hi. I'm trying to program a game for my class, but I'm having some problems.
What I have the game do so far is to first ask your name. You type it in. Then it will ask you if you are sure that this is your name (like a confirmation thing to make sure you didn't spell your name wrong). If you put in the letter y, then it will take you to start the game. If you put in the letter n, then it restarts so you can input your name correctly. If it's neither y or n, then it will tell you that it doesn't understand your response and to type it in again. Here is the code for that:
ResponseSection:
cls 0
do
ink rgb(255,255,255),0 : set text font "times" : set text size 20 : set text to bold : set text transparent
center text 320,140,"BEFORE WE BEGIN..."
center text 320,220,"NAME: "+myName$ : Rem Display the name
ink rgb(255,0,0),0 : center text 320,350, "IS THIS NAME CORRECT? PLEASE TYPE Y or N"
ink rgb(255,0,0),0 : set cursor 315,375
input myResponse$
if myResponse$ = "y"
goto StorySection : rem If 'y' is entered, then start the game.
endif
if myResponse$ = "Y"
goto StorySection : rem Just in case caps lock is on and Y is entered, start the game anyway.
endif
if myResponse$ = "n"
for y = 1 to 40
center text 320,400, "THEN PLEASE RETYPE YOUR NAME."
sync
next y
goto OptionsSection : rem If 'n' is entered, then go back to the Options Section to retype your name.
endif
if myResponse$ = "N" : rem Just in case caps lock is on and N is entered, retype your name anyway.
for y = 1 to 40
center text 320,400, "THEN PLEASE RETYPE YOUR NAME."
sync
next y
goto OptionsSection
endif
if myResponse$ <> "y"
for x = 1 to 50
center text 320,425,"I DON'T UNDERSTAND WHAT YOU SAID."
center text 320,450,"PLEASE TYPE Y OR N TO INDICATE YOUR RESPONSE."
sync
next x
goto ResponseSection
endif
loop
REM REFRESH SCREEN
sync
loop
If you put in y, then it's supposed to take you to the story section, where it tells you the story of the game. Here is the code for that:
StorySection:
cls 0
do
ink rgb(255,255,255),0 : set text font "times" : set text size 20 : set text to bold : set text transparent
center text 320,100,"You are a foreign exchange student who just transferred to America."
center text 320,110,"However, the school district that you've transferred to believe in"
center text 320,120,"perfection in their English speaking skills. You learned the English"
center text 320,130,"language prior to your transfer, but you are still learning. Get through"
center text 320,140,"each day while being mocked and ridiculed by the school. Will you prove"
center text 320,150,"them wrong and be accepted? Or will you fail and prove them right?"
center text 320,170,"When talking to someone, press any key to go foward in that conversation."
center text 320,180,"If prompted a question, then you will have multiple choices where"
center text 320,190,"you choose which letter you think is the correct answer. You may also have"
center text 320,200,"to type in your full answer if there are no multiple choices. How well or"
center text 320,210,"poorly you do may affect what will happen to you."
loop
do
x=scancode() : if Keystate(x)=1 then goto BeginningDayIntroSection
sync
loop
The problem I'm having is that whenever I type in my name and it asks for my response, whenever I press y to confirm my name, the game freezes completely and I'm unable to do anything else. If I hit n, then it goes back to typing in your name like it's supposed to. Also if I press something other than n or y then it'll tell me that it doesn't understand, also like it's supposed to. It's just the y function that's messing up. Can anyone tell me why it's doing this?