-------------------------------------------------------------------------------
                               LOOKTRAPS HOWTO
-------------------------------------------------------------------------------
 
The MUCK 'look', 'lookat' and 'view' commands support looktraps.
 
A looktrap (called a "view" on MUSHes) is a detail of an object (room, player
or thing) which description is held in the "_details/" propdir of this object.
You can therefore define as many details as you want and these details will be
available for others to look at them.
 
'look' supports looktraps on rooms and, whenever you pass a name which doesn't
correspond to any object in that room, the 'look' command scans the "_details/"
propdir of that room, searching for a matching property name.
 
Let's give an example: you got your own room and want to put some furniture in
it. Of course, you could create as many objects as there are different pieces
of furniture in that room, but this would be rather tedious, and would consume
a lot of space, both in your room contents list and in the MUCK database. For
such a usage, where you don't need for an actual object to interact with (i.e.
when you don't need to carry, move, or use this object as a container), it is
more convenient to use a looktrap (sometimes called a "fake object"). Let's
design a table and some chairs, for example. First, the table:
    @set here=_details/table:You see a simple wooden table.
Let's look at the result, type: 'look table'
 
The chairs now... We want anyone looking at "chair", "chairs", "seats" or
"seat" seeing the chairs description. You can give more than one name to a
single looktrap, like this:
  @set here=_details/chairs;seats:Four chairs are arranged around the table.
Now, you can 'look seat', for example (and note that looktraps also support
partial name matching as we defined "seats" and looked at "seat")...
 
This was for rooms, but how about other objects ?  Well, following the exact
same principle 'lookat' takes care of checking for looktraps on objects when
there is no matching <thing> name in 'lookat <object>'s <thing>'. The match
for the looktrap is done against the <thing> name...
For a start, let's add some details about our nose:
  @set me=_details/nose;muzzle={name:this} got a cute little nose.
Now, if "John" is your character's name, anyone can look at your nose with
'lookat John's nose'. As you can guess, the MPI expression {name:this}
will be expanded into "John" (which is the name of the object on which the
property holding the MPI code is set). We can use this MPI evaluation feature
to make ourselves notified about who looks at what part of our anatomy:
  @set me=_details/nose;muzzle:{null:{notify:{name:me} looks at your nose,
  this}}{name:this} got a cute little nose.
The {null:} is there so that the one looking at your nose doesn't see the
notification message which {notify:{name:me} looks at your nose.,this} will
take care to send to you ("this"), {name:me} being expanded to the name of the
looker...
 
The latter example was for a player object, but you may as well define
looktraps on other objects, even if the 'lookat' syntax looks a little weird
(or at least grammatically wrong) when applied to inanimate objects... and here
the 'view' command comes into play !  This command has been ported on VR, as an
equivalent of the '+view' one on MUSHes (and by the way, on VR '+view' is also
a valid alias to 'view')... and has been extended in the process. It may
be used for three purposes:
 
First, you may use it to set default looktraps on your character, such as its
general aspect (short description), its apparent age, and its skin (or pelt),
eyes and hair aspect/colour. All those details are also used by the 'glance'
command. Example:
  view #aspect {null:{notify:++++ {name:me} glanced at you.,this}}Quite
               appetizing a boy !
  view #age 20
  view #eyes blue
  view #hair short blond
  view #skin white smooth
 
Second, you may use 'view' to view any detail set on any object, like this:
  view here=table  (or: 'view =table')
  view me=nose
  view Paul=hair
and in a more generic way:
  view some object=some detail
 
Finally, you may use 'view' to list all the details set on a given object, like
this:
  view here (or: 'view')
  view me
  view Paul
and in a more generic way:
  view some object
 
It is however sometimes better to keep the list of the available details
hidden. For example, you might want your visitors to guess the names of some
interesting details to look at, thanks to hints you'd put in the description
of your room or object... In this case, you may set a flag so that 'view' won't
give away the list of the available details. Example:
  view #hide here
  view #hide me
and in a more generic way:
  view #hide <my object>
 
More help on looktraps: see also 'look #help' and 'view #help'.

Back to the main page.