Small I7 Extension: Possession and Ownership

While I was looking for something else, I spotted a thread on an archive of r.a.i.f. containing some code (by “chipjack”) which allows players to refer to items with possessives, which automatically change if the item changes hands. (e.g. TAKE ANNIE’S NECKLACE, GIVE MY NECKLACE TO JANE).

I’ve taken this code as a starting point, modified it a bit (now applies to any thing, not just a particular kind), and added the notion of “ownership”, which goes beyond physical possession.

The extension is available here: )

Suggestions and criticism welcome.

Right, here’s a first bug report. :slight_smile:

Plural names that already end in -s are treated incorrectly. The game will insist on X WITCHES’S BREW rather than X WITCHES’ BREW.

The game only understands the full possessive name of an object (in contrast to the way parts of assemblies work). The game will insist on X LITTLE RED RIDING-HOOD’S BASKET rather than X RED’S BASKET.

I’m not sure how to fix that last one … Well, I suppose it can be done somehow.

Ah, you’re right. I think I can fix that…

Yeah, I think “X RIDING-HOOD’S BASKET” would also work (you don’t need the full name, just the last word), but you’re right. I’m not sure how to fix it either… Vocabulary is kind of tricky to manipulate dynamically (particularly compared to TADS).

Edit: Some testing shows I was wrong about just the last word working… Now I’m really not sure there’s any good solution for multiple-word names.

That said, I would gladly welcome a system for TADS :slight_smile:

There was one for TADS2 many years ago, called possess.t, I think. I believe it’s still available in the archive. Not sure if it’s been ported to TADS3.

That looks like it could be quite a useful extension. You may want to consider uploading it to The Inform 7 Extensions Site.

It’s my understanding that Graham only accepts extensions submitted under a real name.

