An unnamed NPC: pronoun problems

Hey All–

I have an unnamed male NPC. His printed name is just “him”. But if you try a verb with a standard “The NPC might not like that” response, it’s wonky-- “Him might not like that.”

How can I get around this?

1 Like

Check for the proper-named property? What’s the code for the declaration for the person?

1 Like

Ooh, that’s a tough one. You can hook into the “printing the name of” activity to make it print differently in different circumstances, but by default, Inform doesn’t actually know if the noun is being printed as the subject or the object of a verb. In English that doesn’t matter, after all—English nouns don’t change their case, and “[the noun]” will never be a pronoun, right?

Except, that’s not quite true. If you say “[The player] [are] [the player]”, it will print “You are yourself”. In other words, for this one specific case of the thing being the player it looks at the capitalization—if you use “The”, it assumes it’s a subject and prints “[We]” (print protagonist internal rule response A), and if you use “the”, it assumes it’s an object and prints “[ourselves]” (print protagonist internal rule response B).

This is not necessarily a good solution, but it works 90% of the time. I think there’s some workaround in the library that you can use that other 10%, when a subject isn’t at the beginning of the sentence or an object is, but I can’t find it in Basic Inform or English Language, so that will have to wait for someone else.

Now, how does it accomplish this feat? Well, by using I6 code. But fortunately we can tap into a little bit of that I6 code for our own purposes. If we used “The” or “A”, it sets a hidden variable called caps_mode before delegating to the “printing the name of” activity (and the “standard name printing rule”). So if we just take a peek at that hidden variable…

To decide whether printing capitalized: (- (caps_mode) -).
Rule for printing the name of the mysterious figure when printing capitalized: say "He".
Rule for printing the name of the mysterious figure when not printing capitalized: say "him".
2 Likes

Well, good to know that hour of scanning the docs looking for something on this before asking was time well-spent.

Your code throws a “translation failed because of I6” error:

L31031: variable must be defined before use: “caps_mode”

This is probably one of those things that means I really have to switch to v10, ya?

Oh, right. Yes, the code I provided was for version 10. I’m guessing earlier versions named that variable something different. Let’s see here…

Hm, no, caps_mode is still defined in Printing.i6t in 6M62. I wonder why that’s not working.

Oh. Printing.i6t is included late in the process, and 6M62 cares a lot about declaration order. Blah. This should work.

To decide whether printing capitalized: (- IsCapsMode() -).

Include (-
[ IsCapsMode ; return caps_mode; ];
-) after "Printing.i6t".

This just adds an I6 routine that returns the caps_mode variable, but defines that routine after Printing.i6t so it knows that variable exists.

2 Likes

Another approach that might work for you: There are several places in the Standard Rules where the “[The noun] [might not like] that.” or somesuch appears as a response. You could merely rewrite the responses with an if statement to check if the noun is the unnamed NPC. I think that would get everything, or are there some that can’t be changed via responses?

2 Likes

They all can, there are just a lot of them.

2 Likes

Haven’t tried, but instead of using some I6, wouldn’t it be possible to simply overload the phrase definition?

The NPC is man.

To say the (O - the NPC):
    say "him";

To say The (O - the NPC):
    say "He";
5 Likes

Yes, actually, I think that should work!

1 Like

I count ten. Maybe I’m missing some. But ten doesn’t seem like a lot, if the alternative is hacking around the way Inform handles printing names.

1 Like

I mean, inserting a check into every response still seems like hacking around the way Inform handles names. A “printing the name of” rule is, imo, the best way to isolate the code and make it only apply to this one person.

1 Like

Okay, I agree. The multitude of “[The actor]” texts would be prohibitive. There is one special case rule, though:

Check an actor taking (this is the can't take other people rule):
	if the noun is a person:
		if the actor is the player, say "I don't suppose [the noun] [would care] for that." (A);
		stop the action.
1 Like

Yep. I feel sure the library introduced some special way to produce lowercase “you” or capitalized “Yourself”, but I cannot for the life of me find it. (And that rule doesn’t need it because it knows the noun won’t be the player: the “can’t take yourself rule” comes before it.)

1 Like

That worked beautifully. Thanks!

3 Likes

The Can’t Take Yourself Rule isn’t relevant to the Can’t Take Other People Rule, since the latter is comparing the actor to the player, not the noun to the player. Or am I misunderstanding you?

As in, >TAKE ME will never reach the can’t take other people rule, because it will be blocked before that by the can’t take yourself rule. Which means the can’t take other people rule doesn’t have to worry about the case where the actor and the noun are the same (which would print “I don’t suppose yourself would care for that”).

2 Likes