Gamefic

Adventure Games and Interactive Fiction

Dynamic Conjugation

by Gamefic on April 28, 2016

The original version of the standard library was hardcoded to use the second person when referring to the player's character, e.g., "You go north." Not anymore. Scripts can access an object that defines grammar rules for the PC through the you method.

Setting you.person to 1 will make the game refer to the character with I instead of you. 1st, 2nd, and 3rd person are all supported.

You can also set the gender of the character to select which pronouns to use. Example:

you.person = 3
you.gender = "female"

The game's text would look something like this:

> go north
She goes north.
> take ring
She takes the ring.

The interface for handling grammar is still a little hairy. Some examples of how the standard library handles it:

# Setting you to 3rd person male
you.person = 3
you.gender = "male"
# Basic parts of grammar
you.pronoun.subj    #=> "he"
you.pronoun.obj     #=> "him"
you.pronoun.poss    #=> "his"
you.verb.be         #=> "is"
you.verb.think      #=> "thinks"
# Forming sentences
"#{you.pronoun.Subj} #{you.verb.do} a happy dance."
  #=> "He does a happy dance."
"#{you.pronoun.Subj} #{you.contract(you.verb.can + ' not')} dance."
  #=> "He can't dance."

Thorough, but not easy to read. The interface might change before the version 1 release if I can find a cleaner way to express the desired format.