Problem with printing possessive pronouns

I have a character who is very possessive, so when objects he owns are mentioned, they should be mentioned as his. This is a first attempt at coding that up in I7:

[code]“Problem with possessives” by osfameron

Section 1 - Mechanism

Ownership relates various things to one person.
The verb to belong to means the ownership relation.
The verb to own means the reversed ownership relation.

Before printing the name of a thing that belongs to the player: say "[our] "

Section 2 - Things

The Office is a room.

The vintage chair is an enterable supporter in the Office.
It belongs to the player.
The player is on the chair.

A badge is here. It belongs to the player.
A gun is here.[/code]

When we start play, we see the pronoun “your” correctly, but also the definite or indefinite article:

I’ve read through the chapter on “Activities” in Writing With Inform, but I’m not figuring out which activity I need to override.
Or if I need to override the whole listing activity instead?
But I don’t think that will add the locale specific text “(on your vintage chair)”.

I’m not quite sure how best to go about finding all the texts that need to be overridden.
Any suggestions welcome!

osf’

Try setting the indefinite article instead. That’ll change every “a/an” to whatever you wish.

"Problem with possessives" by osfameron

Section 1 - Mechanism

Ownership relates various things to one person.
The verb to belong to means the ownership relation.
The verb to own means the reversed ownership relation.

[I took out the "before printing the name", and added this part here]
When play begins:
	repeat with N running through things that belong to the player:
		now the indefinite article of N is "[our]".

Section 2 - Things

The Office is a room.

The vintage chair is an enterable supporter in the Office.
It belongs to the player.
The player is on the chair.

A badge is here. It belongs to the player.
A gun is here.

And whenever a thing changes ownership, you simply set the indefinite article for it to [our], for example:

After taking something:
	now the noun belongs to the player;
	now the indefinite article of the noun is "[our]";
	continue the action. [to print the report message of the taking action]

And if you ultimately want to change it back, and bereave the player of their possession:

After dropping something:
	now the noun does not belong to the player;
	now the indefinite article of the noun is "";
	continue the action.

Ooo, that’s a step towards it, thanks!

That does now show “your badge”.
And if you take it, it’s listed as “your badge” still.

BUT if you “x badge” it’s listed as “the”.

AND we still have “(on the vintage chair)” in the description.

If we stand up, then both the badge and the chair are listed as “your”.

BUT if we examine either of them, they are listed with “the”.

And that seems to apply for some other actions: e.g. if you sit down again, you sit on “the” chair rather than “your” chair.

So in summary:

  • it looks like the indefinite article tweak works in listings (of room and inventory)

  • but not in other interactions

  • and not to describe e.g. a supporter you’re on.

Fair enough! I didn’t realize you wanted to override the definite article as well!

Then you can use your initial approach, albeit with a little tweak. The trick is to make the things proper-named, getting rid of the articles altogether.
I can’t bug test it right now, but I think this’ll do the trick:

"Problem with possessives" by osfameron

Section 1 - Mechanism

Ownership relates various things to one person.
The verb to belong to means the ownership relation.
The verb to own means the reversed ownership relation.

[Still need to run a check when play begins]
When play begins:
	repeat with N running through things that belong to the player:
		now N is proper-named.

[Re-added this from your first code]		
Before printing the name of a thing that belongs to the player:
	say "[our] ".

Section 2 - Things

The Office is a room.

The vintage chair is an enterable supporter in the Office.
It belongs to the player.
The player is on the chair.

after taking something:
	now the noun belongs to the player;
	now the noun is proper-named;
	continue the action.

A badge is here. It belongs to the player.
A gun is here.

After dropping something:
	now the noun does not belong to the player;
	now the noun is improper-named; [To revert to using articles] 
	continue the action.

This should also work with “x my badge” etc.

Oh yes! That does the trick, thank you.

So the issue is just that some library messages use the indefinite article, and others the definite?
Is there a good reason for that, or is that just a quirk?

It’s not a good idea to use proper-named for an object unless it truly is a name – that is, begins with a capital letter. The library assumes that proper-named objects can be freely used at the beginning of a sentence.

So you can get stuff like this:

The bag is a closed proper-named container.
The printed name of the bag is "your bag".

In general, any message that uses “[The noun]” will fail for such an object. The library has a handful of messages which do that. (Though not as many as use “[the noun]”.

There’s no perfect solution for what you want to do. The safe option is to go with the indefinite article solution, and just accept that some library messages use “the” or “The”.

That’s very interesting, thanks! Presumably my requirement is rarer than I expected, in any case, I’m glad it wasn’t just me failing to spot something obvious :wink:

So, I’ll probably end up with what you’ve both suggested, thanks again.
But it’s probably worth idly chipping away at it for a bit so, two thoughts are:

  1. The quixotic option: could you override the actions that print “[the]” and “[The]” to make this change globally?
  2. If I want to override just a few of the texts, how do I best go about finding where they are generated?
    For example, if the “(on the vintage chair)” text is the opening situation of the game and I want to establish the possessive nature of the character early, but the default text breaks the illusion. How do I go about finding just that one text?
    e.g. Do I need to start getting familiar with the source code, or are there short-cuts to finding which text to play with?

If you start up a game in the IDE and type “responses all,” it’ll give you a massive dump of all the rule responses in the game–you can look through there to find the message that you’re concerned with. In this case, searching for the text “(on [the”, it looks as though what you need to change is:

    room description heading rule response (B): " (on [the intermediate level])"

You can make special capitalized and uncapitalized substitutions to print “your” and “Your” appropriately for these cases:

[code]Lab is a room. The throne is in the Lab. The player is on the throne. The indefinite article of the throne is “your”. A rock is in the Lab. A chair is an enterable supporter in the Lab. A box is a container in the lab. The indefinite article of the box is “your”.

Room description heading rule response (B) is " (on [the-special intermediate level])".
Examine containers rule response (B) is “[The-special noun] [are] empty.”

To say the-special (item - an object):
if the item is the throne or the item is the box:
say “your [item]”;
otherwise:
say “[the item]”.

To say The-special (item - an object):
if the item is the throne or the item is the box:
say “Your [item]”;
otherwise:
say “[The item]”.[/code]

Note the proper capitalization of “your,” and that it says “on the chair.” Of course if you had a bunch of these things you’d want to do something like checking whether the thing belongs to the player, as you did in your original code. And you can substitute “the-special” for “the” in as many rule responses as you need to. (But I think anything that involves lists with definite articles will be too deep in the internals to be doable this way… though there may not be any such responses built in to the standard rules.)

Thanks matt w!

And sorry, I realise that “responses” is in fact suggested in the I7 manual/tutorial, but I hadn’t figured out that that (rather than an activity) was the thing I needed to look at here.

All the best,
osf’

You could also alter the object-name-printing code directly. Look in the English extension.