Ideas for describing NPCs

I have some code in my WIP that might become an extension, but right now it’s too domain-specific. I keep struggling with it because there are always more cases where I’d like it to behave slightly differently. So I present the code here for your use and criticism. Please let me know if this would be helpful to you in something you’d work on, and if you have needs it does not meet, or suggestions for how to meet them, please share. Thanks!

[code]Include Plurality by Emily Short.

Part - Truth States as Phrases

[HT Ron Newcomb]

To decide whether we/there is/are/should/need a/an/the/-- (X - a truth state):
Decide on whether or not X is true;

To decide whether we/there don’t/isn’t/aren’t/shouldn’t need/have/-- a/an/the/-- (X - a truth state):
Decide on whether or not X is false;

Part - Behavior

Behavior of something is an activity on people.

For behavior:
say “here”;

Rule for writing a paragraph about a person (called P) when the initial appearance of P is not empty:
say “[The initial appearance of P] [state of P].”

Rule for writing a paragraph about a person (called P):
say “[A P] [is-are] [state of P].”

Carry out examining a person when the description of the noun is not empty:
say “[description of the noun] [run paragraph on]”;
if the noun is the player:
say “[paragraph break]”;
rule succeeds;

Carry out examining a person (this is the append behavior to the description rule):
say “[It’s for the noun] [state of the noun].”;
rule succeeds;

To say state of (P - a person):
say “[run paragraph on]”;
carry out the behavior activity with P;

Pronoun enabled is a truth state that varies.

Before behavior:
Now pronoun enabled is true.

To say disable pronoun:
Now pronoun enabled is false.

To say It’s for (P - a person):
if there isn’t a pronoun enabled:
say “[The P] [is-are]”;
otherwise if P acts plural:
say “They’re”;
otherwise if P is neuter:
say “It’s”;
otherwise if P is female:
say “She’s”;
say “He’s”;

Part - Test Example

Test is a room. Bob is a man in Test. “Your friend Bob is”. The description is “Bob is a tall man.”

Test me with “x bob”[/code]

My objections:

  • I’ve never been quite happy with the abuse of initial appearance here.

  • I’ve occasionally wanted to rearrange the sentence printed when looking (e.g. “Standing in the corner and examining the ventilation duct, Bob looks somewhat bemused.”), and I had to go back to using an overriding rule for printing a paragraph to do that.

  • I’ve been trying to figure out how to manage descriptions of plural people who are sometimes given a collective article, such as “a crowd of people.” Any ideas?

On the third point, I seem to have fixed it with this extension I just wrote (adapted from some other things I had lying around):

…thanks to Emily Short’s Assorted Text Generation and the feedback I got in this thread: