I want an NPC (JOHN) to understand JOHN, EXAMINE YOURSELF as JOHN, EXAMINE JOHN.
For many obvious reasons, I don’t want to add “with name ‘yourself’” as it would collide with the player (if I type EXAMINE YOURSELF you should read a player.description or whatever).
And yes, I’m coding another Computing Companion™. Wish me luck.
I would create a single “yourself” object which is always in scope, and have any actions taken on that object change the noun (or second noun) to actor.
A parse_name routine is the best way to handle this, even though it is a lot. The actor global should be set by the time parse_name is called, so you can use that to decide what 'yourself' means.
Thanks Andrew. Unfortunately I don’t understand very well how parse_name works. I’ve seen a lot of code but can’t understand how to tailor it for my needs. Any chance of a code somewhere with similar abilities? I will try and sort this out myself.
parse_name [ n;
if (actor == self)
{
while (NextWord() == 'name1' or 'name2' or 'you' or 'yourself') n++;
return n;
}
else
{
while (NextWord() == 'name1' or 'name2') n++;
return n;
}
],
I suppose I can get rid of the name routine with this, right?
Yeah, I figured the ™ was joking around. But it was cute (and I do the same thing sometimes), so I was happy to repurpose it. Thanks for the explanation!