Making the pronoun "it" apply to the last noun examined

Say you have some “soldiers” and they’re plural-named. A player types X SOLDIERS and then follows up with ATTACK IT. What Inform wants is ATTACK THEM, but the player is either thinking about attacking one soldier or the soldiers as one group. Whatever they’re thinking, ATTACK IT makes the parser hiccup.

One solution is to have an additional singular “soldier” that redirects to the plural-named “soldiers.” But this would be tedious to implement in a game with too many plural-named nouns (like the one I’m writing). I’d like to have something like this:

[code]The itnow is some text that varies.

After examining something:
let the itnow be the noun.

After reading a command:
if the player’s command matches “attack it”:
replace the player’s command with “attack [itnow]”.[/code]
This doesn’t work, but you can get the idea: applying “it” to anything, whether singular, plural, objects, people, scenery, etc.

Any help would be much appreciated!

The rules which set the pronouns “it”, “him”, “her” and “them” are set pronouns from items in room descriptions rule (invoked by LOOK and for room descriptions) and set pronouns from items from multiple object lists rule (EXAMINE etc).

heartless zombie–I think using those rules isn’t going to help much, because you can’t set the pronoun “it” to a plural-named object. I thought making the objects ambiguously plural might help, but that only seems to work with singular-named things:

[code]Arena is a room. Some soldiers are in the Arena. The soldiers are ambiguously plural. The player carries a bouquet of flowers. The bouquet of flowers is ambiguously plural.

Test me with “pronouns/x flowers/pronouns/x soldiers/pronouns”.[/code]

As you can see “it” gets stuck on the flowers and “them” switches back and forth.

I’m not entirely sure what the desired behavior is, but you can peek into I6 to see whether “it” and “them” have referents, and if “them” does but “it” doesn’t, you can replace “it” with “them” in the player’s command so “attack it” gets redirected to “attack them”:

[code]The Arena is a room. Some soldiers are in the Arena. The player carries a rock.

To decide whether the pronoun it is unset: (- LanguagePronouns–>3 == NULL -).
To decide whether the pronoun they is unset: (- LanguagePronouns–> 12 == NULL -).
To decide whether the pronoun they is set:
if the pronoun they is unset, no;
yes.

After reading a command when the pronoun it is unset and the pronoun they is set:
if the player’s command includes “it”:
replace the matched text with “them”.

Test me with “pronouns/actions/attack it/i/x rock/pronouns/attack it”.[/code]

Note when the action switches from attacking the soldiers to attacking the rock. This seems like it should be a lot more robust than trying to match the player’s exact command and replace it with something.
(At least I think this works. Won’t ever claim to really understand something in I6.)

Note that if you wanted to try your approach, you’d have to set the itnow to

the substituted form of "[the noun]"

because the noun isn’t text. And you might want to make that a Carry out examining rule rather than After, because more than one Carry Out rule can run but After rules cut off the action. (Not that it’d likely make much difference, since the rules that print the examining text are carry out rules.) But trying to key your behavior directly to “attack it” is fragile, anyway.

Thanks for the help. This still doesn’t seem to work for me, but I’ll keep tinkering.

One reason I’d like to universally replace IT with “the last noun you examined” is to cover not only THEM, but also HIM and HER. Players seem to use IT to refer to everything, and then they get frustrated when another pronoun is required instead. Even worse, sometimes they think the object isn’t implemented. So that’s what I’d like to avoid, by having IT always work for every noun.

Well, I think you could check whether “him” and “her” are set by looking at (- LanguagePronouns–>6 == NULL -) and (- LanguagePronouns–>9 == NULL -), and go through the cases to see which is which.

How is it not working? Like I said, I’m not confident about any of my I6 stuff.

This seems to work:

[code]Report examining something:
fix the pronouns of the noun;

To fix the pronouns of (examinee - an object):
(- FixPronouns({examinee}); -)

Include (-

[ FixPronouns obj;
SetPronoun(‘them’, obj);
SetPronoun(‘it’, obj);
];

-)
[/code]

That also doesn’t work… I think I’ve dug myself into a hole with how I wrote the code, because these solutions do indeed work when I make a fresh blank game. Oh well. I may have to live with Inform’s default pronoun preferences this time. Thanks for the help, everyone!

I can help! First make the soldiers ambiguously plural.

Then add the Gender Options extension which I just offered up for gamma-testing in this thread:

https://intfiction.org/t/want-gamma-testing-for-new-i7-extension-gender-options/11630/1

It should do the trick. It makes both “it”“he”/“she” (depending on gender) and “them” match for ambiguously plural things, whether they are singular-named or plural-named. (Among other things.)

It should be a drop-in which won’t affect the rest of your code, unless you’re using other extensions which do heavy hacking of the I6 Library or the Standard Rules. It should Just Work Right. :slight_smile: (And tell me if it doesn’t, since I need to finish gamma-testing!)

I spent quite a long time developing this extension for a different purpose, but it happens to solve your problem.

I’ll get it published in the usual places after it finishes gamma testing.

To do this with my current version of Gender Options active, do the following:

(1) Never specify characters as “a man” or “a woman”. Instead use “person”. If you want a man, say “X is not female”. If you want a woman, say “X is not male.” Yes, I know, this is confusing… so I’m going to remove this restriction.
(2) Add the following lines:

A person is neuter.
A plural-named object is ambiguously plural.
Prefer neuter gender is false.

This request inspired me to make a couple of subtle tweaks to Gender Options so that restriction (1) won’t be true in the release version. I’ll be including an example which is targeted specifically to your use case.

Oh, thanks! I totally missed seeing your replies. I don’t have time to try this right now, but I’ll test it in a few days and report how it works.

I’ve finally had the chance to try this out, and it appears to work perfectly!

It is so perfect I’m worried I might be overlooking something. Are there any potential bugs I should watch out for? I’m using it for an IFComp game that’s already gone through a lot of beta-testing, so I can’t really redo all that testing to look for new knots, but I can target specific areas if I know there might be issues.

Thank you for this! It seems like a really useful extension.