prev| toc| next
 

2.3 Overview: Exits and Locks

An `exit' is a link between two objects on a MUCK. When the two objects are rooms, the exit creates a virtual `door' between them. When the destination is a program, the exit serves as a user-created command. Other combinations are possible. Exits are also called `actions'. Use of exits (as well as objects of other types) is controlled by `locks': an expression that evaluates as either `true' (in which case the exit/object can be used) or `false' (in which case it cannot). An exit is characterized by having a starting point (an object to which it is `attached') and a destination point (an object to which it is `linked').

Exits

Exits are created with either the @open or @action command. Both create an exit (an object with type flag E), but the syntax and defaults are slightly different.

The basic syntax of the @open command is @open <exit name>. An exit created in this way will be attached to (i.e., start from) the room in which one issues the command, and it will not be linked to anything (it won't lead anywhere). The exit can be linked to another object on the MUCK with the @link command, syntax @link <exit name> = <destination>. Since the destination will usually be somewhere else on the MUCK, it will need to be specified by dbref rather than name.

Hooking up an exit in two steps...
====================================
> @open out
  Exit opened with number #1766.
> @find hallway
  Ansley Inn, Hallway(#198R)
  1 objects found.
  ***End of List***
> @link out = #98
  Linked to Ansley Inn, Hallway(#98R)
====================================

Hooking up an exit in one step...
====================================
> @open out = #98
  Exit opened with #1766.
  Linked to Ansley Inn, Hallway(#198R)
====================================

An exit does not have to be attached to a room, however: an exit can be attached to anything except a program or another exit. The @action command (abbreviated as @act) creates an action/exit attached to an object specified at the time of creation:

====================================
> @act myplace = me
  Action created with number #1236 and attached.
> @link myplace = #1234
  Linked to Cashmere's Den(#1234).
====================================

Many MUCKs have a soft-coded @action command, that allows you to specify both the source and destination at the time of the exit's creation:

====================================
> @act myplace = me,#1234
  Action created with number #1236 and attached.
  Trying to link...
  Linked ot Cashmere's Den(#1234)
====================================

The attachments and links of exits can be changed. To relink an exit, issue the @unlink command and then @link the exit to the new destination.

====================================
> @unlink myplace
  Unlinked.
> @link myplace = #1768
  Linked to Cashmere's Bachelor Pad(#5784R).
====================================

To change an exit's point of attachment, use the @attach command, syntax @attach <exit> = <new attachment point>

====================================
> @attach refrigerator = here
  Action re-attached.
====================================

(Obvious-exit programs generally list exits in the order of first-attached to last-attached, or the reverse. Therefore, the order in which exits appear on the list can be changed by using @attach to re-attach exits to the room: the exit will then become the last-attached exit, and move to either the first or last position in the list.)

To reiterate, exits have a source (the object to which they are attached) and a destination (the object to which they are linked). This means that they are one way. This point often causes confusion for new builders: in order to create a `door' between two rooms, one needs to create two exits, one leading in each direction. The following example illustrates this: Cashmere's Bachelor Pad has dbref #5784. From the Bachelor Pad, he will create a Bedroom, and then create two exits that make a door between the Pad and the Bedroom.

====================================
> @dig Cashmere's Bedroom
  Cashmere's Bedroom created with #5792.
  Parent set to BD's Environment Room(#4989RA).
> @open Bedroom = #5792
  Exit opened with number #5793.
> bedroom
  Cashmere's Bedroom(#5792)
> @open Out = #5784
  Exit opened with number #5784.
  Linked to Cashmere's Bachelor Pad(#5784R).
====================================

Exits linked to things move the the thing to the point of attachment when used (rather than moving the user to the thing).

====================================
> @act getpup = me
  Action created with number #4684 and attached.
> @link getpup = $pup
  Linked to Squiggy(#128629XZ).
> getpup
  done
> i
  You are carrying:
  Squiggy(#128629XZ)
  You have 10664 wet cats.
====================================

Exits' names can include `aliases', other names that can be used as the exit name. An existing exit can be renamed to include aliases with the @name command, or the aliases can be specified at the time of the exit's creation.

Renaming an existing exit...
====================================
> @name bedroom = Bedroom <B>;bedroom;bed;b
  Name set.
====================================

Creating an exit with aliases...
====================================
> @open Out <O>;out;ou;o
  Exit opened with number #5785.
====================================

Each string separated by a ; semi-colon is an alias for the exit. In the `out' example above, typing either out <o>, out, ou, or o would cause the player to use the out exit. Only the first name or alias is shown a list of obvious exits. The above examples follow the common and useful convention of supplying a `full' exit name along with a simple abbreviation in the first alias.

====================================
> look
  Cashmere's Bachelor Pad(#5784R)
  Obvious Exits:
        Bedroom <B>      Out <O>
====================================

prev| toc| top| next