# Inventory code help

**URL:** <https://forum.choiceofgames.com/t/inventory-code-help/56039>\
**Category:** ChoiceScript Help\
**Created:** [April 27, 2019, 9:03am UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039 "2019-04-27T09:03:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeorgeHenryG](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@GeorgeHenryG](https://forum.choiceofgames.com/u/GeorgeHenryG)\
**Post date:** [April 27, 2019, 9:03am UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039/1 "2019-04-27T09:03:27Z")

</div>

I want to have items that can be put in and taken out of my inventory but when ever I take something out, it just doubles everything else.  
ex. before I take out synthale

“You have: FC Card, GPL, Synthale.”

ex. after I take out synthale

"You have: FC Card, GPL, SynthaleFC Card, GPL. "

```
*if (fc_card)
    *set inventory &"FC Card"
    *set comma true
*if (gpl_coin)
    *if comma
      *set inventory &", "
    *set comma true
    *set inventory &"GPL"
*if (synthale)
    *if comma
      *set inventory &", "
    *set comma true
    *set inventory &"Synthale"

```

I have no clue how to fix it

---

<div class="post-metadata">

**Author:** ![Kaelyn](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kaelyn/32/141616_2.png) [@Kaelyn](https://forum.choiceofgames.com/u/Kaelyn)\
**Post date:** [April 27, 2019, 9:18am UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039/2 "2019-04-27T09:18:48Z")

</div>

I guess to help you, you should post the code, that extracts the synthale too, that might be useful.

---

<div class="post-metadata">

**Author:** ![ParrotWatcher](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/parrotwatcher/32/49963_2.png) [@ParrotWatcher](https://forum.choiceofgames.com/u/ParrotWatcher)\
**Post date:** [April 27, 2019, 10:01am UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039/3 "2019-04-27T10:01:10Z")

</div>

You have to `*set inventory ""` at the start. (Or `*set inventory "You have: "` depending on what it initially was.)

---

<div class="post-metadata">

**Author:** ![TimberWoolf](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/timberwoolf/32/69602_2.png) [@TimberWoolf](https://forum.choiceofgames.com/u/TimberWoolf)\
**Post date:** [April 27, 2019, 10:46am UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039/4 "2019-04-27T10:46:43Z")

</div>

Yes, every time you have `*set text & "general text"`, it just adds the general text to the end of whatever already exists in the text variable.

I recommend what @ParrotWatcher says: just clear the text variable in the beginning, and then let it add all the things back.

---

<div class="post-metadata">

**Author:** ![GeorgeHenryG](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@GeorgeHenryG](https://forum.choiceofgames.com/u/GeorgeHenryG)\
**Post date:** [April 27, 2019, 9:42pm UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039/5 "2019-04-27T21:42:28Z")

</div>

I think what my problem was that I was trying to take out the synthale from the stats page??

This is what it looked like before, I’ll just make the options happen in game instead of the stats

```
 *if (synthale) #Drink
    horrible
    *set synthale false
    *set hunger +5
    *goto dnk

```

---

<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:** [April 28, 2019, 10:44am UTC](https://forum.choiceofgames.com/t/inventory-code-help/56039/6 "2019-04-28T10:44:05Z")

</div>

Can you post your whole code? Both for the inventory list and the subroutines handling it.
