prev | toc | next

2.2.2 Looktraps

'Looktraps' are details or `fake objects' in a room. For example, rather than creating a `Sign' object with instructions on how to use some local commands and placing it in a room, you could mention the sign in the room's desc and create it as a looktrap. There will be no separated dbref'd object named `Sign', but players will still be able to do look sign and see it. The primary value of looktraps is efficiency: because no separate object is created, overall database size is somewhat smaller, and commands that must search the database have one fewer objects to examine. And, if your MUCK uses a quota system, there will be one fewer object counting against your quota.

Looktraps are stored as properties in the _details/ directory. Names of looktraps follow the aliasing conventions of exits: strings delimited by ; semicolons serve as alias names.

> @set here = _details/sign;plaque;notice:To see who lives here,
  type `look mailboxes'. To get a home here, type `claim #',
  using an unclaimed home number for `#'.
  Property set.

> l plaque
  To see who lives here, type `look mailboxes'. To get a home here,
  type `claim #', using an unclaimed home number for `#'.

Looktraps are automatically parsed for MPI.

This looktrap puts the sign text in a list, allowing better control over formatting...
> @set here = _details/sign;plaque;notice:{list:signtext}
  Property set.
> lsedit here = signtext
  <    Welcome to the list editor. You can get help by entering `.h'     >
  < `.end' will exit and save the list. `.abort' will abort any changes. >
  <    To save changes to the list, and continue editing, use `.save'    >
  < Insert at line 1 >
> ... text text text ...
> ... blah blah blah ...
> ... etc etc etc ...
  < Editor exited. >
  < list saved. >

This looktrap creates a `delayed effect'. Players get a little message seven seconds after they look at the portrait.
> @set here=_details/painting;picture;portrait:A somber portrait in
  oils, depicting Baron Von Hoofenstaffen, former owner of this
  mansion:{null:{delay:7,{lit:{null:{tell:You're not quite sure: it
  seems, perhaps, that the eyes of the portrait are following your

Note: Many MUCKs have soft-coded `look' commands that handle setting and removing looktraps, with syntaxes such as look #add <detail> = <desc>. Type look #help to determine if such a system is available on your MUCK.

prev | toc | top | next