# How to write obtain item in the txt file?

**URL:** <https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944>\
**Category:** ChoiceScript Help\
**Created:** [June 9, 2015, 2:53pm UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944 "2015-06-09T14:53:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![animax84](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@animax84](https://forum.choiceofgames.com/u/animax84)\
**Post date:** [June 9, 2015, 2:53pm UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944/1 "2015-06-09T14:53:34Z")

</div>

I am trying to put in my story that i obtained the item but i looked through the forums and i still can’t find the way.  
Please help.

---

<div class="post-metadata">

**Author:** ![Arcania](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/arcania/32/89710_2.png) [@Arcania](https://forum.choiceofgames.com/u/Arcania)\
**Post date:** [June 9, 2015, 3:07pm UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944/2 "2015-06-09T15:07:11Z")

</div>

If we’re both thinking the same way then…

```
*temp keys 0
*choice
 #Pick up the keys.
  *set keys +1
  *goto next
 #Ignore the keys.
  *goto next

*label next
*if keys > 0
 You have keys!
*if keys = 0
 You don't have keys.
```

There’s always simple true and false to confirm weather you have it.

```
*temp keys false
*if (keys)
 You have keys.
*else 
 Guess you're locked in here forever.
_____
Or was there something ele you were looking for @animax84
```

---

<div class="post-metadata">

**Author:** ![animax84](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@animax84](https://forum.choiceofgames.com/u/animax84)\
**Post date:** [June 10, 2015, 11:59am UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944/3 "2015-06-10T11:59:15Z")

</div>

Hi, thanks for the reply but i still received an error.

i just copied the part with the item and error.

\*choice  
#“Pistol”  
“You are in luck, I happened to have the last remaining Grym in storage.”

```
WLX315 - The Grym.....The power of a small cannon in the size of a pistol.......
*set Grym +1
*finish

```

Error is  
startup line 103: Non-existent variable ‘grym’

but in stats

This is a stats screen!

\*stat\_chart  
text name  
text gender  
percent Leadership  
opposed\_pair Strength  
Weakness  
text Leadership  
text Strength

\*goto BuildInventory

\*label BuildInventory  
\*line\_break  
\*temp inventory “”  
\*temp comma false  
\*if empty  
\*set inventory &“You carry nothing.”  
\*goto DisplayInv  
\*if “Grym”  
\*if comma  
\*set inventory &", "  
\*set inventory &“Grym”  
\*set comma true

My stats page also has error.  
I am now very confused

---

<div class="post-metadata">

**Author:** ![RETowers](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/retowers/32/21477_2.png) [@RETowers](https://forum.choiceofgames.com/u/RETowers)\
**Post date:** [June 10, 2015, 12:28pm UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944/4 "2015-06-10T12:28:51Z")

</div>

Why don’t you start with my [guide](https://forum.choiceofgames.com/t/the-beginners-guide-to-choicescript/9866). How to make variables is covered in the basic walkthrough. I’m planning on an update today, bit it should include more than everything you need (the problem you’re having is that you need to \*create the variable before you try and use it). Also, on the forums clicking this: `</>` button will format your code to keep the indents if you have it highlighted.

---

<div class="post-metadata">

**Author:** ![Left4Bed](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/left4bed/32/232425_2.png) [@Left4Bed](https://forum.choiceofgames.com/u/Left4Bed)\
**Post date:** [June 10, 2015, 1:18pm UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944/5 "2015-06-10T13:18:23Z")

</div>

It looks to me as if you haven’t declared Grym i.e " \*create Grym 0 " or " \*temp Grym 0 " for a temporary variable. That’s why it’s saying non-existent variable. It could also be that if you did declare it, you did so in lowercase but are using it in upper, I’m not really sure if CS is case sensitive, but I always try to keep my cases consistent, just to be safe.

---

<div class="post-metadata">

**Author:** ![animax84](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@animax84](https://forum.choiceofgames.com/u/animax84)\
**Post date:** [June 10, 2015, 2:24pm UTC](https://forum.choiceofgames.com/t/how-to-write-obtain-item-in-the-txt-file/9944/6 "2015-06-10T14:24:43Z")

</div>

Arcania  
Your help made me realise the \*set key stuff so thank you…

Reaperoa,  
Thanks for your help, especially with the guide. It helped me alot. but it was…

Left4Bed  
who hit the Homerun!!!

I forgot to \*create grym  
Hahahaha, Thanks for all your help.
