You’re playing along and you see an item with the following description:
So, naturally, you try examining things on the clock:
Yes, this example is excessive. I wrote it to make a point. These little nuisances bug me. What do you mean I can’t see any such thing? You just told me it was there!
To fix the nuisance messages, an author might choose an obvious solution and create objects for all of those things and make them parts of the clock. However, in a large body of work, doing so may lead to many pointless objects that take up valuable memory. Doing all that also bogs down the creative process. Of course, one can also try to write around the problem and never make references to nouns other than the noun of interest. That gets tedious and may actually, in some cases, be impossible. It seems that authors commonly choose to tell the game to understand each of the parts as the noun of interest. Understand “cuckoo” as the clock. Understand “face” as the clock. That leads to a very repetitive and annoying experience, especially if the item description is long. (In my example above, the word “face” has been mapped to the broken clock. Imagine if the entire parts list was mapped to the clock.) None of these solutions really appeal to me.
I decided to see if I could build a solution that provides a little better experience without heavy management or intensive memory use. I’m not sure my solution is less memory intensive than creating objects. I also would not be surprised to be told that there is a plug-in that has a better solution. Still, it was a good exercise for me. Here’s what I settled on:[code]A thing has a list of text called parts-list. A thing has some text called part-response.
The part-response of a thing is usually “That’s part of the [the item described]. It’s not really important.”
The Junk Yard is a room.
[A deliberately verbose item description]
A broken clock is in the Yard. The description of the broken clock is “The clock looks like the gable end of an old shake shingled house. Just
under the peak of the roof, a small wooden cuckoo hangs through a tiny double-doored hatch and dangles from a stretched spring. One of the
hatch doors hangs loose on a single bent hinge. The once white clock face, now yellowed with age and spotted with rust, shows only a minute
hand bent as if pointing at [us]. The hour hand snapped off long ago. The worn but still legible numbers all remain, except the five, which
someone deliberately and completely scraped away.”
The parts-list of the clock is {“gable”, “shingle”, “house”, “door”, “hatch”, “peak”, “roof”, “cuckoo”, “spring”, “hinge”, “face”, “rust”, “hand”}.
Some faded numbers are part of the clock. The description of the faded numbers is “The numbers are faded and worn except the five. It has
been deliberately and completely scraped away. Since no rust has formed, [we] guess that the scraping was done recently.”
Understand “five” as the faded numbers when we have examined the clock.
[By checking the list of fiddly bits only when the parser has finally given up, I’m not overriding anything that might be a legitimate command.]
Rule for printing a parser error when the latest parser error is can’t see any such thing error and something is visible:
let R be “”;
repeat with temp-item running through visible things:
if we have examined the temp-item:
repeat with fiddly bit running through the parts-list of temp-item:
if the player’s command matches the text “[fiddly bit]”:
now R is “[part-response of temp-item]”;
break;
if R exactly matches the text “”:
break;
if R exactly matches the text “”:
now R is “[text of parser error internal rule response (E)]”; [Can’t see any such thing.]
say “[R][line break]”.[/code]I tested this in a few ways. The full code is attached. One test involves two visible items that have duplicate fiddly bits. For example, there might be a hand and face on a broken doll in the Junk Yard as well as a hand and face on the clock. This method just picks one. Visible things without a defined parts-list are ignored. Finally, if there is an actual visible object in scope having a name that matches one of the fiddly bits, the actual object automatically takes precedence.
This resulting dialog seems much more rewarding to me:
There are still problems with this approach. For example, attempting to examine Clark Gable or the almighty mountain peak will result in the system telling me that those things are part of the clock and aren’t important. Hey, it’s an amazing clock! That problem can be mitigated by doing an exact match instead of a containing match. The parts list just gets a little longer.
Another problem has to do with items with shared unimportant keywords. If the player tries to examine the doll’s face, he might be told that it is part of the clock and isn’t important. (If face is an actual object that is part of something, then the result is that the actual object gets examined.) I’m not exactly sure if that matters. It could lead to some frustrating attempts to get the system to tell me about the doll’s face, but I haven’t tried to solve that issue yet. I envision something simple like, “You see a face on several things. None of them are important. Keep moving.”
After playing with this code for quite some time, I noticed that a player might see that the cuckoo is wooden and try examining the wood. In this case, he would be told that he can’t see any such thing. I could put “wood” into the list of fiddly bits, but then I’m starting to get excessive. I’m realizing that no matter how hard I try, there will probably always be something I miss. There are always trade-offs, I guess.
Ultimately, it is probably important to balance descriptions with what is important to the play. I should ask myself if it is prudent to have all that description, or is it enough to be minimalist? For example: “It is an old broken cuckoo clock. The number five was deliberately and completely scraped off recently,” might be all that is needed in this case. Not every case can avoid it though. Even Zork describes a beautiful vista of mountains, but when you try to examine the mountains, you can’t see any such thing.
fiddly-bits.txt (4.01 KB)