# Problems with temp variables, help please!

**URL:** <https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592>\
**Category:** ChoiceScript Help\
**Created:** [July 25, 2021, 2:35pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592 "2021-07-25T14:35:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tuunetoon](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/tuunetoon/32/124018_2.png) [@Tuunetoon](https://forum.choiceofgames.com/u/Tuunetoon)\
**Post date:** [July 25, 2021, 2:35pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592/1 "2021-07-25T14:35:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![edelclere](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/edelclere/32/154548_2.png) [@edelclere](https://forum.choiceofgames.com/u/edelclere)\
**Post date:** [July 25, 2021, 2:39pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592/2 "2021-07-25T14:39:20Z")

</div>

`*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”)

---

<div class="post-metadata">

**Author:** ![sviyagin](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sviyagin/32/50885_2.png) [@sviyagin](https://forum.choiceofgames.com/u/sviyagin)\
**Post date:** [July 25, 2021, 3:42pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592/3 "2021-07-25T15:42:20Z")

</div>

Also note where @edelclere put the parenthesis.

> [@edelclere](#):
>
> `*if (alcohol = true)`

Instead of:

> [@Tuunetoon](#):
>
> \*if (alchohol) = “true”

* * *

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

> [@Tuunetoon](#):
>
> \*temp **alcohol** false

> [@Tuunetoon](#):
>
> \*temp **alcohol** true

> [@Tuunetoon](#):
>
> \*if ( **alchohol** ) = “true”

Emphasis added^

---

<div class="post-metadata">

**Author:** ![Gower](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/gower/32/21972_2.png) [@Gower](https://forum.choiceofgames.com/u/Gower)\
**Post date:** [July 25, 2021, 3:50pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592/4 "2021-07-25T15:50:02Z")

</div>

Even easier:

```
*if alcohol

```

---

<div class="post-metadata">

**Author:** ![sviyagin](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sviyagin/32/50885_2.png) [@sviyagin](https://forum.choiceofgames.com/u/sviyagin)\
**Post date:** [July 25, 2021, 3:52pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592/5 "2021-07-25T15:52:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/choiceofgames/original/3X/e/f/efe1497a762edecdb6d569a1c4abee87508bf002.png) [@system](https://forum.choiceofgames.com/u/system)\
**Post date:** [July 26, 2021, 3:52pm UTC](https://forum.choiceofgames.com/t/problems-with-temp-variables-help-please/104592/6 "2021-07-26T15:52:50Z")

</div>

Closed on July 26, 2021, 3:52pm UTC

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