A quick glance at the list by author ( does not support that.

The relevant bit in 25.3:

Note ‘asked’; these are standards of polite behaviour, not rules that absolutely must be followed.

I had figured “asked” was standard polite British understatement for “required”.

Doesn’t TADS 3 already do this as standard, or am I missing something of what you want? (Since this point is TADS related and this is an Inform forum, I’ll go into more detail on the TADS forum).

I’ve updated the extension (at the original pastebin location). It now handles plural nouns (it doesn’t handle all cases, but uses the same method as Plurality, which should be good enough.)

The problem of multiple-word names (which is also somewhat of an issue with assemblies) is not solved, but I’ve documented it and recommended that the user stick to single names for persons.

The extension has been more-or-less completely rewritten. The new version (3/130618) is here: (a separate paste so that the original version is still available.)

This abandons the indexed text property in favor of the first approach in the original r.a.i.f thread, which mangles the player’s command (to separate apostrophe-s into a separate word) and uses the “understanding by relation” approach. Supposedly this doesn’t work with some assemblies, but it seems to as long as you include “reversed incorporation” as one of the possible relations.

Plural possessives are (partially) handled by changing s-apostrophe into s-space-apostrophe-s. So “X WITCHES’ BREW” now works just fine. As does “X RED’S BASKET”.

This is a nice little extension! I think I have some similar code lying around somewhere but it’s good to have it systematized.

One suggestion: You might want to do something to allow for worn objects as well, so the game will understand “x little red riding-hood’s bonnet.” Unfortunately trying to understand things by the reversed wearing relation runs into a weird bug, but there’s a workaround in that thread.

Another thing you could do is go wholesale for the “reversed enclosure” relation, which would recognize “x officer’s badge” when the badge is part of a shirt that the officer is wearing. Though if you did that you might want to include a use option that let the author turn that off.

Also, a niggle: It looks like you currently have two section 2s.

“reversed possession” should include wearing - I certainly tested it with clothes that were worn! (ETA: Double-checked; works fine - if there’s a bug here, can you post some code?)

I will check to see if the “reversed wearing” bug affects possession. (EDIT: It doesn’t.)

I hadn’t noticed that I forgot to renumber the last section - thanks.

Ah well I just didn’t check it. I always forget how possession works compared to whichever one applies only to things in your inventory.

The other case I had in mind was something like this:

Daily Planet is a room. Lois is a woman in Daily Planet. Lois wears a hat. A tassel is part of the hat. Test me with "x Lois's tassel". 

which you may or may not want to cover. This example also produces a somewhat funky “I only understood you as far as…” message, which I’m guessing will happen whenever Lois only has one thing.

I considered using enclosure, but as you said previously, it should really be enabled with an option (I worry about performance in a complex world), and the option has to be tested with each “Understand…” line. If only we could enable or disable entire sections of code based on an option (similar to the “For use with Extension X” method.

I’m not certain what circumstances the “I only understood” message pops up in - it happens without the extension too sometimes (if the player uses a possessive.)

Makes sense.

I think that’s because, when there’s a kind of thing that’s part of every person, the game gives it the name “person’s thing.” So if you try this without the extension:

Daily Planet is a room. Lois is a woman in Daily Planet. Lois wears a hat. A nose is a kind of thing. A nose is part of every woman. Test me with "x lois's hat/showme nose/x nose hat".

you can see from “showme nose” that the nose is named “Lois’s nose.” So the game is trying to understand “lois’s” as the nose, just as it would if the name of the object were “snub nose” and the player typed “snub.” The error you get from “lois’s hat” is just like the one you get from “nose hat,” since “hat” doesn’t refer to the nose.

Ah, I see. And if you define two “Lois’s things”, you get “You can’t see any such thing”, but with only one you get “I only understand as far as…”

Not really sure this is readily resolvable, except possibly by ensuring that there are two assemblies. I’ll make a note in the documentation so an author can use that solution if they want - I don’t want to create two dummy assemblies.

Yeah, it looks difficult to me on the current release of Inform. What I’d ideally like to do is replace the default “I only understood you as far as” message when the command contains an apostrophe-s, so that it says “I only understood you as far as wanting to [action name] something of [random person owning or holding or incorporating the thing Inform wants to print here]'s.” But I don’t know if the relevant action name and thing are exposed to us here; the library message that prints this is “I only understood you as far as” and then the parser seems to be doing the rest.

I looked in Ron Newcomb’s Original Parser extension to try to figure out where the parser was getting this information from and it was even more incomprehensible than usual:

-- only understood as far as error: issue the 28th response "I only understood you as far as wanting to "; copy 32 elements from the player's saved understood command to the player's understood command; now the understood command's current position is the second understood command's current position; say "[recap of command from 0]"; issue the 56th response ".";

With some luck this might become a bit easier to deal with when the new Inform comes out (which I think will do away with the “library message” business).

It seems to me that it wouldn’t be good to always try to force there to be more than one assembly, because people can pick things up and put them down. Maybe the message given for this in Aaron Reed’s Neutral Library Messages would help.

Another concern might be that as written, ownership doesn’t override possession:

[code]Daily Planet is a room. Lois is a woman in Daily Planet. Lana is a woman in Daily Planet. A hat is a kind of thing. Understand “hat” as a hat. The fedora is a hat. Lois wears the fedora. The stetson is a hat. Lana owns the stetson. Lois carries the stetson.

Test me with “x lois’s hat”. [/code]

The game allows you to refer to the stetson as Lois’s hat, even though it’s really Lana’s hat and Lois is just carrying it. That seems not necessarily desirable. I think this fixes:

[code]Section 2 - Possession

Definition: A thing is unowned if no person owns it.

Understand “[something related by reversed possession] 's” as a thing when the item described is unowned.
Understand “[something related by reversed incorporation] 's” as a thing when the item described is unowned.
Understand “my” as a thing when the player is holding the item described and the item described is unowned. Understand “your” as a thing when the person asked is holding the item described and the item described is unowned.[/code]