Dynamically creating objects distinguished by name

I’d like to create some dynamically created clothing, which is then grouped by name, e. g.,

“Here are two blue sweatshirds and three tight jeans.” There would also be red sweatshirts and loose jeans etc.

The player can potentially create any number of items. When I simply declare them to be isEquivalent, they are either not grouped at all (if the name of the object is created on the classes construct method) or they are all grouped under the name of the first item to be created (in the above example, it would be “Here are five blue sweatshirts”) if the name is changed by the action creating the clothing.

Any help? The only way I’ve found so far is with collectives, which would involve creating a huge number of classes…

I’m working on a similar problem—creating and grouping multiple instances of different money denominations (5, 10, 20 dollar bills).

For my model, I used the code for creating and grouping gold, silver and copper coins in sample.t (comes with TADS installation; look in c:\Program Files (x86)\TADS 3\samples, search the file for “Coin”).

Yes, it involves creating multiple classes, but they’re pretty easy to write.

Also of help for integrating the classes into my own code was the Learning TADS 3 manual, especially section 7.4 Coding Excursus 12 - Dynamically Creating Objects.

Jerry