Disguising an NPC

Here is some example source text:

[code]The saloon is a room. “Is this the right place? It looks pretty run down.”

Zoro is a man in the saloon.
Understand “old man”, “man” as Zoro when Zoro is proper-named.
The description of Zoro is “There’s something strange about him. Is it his face, or something else?”.

Some hands are a kind of thing.
Understand “hand” as hands.
Some hands are a part of every person.

A face is a kind of thing.
Understand “eyes”, “nose”, “mouth” as a face.
A face is a part of every person.

Understand “old man’s” as a thing when the item described is a part of Zoro.
Understand “man’s” as a thing when the item described is a part of Zoro.

To disguise Zoro:
now the printed name of Zoro is “old man”;
now the printed name of Zoro’s face is “old man’s face”; [A]
now the printed name of Zoro’s hands is “old man’s hands”;
now Zoro is improper-named; [B]

To unmask Zoro:
now the printed name of Zoro is “Zoro”;
now the printed name of Zoro’s face is “Zoro’s face”;
now the printed name of Zoro’s hands is “Zoro’s hands”;
now Zoro is proper-named;

Instead of examining hands which are a part of Zoro:
say “You’d recognize that tattoo anywhere. The man before you is the masked crusader himself.”;
unmask Zoro;

When play begins:
disguise Zoro;[/code]
Here is the resulting transcript:

[code]saloon
Is this the right place? It looks pretty run down.

You can see an old man here.

x old man
There’s something strange about him. Is it his face, or something else?

x old man’s face
You see nothing special about old man’s face. <PROBLEM

x old man’s hands
You’d recognize that tattoo anywhere. The man before you is the masked crusader himself.

x old man’s face
You see nothing special about Zoro’s face.[/code]
Note the line marked “<PROBLEM” in the transcript.
This example illustrates an issue I’m having with the grammar of named body parts, specifically when switching a person to improper-named.
When Inform references a part of something, it seems to stick to the original phrasing of when the thing was created. I don’t mind manually renaming his body parts when he transforms. Changing Zoro to improper-named doesn’t seem to affect the problematic output like I was hoping it would.

I’m looking for some method that will cleanly change back and forth between “Zoro’s face” and “the old man’s face” in generated phrases.

If I say:

now the printed name of Zoro's face is "the old man's face";

That fixes the specific grammar issue, shown above, but creates other nagging issues with phrasing.

The examples in the documentation usually declare a person as improper-named in the source text, then change their identity to proper-named later.
I’d rather do it the other way around, so I end up with a bunch of code about “Zoro” and not an entire source text referring to “the old man”.

In this case, it looks to me as though what you want is to have the printed name of the face/hands incorporate Zoro’s printed name directly. That way you can rely on Inform’s article handling for Zoro to produce “the” or not depending on whether Zoro is proper-named or not at the moment.

I came up with this. The printed name of face/hands involves a pretty ugly formulation involving a random person that incorporates them, but we put “the” in front of that person and it gives us “the” when the person is improper-named and nothing when he is proper-named. Then I commented out the lines that were setting the printed name of the face and hands in the disguise/unmask phrases, because we don’t need them anymore. This also has the nice feature that the printed name of the body parts will always track the printed name of the character; you don’t have to worry about missing a place where you need to set those printed names.

If you could have body parts that weren’t enclosed by a person you’d have to be a bit more careful–I guess you could test for whether they were incorporated by a person in your text substitution. Depends on how dark and gritty you want this western to be.

[code]The saloon is a room. “Is this the right place? It looks pretty run down.”

Zoro is a man in the saloon.
Understand “old man”, “man” as Zoro[ when Zoro is proper-named].
The description of Zoro is “There’s something strange about him. Is it his face, or something else?”.

Some hands are a kind of thing.
Understand “hand” as hands.
Some hands are a part of every person.
The printed name of a hands is usually “[the random person incorporating the item described]'s hands”.

A face is a kind of thing.
Understand “eyes”, “nose”, “mouth” as a face.
A face is a part of every person.
The printed name of a face is usually “[the random person incorporating the item described]'s face”.

Understand “old man’s” as a thing when the item described is a part of Zoro.
Understand “man’s” as a thing when the item described is a part of Zoro.

To disguise Zoro:
now the printed name of Zoro is “old man”;
[ now the printed name of Zoro’s face is “old man’s face”; [A]
now the printed name of Zoro’s hands is “old man’s hands”;]
now Zoro is improper-named; [B]

To unmask Zoro:
now the printed name of Zoro is “Zoro”;
[ now the printed name of Zoro’s face is “Zoro’s face”;
now the printed name of Zoro’s hands is “Zoro’s hands”;]
now Zoro is proper-named;

Instead of examining hands which are a part of Zoro:
say “You’d recognize that tattoo anywhere. The man before you is the masked crusader himself.”;
unmask Zoro;

When play begins:
disguise Zoro;[/code]

(I also took out “when Zoro is proper-named” from the first Understand statement. That was messing up the first command. Do you want to make Zoro privately-named and then only have “Zoro” understood as him when he is proper-named?)

This is an excellent solution!

Luckily there isn’t going to be any dismemberment in my game. I don’t mind that using the name “Zoro” in the prompt will give the situation away.

Your answer gets me 80% of the way there, but there’s one other nagging issue.

Consider this:

Every turn: say "[Zoro] glances at you.";

The output I’m getting is: “old man glances at you.”
I want something that will switch between “The old man” and “Zoro”, if it’s at all possible, and “the” needs to be case sensitive.
There’s a lot of text in my game, so I’d like to use a [Zoro] token if at all possible.

That’s a little counterintuitive, but simple:

Every turn: say "[The Zoro] glances at you.";

By adding “The” inside the token, you get “The” when Zoro is improper-named, and nothing when Zoro is proper-named. It’s just like “[The noun]” except that you’re using the specific named thing “Zoro” rather than the variable “noun.”

To make it case-sensitive, you can write “[the Zoro]” where appropriate:

Every turn: say "[The Zoro] glances at you. You glance back at [the Zoro].";

Thank you. I feel like I knew this already but forgot.

You’re welcome! You don’t usually see it in relation to a single named thing, because it’s relatively rare for those to switch names back and forth between proper-named and improper-named. If you weren’t switching names, then “[Zoro] glances at you” would be safe. Which is also why “[The Zoro]” sounds weird.