I have an important object that starts out isHidden … the player has to actually examine the place where it’s sitting in order for it to show up. But of course, a player may have played the game before, and may try to grab the thing without troubling to examine the place where it’s sitting. It would be rather confusing and annoying to have the parser claim there’s no such object in the room, when there is. Consequently, I’ve added an Unthing to the location, whose notImportantMsg is rather snarky but at least not misleading. ("Key? Is there a key around here somewhere? ")
The difficulty I’ve stumbled onto is this: In the course of testing, I will often need to purloin this object. (Okay, it’s a key.) And I can’t, because the parser prefers the more apparent Unthing rather than the isHidden key.
What I probably need to do is two things: First, when hidden things are purloined, they have to automatically become not hidden. Second, the purloin command has to ignore Unthings. I’m not sure how to hack the library so as to accomplish either of these things. I’ll give it a shot, but suggestions would be welcome.
BTW, this is the kind of information that would be dandy to add to the wiki, if anybody was using it. I’m not sure I remember how to log onto the wiki, though…
On further investigation, it appears the problem is not that the Unthing is preferred by the parser – if I comment it out, the Purloin action still doesn’t work – but that an item that isHidden is never considered by the Purloin action. The makeScopeUniversal() method of TAction doesn’t seem to have an exception for isHidden items – they should be added to scope. And the code for dobjFor(Purloin) doesn’t object to things that are hidden.
It appears that the offending method is Mentionable.matchNameCommon(). This begins, “if (isHidden) return 0;”. That would be a deal-killer, all right. The difficulty I now face is this: At the time when matchNameCommon is called, it appears that the action has not yet been resolved. gActionIs doesn’t know what’s going on. So if I attempt this in an #ifdef __DEBUG modify Mentionable block, it doesn’t work:
if(isHidden && !gActionIs(Purloin))
return 0;
I certainly don’t want to mess with matchNameCommon across the board! I want it to run as usual, except when the action is Purloin. But how can I do that when the action is not yet resolved?
Or am I misunderstanding the situation in some way? (That wouldn’t be unusual.)