# NON- EXISTENT VARIABLE Error, NEED HELP

**URL:** <https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721>\
**Category:** ChoiceScript Help\
**Created:** [July 6, 2018, 1:44am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721 "2018-07-06T01:44:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ssachi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/ssachi/32/62355_2.png) [@Ssachi](https://forum.choiceofgames.com/u/Ssachi)\
**Post date:** [July 6, 2018, 1:44am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/1 "2018-07-06T01:44:22Z")

</div>

I’m having trouble with my choicescript and I keep getting the non- existent variable error for “house”. Where it says “\*if House Ruddhale” I keep getting the error, however, I feel as if I don’t need to create the create variable thing in the startup. Need Help **strong text**

My code looks like this:

```

*temp alliegance_name
*set alliegance_name "override_alliegance"
*if House Ruddhale
  *set alliegance_name "House Ruddhale"
*if override_alliegance = "None"
  *if alliegance = House Stone
    *set alliegance_name "House Stone"
    *goto name
  *elseif alliegance = House Mallor
    *set alliegance_name "House Mallor"
    *goto name
  *elseif alliegance = House Crowe
    *set alliegance_name "House Crowe"
    *goto name

```

---

<div class="post-metadata">

**Author:** ![MeltingPenguins](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/meltingpenguins/32/255855_2.png) [@MeltingPenguins](https://forum.choiceofgames.com/u/MeltingPenguins)\
**Post date:** [July 6, 2018, 1:47am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/2 "2018-07-06T01:47:59Z")

</div>

It should be

```
*if (house = "name")
And
*if (allegiance = "thing")

```

The creates at the startup look like this:

```
*create house ""
*create allegiance ""

```

?

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [July 6, 2018, 2:29am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/3 "2018-07-06T02:29:20Z")

</div>

> [@Ssachi](#):
>
> ```choicescript
> *if House Ruddhale
> *set alliegance_name "House Ruddhale"
> 
> ```

Can I ask, what do you want to achieve with this code?

I mean, what do you want to do?

* * *

Because the code `*if House Ruddhale` itself is too ambiguous. What kind of situation you want the code to check?

---

<div class="post-metadata">

**Author:** ![Ssachi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/ssachi/32/62355_2.png) [@Ssachi](https://forum.choiceofgames.com/u/Ssachi)\
**Post date:** [July 6, 2018, 4:33am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/4 "2018-07-06T04:33:51Z")

</div>

I want to make it so that if your alliegance, a variable in my game, is with House Ruddhale that’s what will be displayed in the stat chart, or if it is with another House such as House Crowe it will display that as your allegiance in the stat chart.

---

<div class="post-metadata">

**Author:** ![Ssachi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/ssachi/32/62355_2.png) [@Ssachi](https://forum.choiceofgames.com/u/Ssachi)\
**Post date:** [July 6, 2018, 4:33am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/5 "2018-07-06T04:33:58Z")

</div>

I’ll see if it works thanks for helping

---

<div class="post-metadata">

**Author:** ![Hazel](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/hazel/32/77796_2.png) [@Hazel](https://forum.choiceofgames.com/u/Hazel)\
**Post date:** [July 6, 2018, 7:21am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/6 "2018-07-06T07:21:06Z")

</div>

MeltingPenguins is correct. Your problem is that you have two _values_ with no _comparator_. The expression that follows \*if has to be something that evaluates to either true or false. That means a variable, a comparator, and an immediate value that the variable is being compared to. The value, if it’s pure text, has to be surrounded by quote marks - otherwise the code parser has no way to tell that it’s not a variable itself.

_That’s_ where the ‘non-existant variable’ error comes from.

When you’re thinking ‘I need to check whether the MC belongs to House Blar’, translate that thought into ‘I need to check if the variable house has a value that’s equal to Blar’.

---

<div class="post-metadata">

**Author:** ![kirakana](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kirakana/32/53428_2.png) [@kirakana](https://forum.choiceofgames.com/u/kirakana)\
**Post date:** [July 6, 2018, 7:29am UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/7 "2018-07-06T07:29:19Z")

</div>

At the start of startup.file use:

```
*create alliance ""

```

Somewhere in story text use:

```
Who will you ally with?

*fake_choice
  #House Ruddhale
    *set alliance "Ruddhale"
  #House Crowe
    *set alliance "Crowe"

```

In stats screen use:

```
Your ally: House ${alliance}

```

_If player chose House Crowe in the story, this should read as:_  
Your ally: House Crowe

_If your player is not allied with anyone, it will say:_  
Your ally: House  
_instead._

You can use this code in stats screen to avoid the last mentioned scenario:

```
*if (alliance = "Crowe")
    Your ally: House Crowe
*if (alliance = "Ruddhale")
    Your ally: House Ruddhale

```

---

<div class="post-metadata">

**Author:** ![Ssachi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/ssachi/32/62355_2.png) [@Ssachi](https://forum.choiceofgames.com/u/Ssachi)\
**Post date:** [July 6, 2018, 12:05pm UTC](https://forum.choiceofgames.com/t/non-existent-variable-error-need-help/40721/8 "2018-07-06T12:05:00Z")

</div>

YOU ARE A LIFESAVER this way was the best for my current “skill level” aka it was super easy and although it took 3 hours Its finnaly over and thanks to everyone that helped out.
