2.1.4 Triggering From Properties
In most cases, programs and server operations are triggered (i.e.
caused to run or execute) by typing a command. However, they can also be
triggered from a number of protected properties: all message props
(_/de, _/sc , etc.), plus _connect, _oconnect,
_disconnect, _odisconnect, _arrive, _oarrive, _depart, _odepart ,
and _listen .
Performing any of the actions implied by these property names sends
information to the server and (if the property is set correctly) causes
messages to be displayed, an MPI string to be parsed, or a
program to run. For example, if you set a _connect prop on
your character to trigger a certain program, the program will run each
time you connect; if you put an MPI string in your
_/de prop, it will be parsed each time someone looks at
you. The server searches up the environment tree (see Section 2.2) for triggering props. For example,
if _connect prop that triggers a program is set on your
character, the program will run each time you connect. If it's set on a
room, the program will run each time someone connects in that room. If
it's set on the global parent room (#0 ), the program will
run each time someone connects anywhere on the MUCK.
The manner in which the props are set differs depending on which prop
it is (the _/ directory is handled differently than the
others, such a _connect or _listen ) and on
what the intended result is (messages are handled differently than MPI,
which is handled differently than program calls).
To cause a message to be displayed by a _/ prop
(_/de, _/sc , etc), simply set the message as a string, with
@set or the specific server command. @o-
messages such as @osucc, @ofail , and @odrop
are prepended with the name of the triggering player (or other object
type).
====================================
> @desc out=A simple wooden door.
Message set.
> look out
A simple wooden door.
> @succ out=You decide to go outside for a bit...
Message set.
> out
You decide to go outsides for a bit...
> @set out=_/sc:You head outside.
Property set.
> out
You head outside.
====================================
MPI strings in _/ props will be parsed automatically.
====================================
> @desc watch=You glance at your watch. The time is {time}.
look watch
You glance at your watch. The time is 01:44:31.
====================================
To trigger a MUF program from a _/ prop,
preceed the dbref of the program with an @ at-mark. For
example, let's assume the dbref of the `Obvious Exits' program is
#123 :
====================================
> @succ here=@#123
Message set.
> look here
Messy Room(#545RJ)
Boy, this place is a mess!
Obvious Exits:
Out <O>
====================================
The other triggering props (_arrive, _oconnect , etc) are
handled slightly differently. Simple strings cause no result,
MPI must be preceeded with an & ampersand in
order to be parsed, and MUF programs can be called with
just a string indicating the dbref.
====================================
> @set me=_connect:555
Property set.
> @set me=_arrive:&{null:{otell:waltzes in.}}
Property set.
====================================
These triggers can be set up as a propdir rather than a single prop,
in order to trigger multiple results from the same action. For example,
the following settings would trigger both programs #581 and
#555 each time someone connects in the room. The propdirs
are evaluated in alphabetical order, so #581 would execute
first. (Other than determining alphabetical order, the prop names
following the first / slash mark have no effect: they can
be whatever you like.)
====================================
> @set here=_connect/desc-check:#581
Property set.
> @set here=_connect/my-wwf:#555
Property set.
====================================
The _listen is triggered by any activity. As
such, it is both very useful and very easily abused. Permissions
safeguards are coded into the server for _listen: the only
result that can be triggered is execution of a program; the program must
be set Link_OK and have a Mucker level equal to or higher
than a level set by the MUCK administrators. Usually this
parameter is set to 3 or 4 (M4 is
`wizard'). `Bot programs and automatic `noise' or `event' programs are
common examples. The prop is set simply by putting the dbref of the
program to run in the property value.
====================================
> @find noises
noises.muf(#812FLM3)
***End of List***
1 objects found.
> @set here=_listen/noise:812
Property set.
====================================
prev |
toc |
top |
next
|