Can’t do that; the desk drawer object is a one-stop-shopping item. The desk is described as having a center drawer and drawers down both sides. The drawer object is a Decoration that reacts to any attempt to do anything with any or all of these desk drawers, so “examine drawers” while in the living room is a valid command that should display the drawer object’s notImportantMsg.
Yes, you are correct.
And not likely to under current circumstances.
For whatever unknown reason—whim of the IF gods? something I tried (if so, now forgotten) while fiddling around looking for a fix to the real problem at hand? don’t know—that text no longer appears when I set a break point.
I thought somewhat similar thoughts when I wrote it. I was expecting “The drawer is closed” but I got the drawer’s desc text instead. I understand, that’s working correctly, but it isn’t what I want or need so I started looking for a way to get the results I need, which is what led me to putting the text in check(). (I get that you don’t see the need for putting it in check()—and the fact that you wrote the library adds considerable weight to your opinion—but why is it not advisable? Other than not being proper form, what’s the downside?)
But now, well, hmmm, your example is different than mine. You’ve defined it as Component, OpenableContainer.
I defined each drawer as type DresserDrawer, which I subclassed from Container, for which I set isOpenable = true and isOpen = nil. Does using OpenableContainer do anything more for me than make the container openable? Aren’t the two approaches functionally equivalent?
As for the description of contents, I need the it to be part of the desc text for each drawer, such as…
bottomDrawer: DresserDrawer 'bottom drawer'
"The drawer contains more socks than you've ever seen in one place outside
of a department store. <.p>"
You can take as many socks out of the drawer as you want, but there is in fact only one pair of socks.
The socks object gets regenerated in code each time you take a pair out of the drawer (you can only have one pair at a time, but you can go through the process of take-dispose-take-dispose-take-dispose indefinitely).
Maybe you’re right, a conditional description for each of the drawers is the way to go, but I have to tell you, the solution I currently have in place—a Doer —is working pretty well…
[code]Doer ‘examine Thing’
where = nextRoom
execAction(curCmd)
{
if(!gDobj.isOpen && gDobj.ofKind(DresserDrawer))
{
switch(gDobj.name)
{
case ‘top drawer’:
“The face of the <<gDobj.name>> is plain, unadorned except for a
single brushed metal pull in the center. <.p>”;
break;
case ‘middle drawer’:
“A simple pull protrudes from the center of the otherwise plain
middle drawer face.<.p>”;
break;
case ‘bottom drawer’:
“As with the top and middle drawers, the bottom drawer is a
simple smooth face unbroken by adornment other than a simple
brushed-metal pull. <.p>”;
break;
}
}
else if(gDobj != livingRoomDeskDrawers)
inherited(curCmd);
}
;[/code]
One thing I like about this approach is the grouping of drawer descriptions in one easy-to-edit place, rather than having to scroll through each drawer object in the code.
Jerry