What is the best way to get big quantities of items in I7?

I want to be able to have huge quantities of duplicate items in my I7 project.

My understanding is that Inform 7 allocates memory for each individual object (even identical ones), requires the total quantity fixed at compile time, and limits references to ~100 because of this, which severely limits the quantities of duplicate items you can create.

I want to be able to do something like this…

You are carrying:
  1973 gold coins
  a bag
    1500001 grains of sand

… and be able to type “drop coin”, “drop all coins”, “drop 7 coins” and have them all work correctly.

I have tried implementing my own quantity/inventory system a few different ways, the simplest creating a special kind (called stackable item), giving it a quantity property, and modifying it’s take/put/drop behaviors… but I always hit a wall with the language parser dealing with quantity based commands (such as “take 7 coins” or “put 7 coins in chest”) since the parser sees only one object and I can’t seem to find a way to modify the handling of actions on multiple objects and make it work with my quantity property.

Is there an existing solution for this kind of thing?

Check out the extension Multitudes by capmikee. (It’s not on the Inform website, but capmikee is around.) The extension, IIRC, doesn’t quite operate the way you want, but I think it should be tweakable. Basically, it sets up backdrops for large quantities of things, so “pile of sand” could be a backdrop. Then you can interact with a single representative item, like a grain of sand. I believe you’d need to tweak for carrying numbers of things.

Another way to go about it would be to have faux containers with a “value” of their contents. That is, you have a bag, and the bag has a value: sand, or gerbils, or coins, and a number representing the number of the contents. The player thinks they’re interacting with 100,000 coins, but really they’re just playing with a bag. This one doesn’t really lend itself easily to dropping random numbers of things in places. (Maybe that’s not really necessary, though?)

I suppose that if you’re dealing with only a few types of items, you could give rooms, containers, supporters and people a property called - for example - “number of coins”, and any attempt to put coins in a container or on a supporter, give them to a person, or drop them in a room would update the target object’s “number of coins” property instead. Then you’d just need to update the reporting rules for examining supporters/containers to report how many coins they contain, and likewise tweak the looking rules to report the number of coins lying around on the ground in any given room (via the room’s “number of coins” property).

EDIT - See the attachment for a very crude example. Note that this only works if there’s only one thing (e.g. coins) that you want to deal with in this fashion. If you have multiple types of quantities, it will be more complicated.
coins.txt (5.54 KB)

Multitudes is at:


A word of warning: 1500001 is too big a number for the z-machine. I’m not sure how glulx handles numbers, so I can’t say for sure whether it can go that high.

However, if you’re really set on that particular number, and you don’t care so much about the math, you could use Approximate Quantities, and print the text “1500001” whenever you have an effectively infinite number.


If you choose to use both extensions together, please let me know because Approximate Quantities evolved from the “effective infinity” definition in Multitudes, and is probably not compatible with it anymore. Multitudes is in need of an update.

Up to 2^31, or roughly two billion.