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?
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.
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...