Login
Remember
IF Answers
Ask a Question

# Is there a standard way to deal with stacks of items, i.e., having 13 health potions or 6 flowers?

+1 vote
1,174 views
asked Mar 26 in Authoring by Paul_Erdos (39 points)
recategorized Mar 27 by Alex
I've seen item properties like, "there is a small amount of widgets here." but it doesn't really work for more specific operations. For instance, if I eat one apple and I have 5, I would expect to have four afterwords. I'd also expect to have 5 apples again if I find another apple of the same kind somewhere else. I would imagine that there's some obvious built-in utility or extension for this sort of thing, but I can't find it. Any ideas?

- inventory
- inform7

commented Mar 26 by bg (692 points)
What development system are you using? Inform 7?
commented Mar 26 by Paul_Erdos (39 points)
Yes, Inform 7, compiling to z-code rather than glulx (however that's spelled)

## 1 Answer

+2 votes
answered Mar 26 by bg (692 points)
selected Mar 26 by Paul_Erdos
Best answer

I think you want the "Duplicates" section of the "Kinds" chapter in the documentation (Writing with Inform). Here's a snippet, but there are more examples of varying complexity in that same section:

§4.14. Duplicates

Although it is only useful to a limited extent, we can make any number of copies of something:

"Polygons"

A shape is a kind of thing. A square is a kind of shape. A triangle is a kind of shape.

The Geometry Lab is a room. In the Geometry Lab are three triangles and two squares.

The description "three triangles" makes three identical things, each of the kind "triangle", and similarly for the squares. When the above is compiled, the player can type TAKE TWO TRIANGLES or TAKE ALL THE TRIANGLES and so forth.

commented Mar 26 by Paul_Erdos (39 points)
Great! This should work. I should be more careful when skimming documentation, most of what I need tends to be in there.

## Related questions

- With Flexible Windows by Jon Ingold, is there a way to make the text display at the top of the window, even in Gargoyle? (Inform 7)
- In Flexible Windows, is it acceptable to set, e.g., the window position at or after the start of play? (Inform 7)
- Is there an easy way to port Inform 6 code (unfinished game) into Inform 7 to continue development?
- Is there a way to reduce the right margin for a play-in-browser website released by Inform 7?
- In Inform 7, is there a way to detect which interpreter is being used?

...