I have a bedroom which contains beds and bedding for various NPCs, one or more of whom can also be in the room at stages of the game. The NPC currently in the room is named Felicity, and her bedding is named ‘Felicity’s pillow’, etc.
Problem: When the player types ‘look at Felicity’, they are presented with:
Which do you mean, Felicity, Felicity’s bed, Felicity’s pillow, Felicity’s bedding or Felicity’s mattress?
It is in fact impossible to examine the NPC in this way, as entering Felicity here will simply repeat the which do you mean question.
Can I specify the NPC as a ‘priority’ choice, so that simply entering ‘Look at felicity’ will look at the NPC, whereas 'Look at Felicity’s" would present the other options? There may be other solutions to this, like a tidier way of assigning the bedding items to each NPC, or even creating one pillow item which can return different descriptions depending on the NPC name the player types before it.
Thanks for reading!
You’re probably using a Z-machine. Though I’m far from knowledgeable enough in the Z-business to explain it, these VMs seem to have peculiar troubles with names in specific situations. For example, your “Felicity” vs “Felicity’s” dilemma. I think it may have to do with the length of the name, but I’ll leave it to someone who knows better to explain.
Switching to Glulx seems to fix this problem. Though if that is not desired, there is still hope. One way to tackle an ambiguation dilemma is to influence the system to make more sensible choices. Check out 16.19 of the manual for information about using “does the player mean” to do it.
But be careful. “Does the player mean” especially in your situation can be a powerful and deadly rule. Write it carefully and be sure to test it thoroughly.
Yeah, the Z-machine internally truncates words in object names and command verbs to 8 letters or something. So it can’t distinguish between Felicity and Felicity['s].
It’s slightly more complicated than that. The Z-machine and Glulx both truncate words to 9 letters, but the Z-machine deals awkwardly with the apostrophe – it’s coded with more bits – so it gets cut off.
If the character’s name had nine or more letters, the problem would arise on both platforms. So you should sort out a solution with a “Does the player mean” rule no matter what. I don’t think it’s as scary as abjectadjective implies; just look at some examples and test it some.
Hi, thanks for the help!
I have used:
Does the player mean doing something with Felicity: it is very likely.
There don’t seem to be any bugs when testing, should I have anything more complicated than this or should it be OK?
One more thing, when the player ‘does something with Felicity’, the game now returns (felicity) before performing the action. How can I stop it displaying the message in this particular instance? Obviously I don’t want to get rid of bracketed clarifications in all circumstances, but it shouldn’t appear here. Thanks again!
You want something like
Rule for clarifying the parser's choice of Felicity: do nothing.
Clarifying the parser’s choice of something is an activity, so you can check it out in the chapter on activities in the Manual for the details.
That works perfectly, many thanks to you all.