HELP! With coding please

Hi, so when I tested this and put the correct answer it said it was incorrect, what have I done wrong in the coding for it go that way, have I left something out? Please Help!!!

NARRATOR
Can you help out Detective Jones with the missing words?

    NARRATOR (DETECTIVE JONES)
During my visit I noticed some strange behaviour from Miss Simpson, upon offering me a glass of ...
Hmm what did she offer me again?

label Guess_Missing_Word_1

input What is the Missing Word? | What is the Missing Word? | Guess(MISSING WORD)

if (MISSING WORD is “Water”) {

    NARRATOR
Correct! You've guessed the Missing Word.

} else {
NARRATOR
Answer is incorrect.
Please try again.

goto Guess_Missing_Word_1

}

@overlay MISSING WORD 1 create
@overlay 6088026729218048_MISSING WORD 1 shifts to 170 229
@overlay 6088026729218048_MISSING WORD 1 scales to 0.388 0.388
@overlay MISSING WORD 1 opacity 1 in 2
@overlay MISSING WORD 1 moves to layer 2
NARRATOR (DETECTIVE JONES)
Yes that’s right.
Now, Before I left I pretended I needed to go to the bathroom,
However I went to investigate the closed off room.
I opened the door that had stairs leading to a …
Oh where was it again?
label Guess_Missing_Word_2

input What is the Missing Word? | What is the Missing Word? | Guess(MISSING WORD)

if (MISSING WORD is “Baesment”) {

    NARRATOR
Correct! You've guessed the Missing Word.

} else {
NARRATOR
Answer is incorrect.
Please try again.

goto Guess_Missing_Word_2

}

@overlay MISSING WORD 2 create
@overlay 6088026729218048_MISSING WORD 2 shifts to 168 208
@overlay 6088026729218048_MISSING WORD 2 scales to 0.316 0.316
@overlay MISSING WORD 2 opacity 1 in 2
@overlay MISSING WORD 2 moves to layer 2
NARRATOR (DETECTIVE JONES)
Oh yes of course.
That is when Miss Simpson pushed me down the stairs and locked me in a dark room.
With no way of getting out, I took the time to investigate the room,
I noticed that the time was …
Okay so what was the time then?
label Guess_Missing_Word

input What is the Missing Word? | What is the Missing Word? | Guess(MISSING WORD)

if (MISSING WORD is “2:00pm”) {

    NARRATOR
Correct! You've guessed the Missing Word.

} else {
NARRATOR
Answer is incorrect.
Please try again.

goto Guess_Missing_Word

}
@overlay MISSING WORD 3 create
@overlay 6088026729218048_MISSING WORD 3 shifts to 85 179
@overlay 6088026729218048_MISSING WORD 3 scales to 0.316 0.316
@overlay MISSING WORD 3 opacity 1 in 2
@overlay MISSING WORD 3 moves to layer 2

If you read it like a script. You’re saying that my correct choice leads to the else, which then the narrator says I’m incorrect and the label go-to loops back again. You have to change Narrator to you guessed correct in the else bracket and remove the goto loop and end that label.

1 Like

if (MISSING WORD 1 is “Water”) { So I remove this?

Where or should I say how would I do the you guessed incorrectly bit?

1 Like
1 Like

Make sure there is no goto the original label or it’ll loop back.

1 Like

Ok so apart from that how do I code it if they were to guess the wrong answer?

If they answered incorrect and it loops back again so they can try again then leave it the way it is.

Just make sure they aren’t stuck doing that if they can’t remember the clue at all. :joy:

So I found @Dara.Amarie template on Typed in Choices and there is a section on unlocking choices and that is where I got the code for what we have been discussing…

“Unlocking” typed-in choices!
Here I’ll show you how to “unlock” things by typing in the passcode, where readers cannot continue unless they type in the right words or numbers.
You’ll need to use labels, gotos, and the if/else code.

label unlock_code

input What is the passcode? | What is the passcode? | Unlock(CODE)

if (CODE is “Apple”) {

  NARRATOR

Correct! You’ve unlocked the door!

} else {

  NARRATOR

Code incorrect.
Please try again.

goto unlock_code

}

So I don’t understand where I went wrong.

I dont see there and error (but I might have mised something)

question - have you tested it in app?

Because the imputs do not apeaR ON THE PREVIEW so testing it only in preview might look like you have it wrong even the code is right (the preview eill not let you write the code at all and will directly jum to the wrong answer)

Isn’t the word spelled “Basement”?

2 Likes

took me a while but I got it.you forgot to puit label in the cdorrect answer.if you do not do it the script simply goes to the next line which is the incorect answer which will end up in endles loolp

label unlock_code

input What is the passcode? | What is the passcode? | Unlock(CODE)

if (CODE is “Apple”) {

  NARRATOR

Correct! You’ve unlocked the door!
goto open_door
} else {

  NARRATOR

Code incorrect.
Please try again.

goto unlock_code

}
[/quote]

label open_door
#here goes what happens if the code is correct

1 Like

Oops, thank you, lucky the overlay is spelt right.

2 Likes

You can’t have a space for the “answer” part. Change the space into an underscore

input What is the Missing Word? | What is the Missing Word? | Guess(MISSING_WORD)

if (MISSING_WORD is “Water”) {

and then fix the others also

1 Like

Thank you so much.

1 Like

Closed: Marked as solved by op @Katie36 :slight_smile: