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

>X OLDFORM
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.

3 Likes

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…

2 Likes

Um, ok, I was offbase in a couple ways above, and didn’t know it.

First of all, the notHereMsg is superfluous. The mere DEFINITION of the object will give you what you need. IE

absentForms : Unthing 'adj1 adj2 adj3 form1/form2/form3';

This will resolve to a valid object, but without location will never be present and the ‘can’t see’ message will be produced. Simpler!

More insidiously, because I chose to mimic the stock answer, I did not notice that my origText definition is wrong. np_ is an OBJECT, not a text string. What you want is this:

    origText = gAction.dobjMatch.getOrigText()

Sorry for the confusion!

3 Likes

I actually have a master dummy object a la your absentforms, to which I give the vocab of any words in the game that might be transitory or modal. For exactly your reason, so that the parser doesn’t treat them as not part of the game when they’re off duty…

Actually, more specifically the dummy starts with a certain amount of vocab the player could be expected to know, but gets initialized with more vocab when the player learns new words that might later get dict removed…

1 Like