Describing duplicate items (intelligently, on the fly)

(6M62)

I’m using the duplicates capability (4.14 in the manual) to deal with some empty cups.

My question is, when a player looks at a clump of these cups – which may consist of one or more cups somewhere; in their inventory, on a shelf, on the floor – how can I print a description on the fly that describes either one cup, or more than one cup?

I’ve got example code here that stops the ‘You can’t use multiple objects with that verb’ error happening in response to ‘x cups’ (on any number of cups) but obviously I’m getting the description of a single cup, the only description I currently have. I’d like it to work out how many cups are in the pile and then print a different description if it’s more than one. I can think of ways to do this (run a routine counting cups within the holder of the noun as part of creating the description?) but wondered if there’s anything better I could do.

-Wade

Summary
lab is a room.

a cup is a kind of thing. It is usually privately-named.

The printed name is "cup".
The printed plural name is "cups".

Understand "cup/cups" as a cup. 

three cups are in lab.

Description of a cup is "It's a nice cup.".

Test me with "x cup/x cups".
1 Like

Matt Weiner’s Action on Groups extension seems well-suited to this sort of thing.

"Cups"

Include Actions on Groups by Matt Weiner.

A cup is a kind of thing. The description of a cup is usually "It's a nice cup."

Place is a room.

A table is in place.

Three cups are on the table.

Section 1 - Grouping Rules

Examining is a groupable action.

Understand "examine [things]" as examining.

Action on groups rule for examining when dealing with cups:
	say "There are [number of cups that can be seen by the player] cups."
4 Likes

Thanks for identifying that. I’ll take a look.

-Wade