Problems with temp variables, help please!

I’m having trouble with using temp variables.

The error I’m getting is: “Nonexistent variable alcohol”

My code looks like this:

#“You guys got any soda?” I say.
*temp alcohol false

#I drink some beer.
*temp alcohol true

*if (alchohol) = “true”
#“Because I’m drunk?”

This is all in one text file, but they don’t seem to recognize my temp variable… help?

*temp must be used at the very top of your scene.

*temp alcohol true

#"You guys got any soda?"
  *set alcohol false

#I drink some beer.
  *comment alcohol is already true, so no need to alter this.

*if (alcohol = true)
  #"Because I'm drunk?

Also, you shouldn’t put true in quotation marks (“true”) if you’re testing for whether a variable is true or false. Quotation marks indicate strings, which are a type of variable based on text only (e.g name = “Josh”, place = “Earth”)

3 Likes

Also note where @edelclere put the parenthesis.

Instead of:


And although she is absolutely correct that putting your *temps at the top of your scene file is best practice, I think the reason you are getting a non-existent variable error message here is because you misspelled your variable

Emphasis added^

5 Likes

Even easier:

*if alcohol
4 Likes

I’ve sometimes had trouble with *if (variable) for conditional #options in a choice, so I’ve made it a habit to write out the full condition all the time

4 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.