Advanced Object Topics

Return to Object Page

This map demonstrates at least one of every relationship an object might have to other objects.  The Void contains Room and Some Thing.  Room is attached to Another Room. (Note: Another Room might not be considered present within The Void, since it is held by Room)  Within Room, A Comfy Chair and MOOSE are present.  MOOSE is holding (attached to) Held Object.  MOOSE contains (possesses) one and two.

From MOOSE's perspective, one, two, Held Object, Comfy Chair, Another Room, and Room are all visible.  MOOSE could /ENTER Another Room and Comfy Chair.  MOOSE could /LEAVE and be in The Void.  If MOOSE were given a command, which was a macro name, it would check first its own macros, then the macros of Room.  Regardless of where the macro is found, the variables used are ALWAYS contained within the active object.

There will come a time when more than one object of the same name will be visible.  When there are more than one objects of the same name 1.object, 2.object, n.object, can be used to select objects other than the first.  Objects are checked for presence first in the contents of self, then held objects, and finally then objects in the same room.  Many commands check only these, the set of 'grabbable' objects.  Some commands will additionally check objects attached to the current room, and then the room the object is in.  A DESTROY command will then check macros on the current object for a match.

When a macro is defined it is stored in the current object.  When a command is entered to invoke a macro, the current object is checked first, if the macro is not found, the object containing the current is checked.  This allows macros for 'rooms' to be defined, so any object within it may use the macro.  Only these two levels are checked.  An object does not have to be aware to have a macro defined for it; /macro [IN [object]] [name] [parameters...] will define a macro in the specified object, if the object is visible.

When a variable is declared, the variable is stored in the object.  If the variable is declared within a macro, the variable is stored in the current macro state.  A variable can be defined in any visible object using '/declare in [object] [varname] [value...]'.  If the object specified is visible, this command will succeed.  When a macro references a variable, first the parameters to the macro are checked, then the macros defined in the current macro state, and finally the variables defined for the object.  If the variable is found in the object's variable space, subsequent declares will modify that value, not create a new one in the macro state.

Return to Object Page