Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

"(variable) is not defined" error

I'm writing a game in Twine 2 using Harlowe, and getting a problem when I am trying to add a checkpoint system.

My intro contains a passage to a place where the player can enter a code, and that will take them to the respective area.

This is the error I get (podroom is the code that I am having the user enter):
"☕ podroom is not defined►
This error message was reported by your browser's Javascript engine. I don't understand it either, but it usually means that an expression was badly written."

Here is my code for the "start at checkpoint" screen:
"(put: (prompt: "Enter a checkpoint code") into $checkpoint)
(if: $checkpoint is podroom)[Are you sure you want to start in the Escape pod room? Run down hallway (set: $podroom to true)]"

Also, to clarify, $podroom is the variable that I use to check if the user has started from a checkpoint.

Comments

  • The (if:) line is missing the quotes around the word podroom. It should be
    (if: $checkpoint is "podroom")[Are you sure you want to start in the Escape pod room? [[Yes|Run down hallway]] (set: $podroom to true)]
    

    Also, with your code the variable $podroom will be set to true even if they don't click on yes. Is that intentional?
  • Thanks, I have no experience with string variables. And I figured that since the player has no option but yes or the undo arrow it doesn't matter if I set it true right there.
Sign In or Register to comment.