From Elendor
@lock[/<switch>] <object>=<key>
This command "locks" the object, specifying (by the key) who or what can
do certain things with the object. There are many different types of locks,
all of which are described in "help locktypes" and which are designated by
the switch. The "basic" lock determines, for players and objects, who can
pick them up. For exits, it determines who can go through the exit.
All other locks can be set the same way as the basic lock.
Whenever you "pass" the basic lock, you succeed in doing something with
the object. This triggers the @success/@osuccess/@asuccess
messages and actions. If you fail to pass the basic lock, you trigger
the @failure/@ofailure/@afailure messages and actions. Other locktypes
may also have such success/failure messages.
You can specify <object> and <key> as either the name of an object in
the immediate area, a DBREF number, "me", or "here".
Basic Locks
You can lock an object in several different ways. The simplest lock is to
lock it to one other thing:
@lock My Toy = = me
This locks the object "My Toy" to you and you alone. It is recommended
that you @lock me == me in order to prevent anyone else from picking
you up. The two = signs are NOT a typo!
You can lock an object -against- one other object as well, using the '!'
symbol:
@lock Shared Toy = !Vector Sigma
This locks the object "Shared Toy" to everyone -except- Vector Sigma.
Everyone except Vector will be able to pick up the object.
You can lock an object to something that has to be carried:
@lock Door = +Secret Door Key
This locks the exit "Door" to someone carrying the object "Secret Door
Key". Anyone carrying that object will be able to go through the exit.
You can lock an object to -either- an object or to someone carrying the
object with:
@lock Disneyworld Entrance = Child
This locks the exit "Disneyworld Entrance" to either the object
"Child" -or- to someone carrying the object "Child". (OK, so it's
a weird example.)
You can lock an object to a specific player by using a *:
@lock Note == *Jazz
Only the player "Jazz" will be able to pick up the Note object.
An "owner" lock allows you to lock something to anything owned by the
same player:
@lock Box = $My Toy
This locks "Box" to anything owned by the owner of "My Toy" (since
players own themselves, that includes the owner as well).
An "indirect" lock allows you to lock something to the same thing as
another object:
@lock Second Puppet = @First Puppet
This locks the object "Second Puppet" to whatever the object
"First Puppet" is locked to.
Elendor Change: Normally @lock/type A=@B sets A's "type" lock to call
B's "type" lock. You can specify a different "type" on B with
@lock/atype A=@B/btype. This sets A's "atype" lock to call B's "btype"
lock.
There are also some more complex locks called attribute and evaluation
locks. In addition, you can make complex locks (combining several types
or reversing them).
Attribute Locks
You can lock an object to an attribute on the person trying to pass
the lock (as long as the object can "see" that attribute):
@lock <object>=<attribute>:<value>
<value> can contain wildcards (*), greater than (>) or less than (<)
symbols.
For example:
@lock Men's Room = sex:m*
This would lock the exit "Men's Room" to anyone with a SEX attribute
starting with the letter "m".
@lock A-H = name:>g
This would lock the exit "A-H" to anyone with a NAME starting with a
letter "less than" the letter "g".
Complex Locks
You can combine or reverse locks very easily using the following
BOOLEAN symbols and parentheses () to group them:
& - "and"
| - "or"
For example:
@lock My Toy = =me | !*Chromia | +Toy Box Key
This locks "My Toy" to me, -against- the player Chromia, or to anyone
carrying the object "Toy Box Key".
@lock My Toy = *Marissa & +Toy Box Key
This locks "My Toy" to the player Marissa, who needs to be carrying
the object "Toy Box Key".
@lock My Toy= *Chromia | ( *Marissa & +Toy Box Key )
This locks it to Chromia, OR to Marissa if she is carrying the Key.
Evaluation Locks
An evaluation lock is set using this format:
@lock <object>=<attribute>/<value>
The difference between this and an attribute lock is that the <attribute>
is taken from <object> rather than from the person trying to pass the
lock. When someone tries, <attribute> is evaluated, and the result is
compared to <value>. If it matches, then the person passes the lock.
The person trying to pass the lock is %# and <object> is %! when the
evaluation takes place. The evaluation is done with the powers of
<object>. If you try to do something (like [get(%#/<attribute>)]) and
<object> doesn't have permission to do that, the person will automatically
fail to pass the lock.
Example:
@lock Stage = ispuppet/1
&ispuppet thing = hasflag(%#, PUPPET)
This locks the object "Stage" to puppets only.
Whenever someone tries to pick up the object, the attribute
"ispuppet" will be checked, substituting in the person's DBREF number
for %#.
[hasflag(<dbref>, PUPPET)] will come out to 1 if the object with
<dbref> has the "PUPPET" flag. Otherwise, it will come out to be 0.
Since the value in the @lock is 1, only objects with the PUPPET flag
will be able to pass this lock.
See also: locktypes