I7: Multiple instances of object. Eg a pile of sticks.

I have a pile of sticks. I have the variable, stickCount.
Instead of taking a stick, I increase the stickCount by 1 but that leaves the player’s inventory empty.

I could place a dummy object in the player’s inventory and give it a printed name that changes from “a stick” to “some sticks” but I have the feeling that this is not the best way to go.

Is there a conventional way to do it?

There is a similar problem here. David J Prokopetz gives some code for taking multiple coins. If you replace the coins with sticks, it can give you what you want.

Thanks. One problem, however.

This is the first time I’ve used any unincluded extensions. I’ve imported both Multitudes and Conditional Backdrops.

The problem is, when I followed the example in the documentation:

Gravel is a multitude.
…I get a compile error.

Am I meant to use some sort of include/import? I assume I don’t need to.

When including the multitudes extension you need to add this to your code.

Include Multitudes by Mike Ciul.

Hope this helps.

If you wanted to use the dummy object method you could try this.


Rule for printing the name of the stick when taking inventory:
say “[the stick count of the stick in words] stick[s]”.

Check taking the pile of sticks:
increase the stick count of the stick by one;
if the player is not carrying the stick, now the player carries the stick;
say “You take a[if the stick count of the stick is greater than one]nother[end if] stick from the pile.” instead.

Check dropping the stick:
decrease the stick count of the stick by one;
if the stick count of the stick is zero, remove the stick from play;
say “You place a stick back onto the pile.” instead.

A first check dropping rule:
if the noun is the pile of sticks, say “You are not carrying any sticks.” instead.

The Testing Room is A Room. A pile of sticks is in the testing room. A stick has a number called the stick count. The stick is proper-named. The stick count of the stick is usually zero. Understand “stick” as the pile of sticks.

Test me with “take stick / i / take stick / i / take stick / i / take stick / i / drop stick / i / drop stick / i / drop stick / i / drop stick / i / drop stick”.[/code]

It’s a simplified version but it does the trick.

Hope this helps.

Thanks. I got confused by the documentation When any source text is run through Inform, a secret first line is inserted, Believing the include was automatically generated.

This is just for the standard rules, which is in essence just an extension. You’ll need to manually include all the others.

Thanks for volunteering as a beta tester for Multitudes! :smiling_imp:

Please let me know if the documentation is confusing, or wrong, or if it doesn’t work right.