@lock foo = bar
will let you pass either if you carry bar or are bar.
Special locks behave differently as described below. Each one has a special "symbol" (such as "+" for carry) to distinguish it from a normal lock.
There are six types of special locks:
These are described below...
| Lock type | Symbol | Meaning |
|---|---|---|
| Indirect locks | @ | Locks an object to the lock of the specified object. Good if you
have many locks with the same key, simply lock all the locks to one object,
then lock that object to the common key.
Example:
locks foo to bar's key. |
| Carry lock | + | You can go though only if you carry foo.
Example:
|
| Is lock | = | You can only go through if you are foo.
Example:
The last two are different from @lock foo = bar in that @lock foo=bar will let you pass either if you carry bar or are bar. |
| Owner lock | $ | You can only go through if you have the same owner as foo.
Example:
|
| Attribute lock | attr : | You can only go through if you have an attribute set on yourself
which matches the value of the attribute lock.
The value is a string which may contain wildcards, greater than, and less than. The locked object must be able to read the attribute from the thing trying to pass the lock; if it cannot do so, the thing cannot pass the lock. (So, mortals can generally only usefully lock to public attributes like 'sex', or to attributes on their own objects). All attribute locks take the format @lock thing=attribute:value Example:
will lock thing to anyone whose sex attribute starts with an 'm'.
will lock the exit to anyone who has 5 or less in the attribute "elephants". |
| Evaluation locks | eval / | These locks take the form @lock thing=attribute/value They are
thus very similar in form to attribute locks. These locks are checked by
evaluating the contents of <attribute> and comparing it to <value>;
a lock is passed if these are equal.
<Attribute> may be thought of much like a user-defined function; its contents are evaluated with the equivalent of EVAL(thing, attribute) For the purposes of evaluation, the player trying to pass the lock on thing is the enactor (%N) and the thing is "me" (%!) Example:
This locks thing to puppets only. If player tries to pass the lock on thing, Ispuppet evaluates to: [hasflag(<player dbref>, PUPPET)] and the function returns 0 or 1 depending on whether or not player is a puppet. The lock is passed if the evaluation equals "1". Evaluation locks are extremely flexible; you can even use them to imitate other types of locks. For example, instead of @lock object = #5 you can use @lock object = VA/#5 and @va object = %# (This is somewhat foolish, but you can do it if you want to.) These locks are evaluated with the privileges of the locked object; thus, if you @lock object = VA/5 and @va object = [strlen(get(%#/VZ))] and the object does not have permission to read VZ from the player trying to pass the lock, the player automatically fails to pass the lock. |
Comments to Gammon Software support
Page updated on Wednesday, 15 December 2004