actor name substitution not working (adv3Lite)

With Harry safely off to beta-land, I’ve shifted gears to a new scenario.

I have a non-player character with a generic name (other test subject) until the game player does some things, then the NPC gets a proper name.

The Adv3Lite Tutorial offers code for making this work (The Art of Conversation, Queries and Suggestions)…

In my code, it looks like this…

// other candidate character
otherAstronaut: Actor 'other test subject;other candidate' 
    "The test subject is approximately your age, with a trim, physically fit
    physique not unlike your own.<.p>"
    
    globalParamName = 'otherAstronaut'
    person = 3
    contType = Carrier
    
    setName
    {
        proper = true;
        name = 'Alexi';
        return name;
    }
;    

It does not work as expected. After I call setName, when I enter talk to Alexi in the game window, I get…

But if I use the character’s generic name I get…

What am I missing?

Jerry

Well, that was fast…found it.

I needed to add the new name to the character vocabulary, by adding this to the setName function…

addVocabWord('Alexi', MatchNoun);

Now it works.

That’s right. In the Angela example in the Tutorial, ‘angela’ was already in Angela’s vocab property, so it didn’t need adding in the makeProper() method, whereas your set-up was slightly different.

Your solution is fine, and I’m glad you managed to find it so fast. An alternative would have been to do this:

setName()
{
    replaceVocab('Alexei; other test; subject candidate man');
    return name;
}