Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
Tutorial explaining how to work with pronouns in AdventureJS. tutorial, pronouns

Customize Output:Pronouns

AdventureJS handles pronoun switching via the game.settings.person setting. All of AdventureJS's built-in responses to players (over 1,000 of them) are pre-formatted to support pronoun switching. The below example shows how to set a game's pronoun property. The same function call can also be used to change the setting dynamically during runtime.

MyGame.settings.set({ person: "second", });

The game's person setting is distinct from a player character's gender property. For instance, the player character might be female while the parser uses second person pronouns. AdventureJS comes with these pronouns out of the box: first, plural, second, male, female, non-binary, and non-human.

Pronouns are stored in a lookup table at game.dictionary.pronouns. The table also includes a few common contractions. We use plural pronouns as lookup keys for our pronouns table, because that is the only set of pronouns where every item is unique (for example, consider our|ours vs his|his). See the table below for a complete list of substitutions.

Pronoun Lookup Table

First Plural Second Non-binary Male Female Non-human
we I we you they he she it
us me us you them him her it
we'd I'd we'd you'd they'd he'd she'd it'd
we've I've we've you've they've he's she's it's
we'll I'll we'll you'll they'll he'll she'll it'll
we're I'm we're you're they're he's she's it's
our my our your their his her its
ours mine ours yours theirs his hers its
ourself myself ourselves yourself themself himself herself itself
ourselves myself ourselves yourself themself himself herself itself
don't don't don't don't don't doesn't doesn't doesn't
haven't haven't haven't haven't haven't hasn't hasn't hasn't
weren't weren't weren't weren't weren't wasn't wasn't wasn't
have have have have have has has has
were was were were were was was was
are am are are are is is is

Adding Pronouns

Authors can easily add new pronoun sets to a game, as shown below. (The example only shows the first couple of pronouns, but of course you'd want to add a complete set, as listed in the table above.)

MyGame.settings.set({ person: "foo" });
MyGame.dictionary.pronouns.foo = { we: "IFoo", us: "MeFoo", [...] }

Placeholder Text

In order to write text that adapts to the game's person setting, use pronoun and contraction placeholders, as in the example below.

MyGame.createAsset({
  class: "Thing",
  name: "unexceptional thing",
  description: `{We} {don't} see anything special about the unexceptional thing. `,
});

To learn more about placeholders, see Customize Output: Placeholders.