Login
Remember
IF Answers
Ask a Question

# Show amount of gold in inventory

0 votes
46 views
asked Oct 7 in Authoring by Mareus

Hey there!

Can anyone tell me what code should i write for showing the amount of gold in my inventory upon looking at it? The way I added gold into my game was via attributes/integrers. Whenever I find gold I just write the following code:
player.gold = player.gold + 100 -> And then i get 100 gold.

It appears neatly in my bar under the health, but I wish to be able to write a command: "examine gold/look at gold" and then get a description: "You have xx amount of gold in your inventory."

Can anyone help me with that? There has to be a simple code to show this. I tried ListObjectContents (this), but this only gives me a list of objects i am carrying in my inventory. Basically it just tells me "You are carrying gold", but it doesnt tell me the amount. Thanks in advance.

- quest
- programming

## 1 Answer

0 votes
answered Oct 9 by The Pixie (121 points)

The simple way would be to have an object, called gold, in the player's inventory from the start. Set it to be undroppable, and for the look at text:
`You have {player.gold} of gold in your inventory.`

## Related questions

- How can I make use of the health variable in Quest through the editor
- How do you center images in Quest?
- How do I use the create exit command properly in Quest
- How do I debug in Quest?
- How do I find the default parser verbs in Quest?

...