POO Directories

Introduction to Directories

POOs (like MOOs) tend to generate a large number of useful (or at least interesting) objects which you may frequently want to refer to, even when they are not in your immediate context. It is convenient to group such objects into a logical hierarchy, much like a file system. Thus, you could group all public objects under "pub", and further divide this into rooms, for example. A particular type of room (e.g., exitLister) is then referred to as $pub.rooms.exitLister.

There are two ways to accomplish such hierarchies. One is to simply set properties on the grouping object which refer to the individuals in the group. This is how $usr works; $usr is a simple POO object which has one property for each user in the server. $usr.Tim is a property on this object, which refers to the Tim object.

Another way to do it is to use Directory objects. These are a special type of POO object, which makes anything in its contents act like a property. $pub and $sys are Directory objects. Anything dropped inside one of these objects instantly shows up on that object's property list, as if it were a built-in property. Directory objects are extremely handy, because they provide both a place to store objects, and a convenient way to refer to them.

Examining Directories

In the core database, the @ex command shows you all properties on an object. The @dir command is very similar, but it shows you only those properties which refer to other objects. This is the command you'll most commonly use when working with directories (or pseudodirectories like $usr.) Try out the following commands:

Creating Directories

The core database contains a $dir reference to the standard directory object. You can create your own directory with the usual @create command (e.g., @create $dir as stuff).

Next, drop your directory in a safe place, such as your home room. You might want to make it immobile (@set stuff.immobile = 1) so somebody doesn't walk off with it.

So that you can always reference your directory, no matter where it is, set a property on yourself that points to it (@set me.stuff = stuff will do the trick). Now, if your directory is not in the room or your inventory, you can refer to it as me.stuff. Moreover, as long as your stuff property is readable, others can refer to it as $usr.yourname.stuff.

Finally, you'll want to put some stuff in your stuff directory. This is simple: when you're in the same room as a directory called "stuff", you simply type enter stuff to enter that directory. You will be moved inside the directory object, much like entering a room. (Don't worry, directories are a lot bigger on the inside than they are on the outside!) Now, anything you drop inside the directory will act like it's a property of that directory. While in a directory, "look" is almost equivalent to "@dir here". If there are subdirectories in the room, you can enter them the same way. To leave the directory, type up. This will move you to the object containing the directory (which should be either another directory, or a room). Note: you can't enter a directory which you are carrying; you must drop it first.

That's it! Now, if you have a widget in your stuff directory, then no matter where you go, you can refer to me.stuff.widget, in exactly the same way you might refer to $pub.misc.clock or whatever.


Directories are a powerful feature for organizing objects, which arise very naturally from POO and Python property syntax. As a builder, you need to understand them at least enough to locate and make use of the public directories. And as you acquire a collection of useful objects, you may find it convenient to organize your own gadgets and gizmos in a directory hierarchy as well.

Last Updated: 2/24/97 . . . . . . Joe Strout