In another thread, Draconis suggested me the rather practical Possession and Ownership by Shadow Wolf. I had no way of discovering that gem myself, since it isn’t on inform7.com’s extension page.
How about a thread where we can link to all the functional but scattered extensions, along with spoiler-enclosed backups? Like this:
Possession and Ownership by Shadow Wolf
Purpose: Allows the player to refer to items via either legal ownership or physical possession, e.g. X ALICE’S NECKLACE or ENTER GEORGE’S HOUSE.
Source: [url]https://intfiction.org/t/small-i7-extension-possession-and-ownership/5465/1]
[spoiler][code]Version 4/130619 of Possession and Ownership by Shadow Wolf begins here.
"Allows the player to refer to items via either legal ownership or physical possession, e.g. X ALICE'S NECKLACE or ENTER GEORGE'S HOUSE."
"based on code from vaporware on r.a.i.f (6 Jan 2008)"
Section 1 - Reparsing possessives
After reading a command (this is the mangle possessives in the players command rule):
let N be indexed text;
let N be the player's command;
replace the regular expression "(\w)[']s" in N with "\1 [']s";
replace the regular expression "s['](\W)" in N with "s [']s\1"; [Cheat to handle possessives]
change the text of the player's command to N.
Section 2 - Possession
Understand "[something related by reversed possession] 's" as a thing.
Understand "[something related by reversed incorporation] 's" as a thing.
Understand "my" as a thing when the player is holding the item described. Understand "your" as a thing when the person asked is holding the item described.
Section 3 - Ownership
[Sometimes items are permanently associated with a person, even if they are currently held by someone else, or not held at all (a building, for example). Ownership handles this.]
Ownership relates one person (called the owner) to various things. The verb to own (he owns, they own, he owned, he is owned) implies the ownership relation.
Understand "my" as a thing when the player owns the item described. Understand "your" as a thing when the person asked owns the item described.
Understand "[something related by reversed ownership] 's" as a thing.
Possession and Ownership ends here.
---- DOCUMENTATION ----
"Possession and Ownership" allows the player to use possessives to refer to items which are either physically held by a particular individual, or notionally owned by an individual.
The original idea, which only covered physical possession, originated on a r.a.i.f thread, archived here: http://rec.arts.int-fiction.narkive.com/dBgGlsLL/possessives-in-inform-7
With this extension, a player can automatically use commands like "EXAMINE BOB'S PANTS" or "DROP MY PENCIL" or "ALICE, GIVE ME YOUR NECKLACE" - as long as the appropriate person (Bob, the player, and Alice respectively) is holding the item in question.
Some items may be notionally owned by a particular individual, even if they are currently held by someone else, or are fixed in place (and thus not holdable at all.) The ownership relation handles this.
Bob carries a gun. The gun is owned by Annie. [or "Annie owns the gun."]
This allows:
> EXAMINE ANNIE'S GUN [even though it's held by Bob]
> BOB, DROP ANNIE'S GUN
> ANNIE, GET YOUR GUN
(Who didn't see that last line coming?)
Naturally, ownership of an item can change during play:
Oak Street is a room. The red house is scenery on Oak Street. The house is owned by Bob.
Signing the Deed is a scene. When Signing the Deed ends: Now the house is owned by the player.
Section - Caveats and Issues
Version 3 is a near-total rewrite. Instead of manually updating an indexed text property every turn, we mangle the player's command (so that apostrophe-s is a separate word), and use the "[something related by reversed relation]" construct. The game will understand items related by possession or incorporation, which covers assemblies, and also ownership.
The alteration of the player's command also tries to handle plural possessives (e.g. WITCHES' ) - S followed by apostrophe becomes S-space-apostrophe-S.
Avoid setting ownership relations in which one person owns an assembly that's part of another person - this will cause disambiguation issues. (e.g. don't try "A nose is part of every person. George owns Bob's nose.", or X GEORGE'S NOSE won't be able to tell which one you mean.)
If an actor only has a single thing (via possession or incorporation), then a command like "X LOIS'S GLASSES" (where Lois does not have the glasses) will result in the parser error "I only understood you as far as wanting to examine Lois." As a workaround, you can define two assemblies so that every person has at least two items at all times. (e.g "An xxxx is a kind of thing. A yyyy is a kind of thing. An xxxx and a yyyy are part of every person .") Ideally, of course, these should be assemblies that are actually of use in the game.
It has been suggested that possession-by-enclosure should be available as an option (allowing "Lois is wearing a hat. A tassel is part of the hat. Test me with 'x Lois's tassel'. ") This may become available in a future version, but currently I don't wish to add the necessary option test on every "Understand" line. If a future version of Inform allows sections to be conditionally incorporated (similar to "For use with Extension X"), then I will definitely add this.[/code][/spoiler]