container
container
is an attribute given to objects for
which commands such as >LOOK INSIDE <object> or
>PUT THING IN <object> work. Without the container
attribute,
these commands would get a “You can’t do that.” response.
Other things to keep in mind:
- If it’s a working container (objects can actually be placed in it), it should also have holding and capacity properties (these are used by Acquire to verify the container has room for more objects).
- Containers may also have open, openable, locked, transparent, or lockable attributes, depending.
- If the object’s contents shouldn’t show up in a room listing (or when you look at it), it should also have the quiet attribute.
- If you want the object’s contents to only show up when the player looks in it, use list_contents.
- If the container object can also have objects placed on top of it (like a desk), check out the supercontainer class.
Hugo Homework
People occasionally run into problems while coding windows (the
part-of-a-building kind), as they don’t give the window object the
container
attribute and then wonder why >LOOK IN WINDOW doesn’t
work. Of course, this can be dealt with by added new
grammar, but for our purposes, code a
container
-attribute-having window object that has adequate responses
to “traditional” container commands like >PUT THING IN WINDOW.