# Difference between codes

**URL:** <https://forum.choiceofgames.com/t/difference-between-codes/11574>\
**Category:** ChoiceScript Help\
**Created:** [August 26, 2015, 2:55pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574 "2015-08-26T14:55:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuvalbab](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/yuvalbab/32/16784_2.png) [@Yuvalbab](https://forum.choiceofgames.com/u/Yuvalbab)\
**Post date:** [August 26, 2015, 2:55pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/1 "2015-08-26T14:55:01Z")

</div>

Hey everybody,

I created a “heat” variable and for some reason it wont work. the strange part is, that my “health” variable works just fine yet I cant find ANY Difference between the two codes. why is one working and the other one dont? and how do I fix it? Thanks

The “heat” code:

```
*temp heat_text

*if heat = 0
  *Set heat_text "Anonymous"
  *goto chart
*elseif heat = 1
  *Set heat_text "Barely heard of"
  *goto chart
*elseif heat = 2
  *set heat_text "Well known"
  *goto chart
*elseif heat = 3
  *set heat_Text "Wanted"
  *goto chart
*elseif heat = 4
  *set heat_text "Public Enemy"
  *goto chart
*elseif heat = 5
  *set heat_text "International Sensation"
  *goto chart

```

and in the top of startup:

```
*create heat 0
*create heat_text ""

```

And the “health” code:

```
*temp Health_text

*if Health = 0
  *set Health_text "Uninjured"
  *goto chart
*elseif Health = 1
  *set Health_text "Just a Scratch"
  *goto chart
*elseif Health = 2
  *set Health_text "Slightly Injured"
  *goto chart
*elseif Health = 3
  *set Health_text "Injured"
  *goto chart
*elseif Health = 4
  *set Health_text "Seriously Injured"
  *goto chart
*elseif Health = 5 
  *set Health_text "Got nothing left"
*elseif Health = 6
  *set health_text "Dead"
  *goto chart
*elseif health = 7
  *set health_text "Busted"
  *goto chart

```

And in the top of startup:

```
*create health_text ""
*create health 0

```

The stat chart:

```
Health: ${health_text}
*line_break
Heat: ${heat_text}
```

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [August 26, 2015, 3:07pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/2 "2015-08-26T15:07:21Z")

</div>

Please take note that the variable Health\_text is not the same as the variable health\_text and that the variable Health is not the same as the variable health since ChoiceScript is case sensitive.

Oh, and that you don’t need

> [@Yuvalbab](#):
>
> \*temp heat\_text

if you’ve already got

> [@Yuvalbab](#):
>
> \*create heat\_text “”

(I think we went through that last thing last time already, so I’ll leave it at that.)

---

<div class="post-metadata">

**Author:** ![Yuvalbab](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/yuvalbab/32/16784_2.png) [@Yuvalbab](https://forum.choiceofgames.com/u/Yuvalbab)\
**Post date:** [August 26, 2015, 3:14pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/3 "2015-08-26T15:14:27Z")

</div>

About the case sensetive variable, I never encountered any problem caused by this. As I said, health variable works fine.

As for the temp\create, If I dont have a \*create command I get “non existing variable” error; if I dont have \*temp command I cant change the text using numbers, I have to type the text itself (something I dont want to happen here - I want it to act like the “Health”)

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [August 26, 2015, 3:30pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/4 "2015-08-26T15:30:48Z")

</div>

Do you still remember

> [@Temp Text not working](https://forum.choiceofgames.com/t/temp-text-not-working/11474/6):
>
> If you’ve already got a permanent variable (the variable is permanent, not the value) you don’t need a temp variable by the same name. It should work fine without it. Edit: And it does. Just tested it. Choicescript\_stats.txt \*if rep = 0 \*set rep\_text "Neutral" \*goto chart \*elseif rep = 1 \*set rep\_text "Positive" \*goto chart \*elseif rep = 2 \*set rep\_text "Very Positive" \*goto chart \*elseif rep = 3 \*set rep\_text "Amazing" \*goto chart \*elseif rep = 4 \*set rep…

That one worked without a \*temp variable, so these two examples should work without them too.  
and

> [@Temp Text not working](https://forum.choiceofgames.com/t/temp-text-not-working/11474/8):
>
> Just a note: If you have a \*temp and a \*create variable with the same name I believe the \*temp one always takes precedence.

In the case of the ‘health’ variable the order of precedence isn’t an issue because you’ve got two different variables (Health\_text and health\_text), but with the ‘heat’ variable it is because you’ve got a temporary and a permanent variable going by exactly the same name.

---

<div class="post-metadata">

**Author:** ![Yuvalbab](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/yuvalbab/32/16784_2.png) [@Yuvalbab](https://forum.choiceofgames.com/u/Yuvalbab)\
**Post date:** [August 26, 2015, 3:52pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/5 "2015-08-26T15:52:22Z")

</div>

It still wont work; removed the \*temp and fixed the upper/lower case

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [August 26, 2015, 4:17pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/6 "2015-08-26T16:17:20Z")

</div>

I’ve got working code again. Please compare it with what you’ve got right now. That should teach you more than any explanation from my side ever would.

startup.txt (+code for testing purposes):

```
*title Test

*create rep_text "Neutral"
*create rep 0
*create name ""
*create gender_text ""
*create money 0
*create health 0
*create health_text "Uninjured"
*create heat 0
*create heat_text "Anonymous"

*label setrep
*choice
    #set rep 0
        *set rep 0
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 1
        *set rep 1
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 2
        *set rep 2
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 3
        *set rep 3
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 4
        *set rep 4
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 5
        *set rep 5
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 6
        *set rep 6
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 7
        *set rep 7
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 8
        *set rep 8
        You changed your reputation.
        *page_break
        *goto setrep
    #set rep 9
        *set rep 9
        You changed your reputation.
        *page_break
        *goto setrep
    #set heat 0
        *set heat 0
        You changed your heat.
        *page_break
        *goto setrep
    #set heat 1
        *set heat 1
        You changed your heat.
        *page_break
        *goto setrep
    #set heat 2
        *set heat 2
        You changed your heat.
        *page_break
        *goto setrep
    #set heat 3
        *set heat 3
        You changed your heat.
        *page_break
        *goto setrep
    #set heat 4
        *set heat 4
        You changed your heat.
        *page_break
        *goto setrep
    #set heat 5
        *set heat 5
        You changed your heat.
        *page_break
        *goto setrep
    #set health 0
        *set health 0
        You changed your health.
        *page_break
        *goto setrep
    #set health 1
        *set health 1
        You changed your health.
        *page_break
        *goto setrep
    #set health 2
        *set health 2
        You changed your health.
        *page_break
        *goto setrep
    #set health 3
        *set health 3
        You changed your health.
        *page_break
        *goto setrep
    #set health 4
        *set health 4
        You changed your health.
        *page_break
        *goto setrep
    #set health 5
        *set health 5
        You changed your health.
        *page_break
        *goto setrep
    #set health 6
        *set health 6
        You changed your health.
        *page_break
        *goto setrep
    #set health 7
        *set health 7
        You changed your health.
        *page_break
        *goto setrep

```

choicescript\_stats.txt:

```
*if rep = 0
    *set rep_text "Neutral"
    *goto heat
*elseif rep = 1
    *set rep_text "Positive"
    *goto heat
*elseif rep = 2
    *set rep_text "Very Positive"
    *goto heat
*elseif rep = 3
    *set rep_text "Amazing"
    *goto heat
*elseif rep = 4
    *set rep_text "Hero"
    *goto heat
*elseif rep = 5
    *Set rep_text "Living Legend"
    *goto heat
*elseif rep = 6
    *set rep_text "Negative"
    *goto heat
*elseif rep = 7
    *set rep_text "Very Negative"
    *goto heat
*elseif rep = 8
    *set rep_text "Hated"
    *goto heat
*elseif rep = 9
    *set rep_text "Tyrant"
    *goto heat

*label heat

*if heat = 0
  *set heat_text "Anonymous"
  *goto health
*elseif heat = 1
  *set heat_text "Barely heard of"
  *goto health
*elseif heat = 2
  *set heat_text "Well known"
  *goto health
*elseif heat = 3
  *set heat_text "Wanted"
  *goto health
*elseif heat = 4
  *set heat_text "Public Enemy"
  *goto health
*elseif heat = 5
  *set heat_text "International Sensation"
  *goto health

*label health

*if health = 0
  *set health_text "Uninjured"
  *goto chart
*elseif health = 1
  *set health_text "Just a Scratch"
  *goto chart
*elseif health = 2
  *set health_text "Slightly Injured"
  *goto chart
*elseif health = 3
  *set health_text "Injured"
  *goto chart
*elseif health = 4
  *set health_text "Seriously Injured"
  *goto chart
*elseif health = 5 
  *set health_text "Got nothing left"
*elseif health = 6
  *set health_text "Dead"
  *goto chart
*elseif health = 7
  *set health_text "Busted"
  *goto chart

*label chart

Character
*stat_chart
  text Name
  text gender_text Gender
  text Money
  text rep_text Reputation
  text heat_text Heat
  text health_text Health
```

---

<div class="post-metadata">

**Author:** ![Yuvalbab](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/yuvalbab/32/16784_2.png) [@Yuvalbab](https://forum.choiceofgames.com/u/Yuvalbab)\
**Post date:** [August 26, 2015, 4:19pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/7 "2015-08-26T16:19:43Z")

</div>

But does the rep\_text change according to the rep itself changing?

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [August 26, 2015, 4:21pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/8 "2015-08-26T16:21:15Z")

</div>

It did when I ran this code. Doesn’t it change when you test it?

---

<div class="post-metadata">

**Author:** ![Yuvalbab](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/yuvalbab/32/16784_2.png) [@Yuvalbab](https://forum.choiceofgames.com/u/Yuvalbab)\
**Post date:** [August 26, 2015, 4:25pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/9 "2015-08-26T16:25:36Z")

</div>

Nope. It dosen’t change.

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [August 26, 2015, 4:31pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/10 "2015-08-26T16:31:11Z")

</div>

See:

 ![](https://global.discourse-cdn.com/choiceofgames/original/2X/5/5477a9264630a45b4d512661b72d18dd36475141.PNG)  
Have you perhaps got some other code in there as well? Or have you changed anything?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [August 27, 2015, 8:34am UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/11 "2015-08-27T08:34:15Z")

</div>

> [@Cecilia\_Rosewood](#):
>
> In the case of the ‘health’ variable the order of precedence isn’t an issue because you’ve got two different variables (Health\_text and health\_text)

Actually Choicescript forces every variable to lowercase, so they’re essentially the same and will take precedence (or not) over one another.

---

<div class="post-metadata">

**Author:** ![Cecilia\_Rosewood](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cecilia_rosewood/32/253835_2.png) [@Cecilia\_Rosewood](https://forum.choiceofgames.com/u/Cecilia_Rosewood)\
**Post date:** [August 27, 2015, 8:47am UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/12 "2015-08-27T08:47:03Z")

</div>

Ok. To be honest I never tested it with variables themselves, only with values.

---

<div class="post-metadata">

**Author:** ![Sashira](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sashira/32/2899_2.png) [@Sashira](https://forum.choiceofgames.com/u/Sashira)\
**Post date:** [August 28, 2015, 12:46am UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/13 "2015-08-28T00:46:12Z")

</div>

It can confuse testing, though. In quicktest if you have MorningScene in your scene list but the file is called morningscene.txt, it will give you duplicate readings of untested lines for “both” scenes. And of course it’ll screw up strings; \*if gender=“female” won’t work if you originally set gender to be “Female”. So it’s good to keep cases standard.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [August 28, 2015, 4:18pm UTC](https://forum.choiceofgames.com/t/difference-between-codes/11574/14 "2015-08-28T16:18:14Z")

</div>

Of course, I was by no means encouraging people to use uppercase in variable names, I apologise if this was implied! 😊

As far as gender goes I suggest using booleans for that exact reason.
