Custom Library Messages

version 4/120212 by Ron Newcomb

  • Home page
  • Beginning
  • Next



  • Documentation


    Section : Changing Tense and Viewpoint

    This extension can change the tense and/or viewpoint of all of Inform's pre-packaged responses at once. It also allows replacing Inform's library messages in the same way as Default Messages by Ron Newcomb. We select the viewpoint and tense with the following lines. If we don't specify, first person present will be used.

        The story tense is past tense.
        The story viewpoint is third person feminine.
        
    The possible viewpoints are:
        first person
        second person
        third person masculine
        third person feminine
        third person
        first person plural
        third person plural

    And the story tenses:
        present tense
        past tense


    A testing command, POV, prints the current viewpoint and tense, and can change them as well.
        > pov
        Adventures in Linguistics is in first person past tense.

        >pov third person masculine
        Adventures in Linguistics is now in third person masculine past tense.

        >i
        He was carrying nothing.

        >pov present tense
        Adventures in Linguistics is now in third person masculine present tense.

        >i
        He is carrying nothing.

    Tense and viewpoint can be changed during play as well. Code-wise, viewpoint is easiest because only the pronouns used in the messages need change, and there's a very short list of pronouns in English.

        Carry out becoming Lady Marion: now the story viewpoint is third person feminine.

    In our own writing, these phrases say whichever pronoun is appropriate for the story viewpoint, the capitalization, and the role in the sentence. We use the first person plural not because it reads best, but because all ten cases are different, avoiding verbose circumlocutions like 'his-mine' or 'I in lowercase'.

        "[we]"
        "[us]"
        "[ours]"
        "[ourselves]"
        "[our]"

        "[We]"
        "[Us]"
        "[Ours]"
        "[Ourselves]"
        "[Our]"

    For example, this:
        Report wearing something: say "[We] donned [the noun]." instead.

    could print as any of these.
        I donned the...
        You donned the...
        He donned the...
        She donned the...

    And so on. More complicated differences in writing can use "[if the story viewpoint is first person]" and the like.

    Changing the story tense between present and past is a slightly trickier problem because there's many more verbs than pronouns, some verbs are highly irregular, and the verb must agree with the subject. First, the easy part.

        When a flashback scene begins, now the story tense is past tense.
        When a flashback scene ends, now the story tense is present tense.

    For regular verbs, we only append one of the suffix phrases "[-s]", "[-es]", "[e-s]", or "[-ies]". (Note the hyphen: there are non-hyphenated versions in Inform and other extensions which are for nouns, not verbs.) An example of each of our verb suffixes:
        Report waiting: say "[We] wait[-s]." instead.
        Report searching: say "[We] search[-es] [the noun]." instead.
        Report waving: say "[We] wav[e-s] back." instead.
        Report spying: say "[We] sp[-ies] on [the noun]." instead.

    For irregular verbs, we must explicitly tell Inform about them. This extension already defines several: are*, aren't*, have*, do*, go*, eat*, feel*, find*, get*, give*, hear*, put*, see*, take*, wear*, think*, and keep*. (The trailing asterisk prevents confusing Inform.) For example:
        Report eating: say "[We] [eat*] [the noun]." instead.

    That prints either "eat" or "ate", as appropriate. The others are used similarly.

    We can add to this list as well, of course. In the following sample, we add "weave" and "say". For the say-phrase we use within our prose, we use the present plural with an asterisk appended. We list the other three forms in plain ol' text.

        Some irregular verbs are weave*, say*.
        
        Table of Irregular Verbs (continued)
      irregular-verb-form  
      "weaves"  
      "weave"  
      "wove"  
      "says"  
      "say"  
      "said"  

    The order is very important here. Not only do the order of the asterisked verbs need come in the same order as their corresponding sets in the list, but the three forms in each set come in the same order as that of a relation from chapter 13.9 of the manual: "The verb to weave (he weaves, they weave, he wove) implies the..."

    Occasionally we'll need to use one of are, have, or do, as a helping verb instead of the main verb. For this, these:
        "[are+]"
        "[have+]"
        "[do+]"

    As an example, with 'decide' and 'wear' as the main verb:
        say "[We] [have+] decided to soldier on."
        say "[We] [are+] already wearing [our] uniform."

    The first can produce:
        I have decided to soldier on.
        I had decided to soldier on.
        He has decided to soldier on.
        We had decided to soldier on.

    And so on.

    Subject-verb agreement is usually observed automatically because the last object printed is remembered for the verb's (or suffix'es) benefit, except in a case like this.
        say "Time march[-es] on."

    'Time' isn't an object, so the "[-es]" suffix would be considering some other object in the game, one that might be plural. To ensure it, "[=> (an object)]" can be used to silently inform the next verb or suffix what it's supposed to agree with. If no object is handy, "any third person singular" and "any third person plural" will suffice.
        say "[=> any third person singular]Time march[-es] on."
        say "[=> any third person plural]Some people pass[-es] by."

    This will now produce the appropriate:
        Time marches on.
        Time marched on.
        Some people pass by.
        Some people passed by.

    Hence changing tense during play is a little trickier than changing viewpoint, but only because the computer isn't responsible for anything but the simple grammar we all take* for granted.



    Section : Replacing Selective Responses

    Inform comes pre-packaged with many messages for many situations. Although changing the story viewpoint and tense will automatically change these, much of writing interactive fiction boils down to providing fresh writing for the same interactive framework. If the story viewpoint and/or tense are never changed from second person present, then the smaller, similar extension Default Messages by Ron Newcomb also replaces responses, and by the same method: a table of three columns. The first column is for the action involved (or just the -- double hyphen for general messages), the second is a number (because many actions have many outcomes), and the final column is the response to the reader.

        Table of custom library messages (continued)
        library-action library-message-id library-message-text
        -- 10 "(I beg your pardon, but I didn't catch your drift.)"
        going action 2 "Marion saw nothing interesting [noun] of there."
        taking action 1 "Marion had always wanted [a noun]!"
        -- 28 "(I understood [library message verb] but not the rest of it.)"

    There's a few variables that come in handy for certain messages. "The noun" and "the second noun" are of course available, as is "the number understood" and similar. The others are:

        the person asked -- we cannot use "the actor" within our table, but this is identical.

        library message verb -- this would be "take" for the taking action, "go" for the going action, etc. (More precisely, it is the entire command predicate typically used in "What do you want to take?" or "I only understood you as far as take them.")

        library message pronoun -- when our reader uses a pronoun, this is the pronoun she used.

        pronoun reference object -- the noun that the above pronoun refers to.

        library message object, second library message object, library message amount -- effectively synonymous with the noun, the second noun, and the number understood for non-action messages.

        library message action, library message number -- these are the variables that are compared to our two table columns. The first differs from the library message verb in that it has the present participle ("taking") rather than the root form ("take"). For actions which take two nouns, the preposition is also included ("giving it to").

    The extension usually guesses correctly on line break issues, but for those cases where it adds an extra, the say phrase "[ignore library line break]" should cure it. It can be mixed-n-matched with the normal "[run paragraph on]" if need be.

    (Table amendments, rather than continuations, may be used for actions to save some computer memory. See chapter 15.19 in the manual.)


    Section : The Printing Library Message Activity

    A new activity, "printing library message", is available for whatever purpose. It is an activity on numbers, though a "while" clause can attach an action's name to one of its rules. For messages that aren't attached to a particular action, use "misc messaging" as the action.

        For printing library message 3 while taking: say "Er, nevermind."
        For printing library message 10 while misc messaging: say "Please type something in."

    We can create multiple tables that resemble the custom library messages table, and deem one of them the official table via a table-that-varies, "the default messages table."
        
        Carry out Lady Marion following the player:
            now the default messages table is the table of Lady Marion's observations.
        
        Table of Lady Marion's observations
      library-action  library-message-id  library-message-text  
      --   10  "'Are you always so quiet, [player]?'"  


    If the alternate table does not hold every message, we can leverage the activity to take corrective action in any number of ways. The activity's sole rule, "the standard library message rule," prints the corresponding library message for the situation, drawing it from the table referenced by the "default messages table". This rule is purposefully not placed last in the activity's 'for' rulebook so we can place rules both before and after it. We have a handful of phrases available to us to ease writing of new rules -- see the phrasebook of the index for the full list. But for the sake of example, the following rule closely resembles the standard rule, and we would likely list it before the standard rule, as it is quite unlikely Lady Marion will be commenting on out-of-world happenings.

        For printing library message:
            choose the library message corresponding to the library message action # library message number from the table of Lady Marion's observations;
            if the chosen row is zero, make no decision;
            say the library-message-text entry;
            library line break if applicable.


    The initial "choose the library message corresponding to (action name) # (number) from (table)" phrase does most of the work. Like other 'choose' phrases dealing with tables, it selects a row which later "..entry" phrases reference. The "chosen row" is a number -- the row it chose. Notably, it is zero if there is no corresponding message for that action and number combination in that table, allowing the rule to pass the situation to the next rule in the 'for' rulebook. Otherwise, after the say statement shows the message to the reader, "library line break if applicable" might tack on a "[line break]" unless the message itself used "[ignore library line break]".

    For library messages which have a blank in their action column, we can use "the miscellaneous non-action" as the action. Unrelatedly, the action our player is currently attempting is named "the action in progress".

    If no rule in the activity's 'for' phase makes a decision, a runtime error will result with the action & number of the missing message. In a release build, the reader is greeted only with silence.



    Section : Miscellaneous Substitutions

    Several say-phrases that this extension uses internally are useful for the author who needs multiple tenses or viewpoints in their story. Many of the following are similar to the ones found in the extension Plurality.

        "['s-'re]" - contraction for is-are-am
        "[is-are of (an object)]"
        "[n't]" - contraction for not
        "[that-those-us of (an object)]"
        "[That-those of (an object)]"
        "[That's-They're of (an object)]"
        "[it-them of (an object)]"
        "[it-they of (an object)]"
        "[It-They of (an object)]"
        "[^]" - capitalises what text the next phrase 'decides on'

    These touch-up a few miscellaneous messages.

        "[moment]" for the final word in "at the moment/time"
        "[here-there]" for the final word in "is here" vs "was there"
        "[can]" for can/could
        "[can't]" for can't/couldn't
        "[will]" for will/would
        "[won't]" for won't/wouldn't

    None of the say phrases in this section are necessary for the author to learn, but they occasionally come in handy. New ones can be created by quizzing the story viewpoint and story tense, or by asking if something "acts plural" to determine is/are distinctions. "The prior named noun" is the last object to have its name printed.

        To say 's-'ve:
            if the story tense is in any past tense:
                say "[']d";
            otherwise if the prior named noun acts plural:
                say "[']ve";
            otherwise:
                say "[']s".



    (Ron Newcomb can be reached at pscion@yahoo.com)