Recognize third person pronouns as the player

Hello. I’m writing a game in third person singular, so I had the idea that the player should be able to refer to the protagonist with their relevant pronouns (she/her, in this case) instead of only her name or “self” or “me”, since that’s how she’s referred to in responses.

My first idea was to use set pronouns from the player, but Inform seems to ignore it (“him”, “her”, and “it” are all unset). I also tried setting pronouns to yourself and to a new person, but it always seems to be ignored when the given object is also the player.

I could understand "her" as the player, but I’d rather not do so unconditionally in case there’s a more pertinent “her” at some point in the game, and I don’t see a way to check whether a pronoun is unset.

What would be the best way to do this?

1 Like

Do you want “her” to always mean the player? If not, under what circumstances should it mean the player rather than someone else?

If you want it to always refer to the player, I would remove “her” from the pronouns table entirely (since it’s not really a pronoun any more, it’s just a noun) and make it a synonym for yourself.

I figured I’d make it refer to the player when it hasn’t been set to anything else, e.g., since (from what I understand) pronouns are automatically set when you transition rooms, I’d ideally set it to the player every time before going to a room and then Inform could replace it if it so chooses.

Okay! That’s doable!

The trick is, the “set pronouns from” phrase specifically refuses to notice the player, at the I6 level.

[ PronounNotice obj x bm g;
    if (obj == player) return;
    …
];

However, there’s another I6 routine that will help us:

[ SetPronoun dword value x;
    …
];

This sets the value of a pronoun to an object, without any safety checks. The first parameter needs to be the dictionary word value, which is hard to access from I7. But it’s very easy to access from I6.

So we can cobble together a couple I7 phrases to do the trick:

To decide what number is the pronoun her: (- 'her' -).
To forcibly set (dword - a number) to (value - an object): (- SetPronoun({dword}, {value}); -).

Now you should be able to:

forcibly set the pronoun her to the player

If you want to be able to forcibly set “him”, “it”, and “them”, just duplicate that first phrase. Wrapping a word in single-quotes is I6 syntax for a dictionary word value; I7 doesn’t have any equivalent to it.

(Warning: have not tested this yet myself. But I think it should work.)

5 Likes

Thank you! I decided I was spending too much time on this issue, given that I’m making this for a game jam that ends in a couple days, but I’ll definitely try it out when I get a chance!

Can that crash or otherwise cause problems if you pass it a bad value? The Rust programmer in me wants to add “unsafe” to its name.

1 Like

It’ll throw a run-time problem if you feed it a number that doesn’t correspond to a pronoun, yes. If you want to be safer about it, you can hard-code that part in:

To set the pronoun her to (the item - an object): (- SetPronoun('her', {item}); -).

Now it won’t crash as long as “her” remains a valid pronoun, which it always will unless you’re doing some serious hacking (the sort you’d do to make the whole game be played in French instead, for example).

3 Likes

This is untested, having been mostly quickly copy-pasted from some existing code, but (for 10.1) this should let you

  • make ‘me’, ‘myself’', ‘self’ not refer to the player
  • make ‘her’, ‘herself’ refer to the player
  • allow you to change the above at will during play
Include (-
Constant InvalidToken = ' ';
Constant MeText        = 'me';
Constant MyselfText   = 'myself';
Constant SelfText    = 'self';
-)

Include (- Global ME1__WD        = MeText; -) replacing ME1__WD.
Include (-  Global ME2__WD        = MyselfText; -) replacing ME2__WD.
Include (-  Global ME3__WD        = SelfText; -) replacing ME3__WD.

Include (-
Constant HerToken = 'her ';
Constant HerselfToken = 'herself ';
ME1__WD  = HerToken;
ME2__WD = HerselfToken;
ME3__WD = InvalidToken;
-)
1 Like

Interesting, thanks. I think I’d prefer to add to ways to reference things, not remove them, but I suppose it could help confusion by more clearly separating the protagonist from the player conceptually.

Does the player’s special pronouns override the normal “her” pronoun, or the other way around (only referring to the player when the normal “her” is unset)?