Name conflicts and how to solve them?

Cheers,

in the following example:

"Name Conflict" by HtF

Persuasion rule for asking a man to try doing something: 
	persuasion succeeds.	

TestRoom is a room.

Joe is a man in TestRoom.
Joe wears the RedHat. The Description of the RedHat is "A garish, red coloured hat."
Understand "hat" as the RedHat.

The GreenHat is worn by the player. The Description is "A garish, green coloured hat."
Understand "hat" as the GreenHat.

We have a little problem when we ask Joe to take off the hat as Joe will ALWAYS take off HIS hat. When I ask Joe: Joe, take off my hat - it STILL defaults to HIS hat instead.

So the trick would be to either have Inform respect “my” to distinguish between Joe’s hat and the player’s hat or to ask the “which hat do you mean?” and then typing an additional clarification, although the “my” would be easier and less clumsy.

I’ve been doing some searching but I haven’t come up with a decent solution. Can anyone provide some help?

The parser doesn’t know that RedHat and GreenHat are both hats - all it knows is that they’re two (wearable) things, both of which can be referred to by “hat”. The “Understand ‘hat’ as…” commands conflict with each other.

Understand "my hat" as the GreenHat.

If this is something you’ll need to apply more broadly, there’s an argument for establishing that a hat is a thing and telling the parser that “my” should refer to the instance of a wearable item that is being worn by the player.

First, I suggest

[code]A hat is a kind of thing. A hat is wearable. Understand “hat” as a hat.

A red hat is a hat. It is worn by Joe. The description is “It’s red.”

A green hat is a hat. It is worn by the player. The description is “It’s green.”
Understand “my hat” as green hat.
Rule for printing the name of green hat when green hat is worn by a person:
say “your green hat.”[/code]

That should solve disambiguation. Disambiguation with TAKE OFF, I believe, usually has the person asked prefer their own held or worn items unless you tweak it with “Does the player mean…” or make it clear which hat is “yours”.

What I think you’ll run into next is the verb TAKE OFF or REMOVE usually means specifically “take off something [the person asked] is wearing” which I believe will parse as “Joe is unable to do that.” or “Joe is not wearing your hat.” since he’s not wearing the item called “my hat”. I think you’d just need JOE, TAKE HAT. Again I’m guessing, but I believe TAKE disambiguates to choose something preferably not held or worn by the actor.

I’ve not experimented much with NPCs removing clothes from the player and the involved permissions (surprisingly) so you may need to experiment with this.

One thing is that, from things said in this thread, “my” may have some special built-in handling that is hard to override:

There’s more discussion about that in this thread, along with a hack that involves replacing the word “my” before processing the command.

Hacking “my” in I6 isn’t too bad – the Parsing Descriptors heading loops LanguageDescriptors, of which the first element is “my”, so begin the loop on the second item and that should work. Am I missing something, or wouldn’t the Informy thing to do be to pull it into I7 (possibly an Activity)? Surely the biasing etc could be default I7 coded behavior?