Understanding data objects has a great deal of potential, especially in regards to dispensers and dynamic objects. Combine this ability with the power to understand things by their relations, and you can make a generic object into a very specific object.
Take a look at this rather large and thorough example in the spoiler if you’re interested in the technique:
[spoiler][code][The generic book object. It will be used as an indistinguishable object.]
A book is a kind of thing.
The description of it is usually “[Base Description of Book]”.
To say Base Description of Book:
if the item described is about nothing or the bookshelf contains the item described:
say “It looks to be a hard-bound book. You can’t see the cover and the spine is all worn out.[no line break]”;
otherwise:
say “[the description of the data source of the item described]”;
[Rules for printing are required to achieve the effect of the books being specific objects in the world.]
Rule for printing the name of a book (called the book described):
if the book described is about nothing:
say “book”;
otherwise:
say “[data source of the book described]”.
Rule for printing a number of books (called a book listed) not contained in a bookshelf:
let R be list of subject matter that is the subject of books contained in the object that contains the item described;
let quantity text be “pile”;
if listing group size is 2:
now quantity text is “couple”;
otherwise if listing group size is 3:
now quantity text is “few”;
if number of entries in R is greater than 0:
say “a [quantity text] of books, including copies of [R]”;
otherwise:
say “a [quantity text] of books”.
Rule for printing a number of books when taking inventory:
let R be list of subject matter that is the subject of books carried by the player;
repeat with current subject running through R:
now current subject is marked for listing;
let L be the list of books carried by the player;
let started be false;
repeat with current book running through L:
if the data source of the current book is marked for listing:
if started is true:
say "[line break] ";
now started is true;
if the current book is a copy of a book carried by the player:
say "[the number of books that are a copy of the current book carried by the player plus 1 in words] copies of ";
say “[the current book]”;
now the data source of the current book is unmarked for listing;
[Used to tell if the player holds more than one copy of a book.]
Duplication relates a book (called X) to a book (called Y) when X is not Y and the data source of X is the data source of Y. The verb to be a copy of implies the duplication relation.
[This is our data container for the specifics of a book.]
A subject matter is a kind of object.
A subject matter can be privately-named or publically-named. It is usually publically-named.
A subject matter can be marked for listing or unmarked for listing. It is usually marked for listing.
It has a text called description. Description is usually “It is a pretty uninteresting book about a topic you care little about.”
It has a text called author. Author is usually “John Q. Public”.
It has a text called first chapter. First chapter is usually “Forward”.
[Here we give the ability to assign a subject to a book, turning the indistiguishible book into a specific book.]
Written substance relates one subject matter (called the data source) to various books.
The verb to be the subject of implies the written substance relation.
The verb to be about implies the reversed written substance relation.
Understand “[something related by reversed written substance]” as a book.
Understand “book inside/in [something related by reversed containment]” as a book.
The Course of Time is a subject matter. “An in-depth analysis of supposed alterations to the time line, some triggered by the gods and other by the will of man. The accounts in this book are largely discredited as evidence of temporal incursions are hard to come by.”
The author of it is “Mirnar Ninyo”.
The first chapter is “The Incident at South Harbor”.
Beginner’s Alchemy is a subject matter. “An easy to follow and illustrated guide to medicinal flora and fauna. Includes a number of helpful recipes that are an absolute necessity to merchants, adventurers, and caravan guards alike.”
The author of it is “Daner Trarneis Lainamair”.
The first chapter is “Introduction to Technique”.
The Bowels of Nehrimdine is a subject matter. “A story that claims to be fact about a cave system underneath the tower of Nehrimdine. Many references about the location of the tower seem inaccurate, however facts tend to be obscured by time, turning to legend. Perhaps showing the book to some knowledgeable people will reveal more.”
The author of it is “an unknown entity”.
The first chapter is “Baladium’s Drive”.
[An action to be applied to our books, accessing the special data afforded it by the subject matter assigned to it.]
Studying is an action applying to one thing. Understand “study [something]” as studying.
Instead of studying something that is not a book:
try examining the noun.
Report studying a book (called the book described):
if the data source of the book described is nothing:
say “You’ll have to pick up the book to get more information out of it.”;
otherwise:
say “[the book described] is by [the author of the data source of the book described]. Opening it up, you find the first chapter is called ‘[the first chapter of the data source of the book described]’.”;
rule succeeds.
Testing Place is a room. “This is where testing occurs.”
A bookshelf is a container in the Testing Place. It is fixed in place. It contains 10 books.
[A couple of generic objects that were used to troubleshoot inventory listings.]
A rock is in the Testing Place.
A stick is in the Testing Place.
[Here we make a generic book a specific book by giving it a random subject when taken.]
After taking a book (called the book described) about nothing:
let new subject be a random subject matter;
now the book described is about the new subject;
now the book described is proper-named;
say “The book is revealed to be ‘[new subject]’.”.
Test me with “look / take book / inventory / take 3 books / inventory / drop book / look / drop all books / look / take all books / study Bowels / study Beginner’s Alchemy”.[/code][/spoiler]
It even allows you to refer to the generic book object by it’s title, as if it had been statically created, which is pretty slick. Only problem is that if you place more than one book into the room, they become indistinguishable, but that can eventually be worked out with a bit of beating it to death.
I just didn’t feel like spending any more time on it.
Edit: My project required me to solve the issue of dropped books being indistinguishable. I did a quick copy/paste and updated the code here and there.