Transmogrification and vocabulary

Say you are implementing objects with multiple forms. Here’s three ways to do it:

  1. Define each separate form as a unique object, them move them into/out of scope as they manifest.
  2. If you are lucky enough to have a common noun, use ThingState to manage the adjectives so that only the currently relevant adjective (say ‘tiny’) matches, but you don’t get deceptive messages for the other states (ie ‘giant’)
  3. BUT. If you are dead set on keeping a single object (say an NPC that needs to maintain ActorState across multiple forms) and need multiple nouns, one solution is to use cmdDict.removeWord(self, prevForm, &noun); and cmdDict.addWord(self, newForm, &noun);

That last works fine, EXCEPT, if the player refers to old forms on command line you get

The word "oldform" is not necessary in this story.

This could be thoroughly deceptive if the form can cycle back around, or if the player can anticipate a coming form. And is just kind of unsatisfying.

Here’s a cheesy way to manage that, using our friend Unthing.

absentForms : Unthing 'adj1 adj2 adj3 form1/form2/form3'
    notHereMsg = 'You see no <<origText>> here.  '
    // second param doesn't matter, as only used if missing
    // resolveInfo object.. which it can't if we get here
    origText = gAction.getResolveInfo(self, DirectObject).np_

That last line is the magic. It allows creation of a catch-all Unthing (which only match in parser if no other object matches), then parrots the player’s input back into the NotHere message.

I am sharing this mainly because it took a DEEP dive to find the original player input, and had me wondering if there was an easier way to find it. Also, because I love UNTHING.


Seriously, I miss being in the middle of gamemaking and having to figure out obscure stuff like this. I look back fondly on my many deep dives into the recesses of the adv3 library…