@lock keys

From TinyMUX
(Redirected from Key)
Jump to navigation Jump to search

You may use the following keys when setting locks.

Normal

Key: <object>

You pass a normal lock if you either are the named object or if you carry the named object. <object> may be the name or dbref of an object, a playername prefixed by an asterisk (*<playername>), 'me', or 'here'.

Examples:

> @lock treasure room = secret key
> @lock private area = me

Is

Key: =<object>

You pass an is lock only if you are the named object.

Example:

> @lock mystical highway = =magic bus
Only the magic bus may travel down the mystical highway. You cannot travel the highway if you are carrying the bus.

Carry

Key: +<object>

You pass a carry lock if you are carrying the named object.

Example:

> @lock secret passage = +magic bus
You can only traverse the secret passage if you are carrying the magic bus. The bus cannot enter the passage on its own (perhaps when you are driving it).

Ownership

Key: $<object>

You pass an ownership lock if you have the same owner as <object>.

Examples:

> @lock mystuff=$me
Only objects you own may use the mystuff exit.
> @lock/page me = !$*TinyJerk
Neither TinyJerk nor any of his objects may page you.

Indirect

Key: @<object>

You may reference the lock on another object and use the result of evaluating that other object's lock. You pass an indirect lock if you pass the default lock on <object>. This is especially useful if you have a large number of things or exits that want to have the same lock, and you want to be able to update one object and have all the other locks change at the same time.

<object> is searched for when you enter the @lock command and its database number is stored in the lock, so something like '@Lock north=@master.lock' is safe even if you are going to move master.lock to another location.

Examples:

> @lock master.lock = me
> @lock north = @master.lock
> @lock south = @master.lock
North and south all reference the lock on master.lock, so you may change the lock on all three exits by changing master.lock.

PennMUSH permits indirect locks to a different lock on another object with the key syntax @<object>/<locktype>

Attribute

Key: <attribute>:<pattern>

+<attribute>:<wildcard-pattern>
=<attribute>:<wildcard-pattern>

You may lock on whether a specific attribute on the player attempting to pass the lock matches a pattern. Example: '@lock thing=sex:m*' will lock thing to anyone whose sex starts with an M. Wildcards, greater than and less than may be used, for example: '@lock a-f=name:<g' will lock the exit a-f against any one whose name is higher than f.

In TinyMUX, both the player testing the lock and every object in his inventory is checked, the player passes the lock if any of those objects passes the lock. If the attribute name is prefixed by a = then only the player is checked. Similarly, if the attribute name is prefixed by a + then only objects in the player's inventory are tested.

Note: you may lock against any attribute, but the locked object must be able to read the attribute from the player attempting to pass the lock or the lock will fail.

Examples:

> @lock men's room=sex:m*
> @lock a-f=name:<g
> @lock post office=email:*@*

On PennMUSH you can't use name in this way, as it would try to read an attribute called 'name', not the player's name.

Evaluation

Key: <attribute>/<value>

Evaluation locks let you evaluate one of your attributes and compare the result against a value stored in the lock. The result must be an exact match (no wildcarding allowed, but uppercase and lowercase are considered to be the same). When evaluating the attribute the enactor substitutions (%#/%n/etc) are replaced with information about the player trying to pass the lock, and 'me' and %! refer to the locked object or exit.

If you call an indirect lock and the indirect lock is an evaluation lock (or is a compound lock that includes an evaluation lock), then the original lock object is checked for the attribute first, followed by the object that has the actual evaluation lock. If there are multiple levels of indirection the intermediate locks are not checked.

Examples:

> @lock bank=checkmoney/1
> &checkmoney bank=[gt(money(%#),5000)]
Only people and objects with more than 5000 pennies may pass.
Note: this lock requires wizard privileges to read the worth of other players.
> @lock divisible_by_five_club = checkdiv/0
> &checkdiv divisible_by_five_club = [mod(mid(%#,2,20),5)]
Only objects whose dbref is divisible by 5 may pass.

Compound

Key: <key> & <key>

<key> | <key>
!<key>
( <key> )

You can make complex locks by combining keys with the logical AND and OR operators (& and ! respectively), or by using the NOT operator. You may also group complex locks with parentheses.

Examples:

> @lock exit = me & !me
An impossible lock, nothing can be both you and not you.
> @lock message = me | *recipient
Both you and the player recipient may get the message.

Property Locks

Key: flag^<flag>

type^<type>
power^<power>
channel^<channel>
objid^<object id>

PennMUSH supports keys based on several properties of an object, including whether it is of a given type, has a given flag or power, is a member of a given channel, or has a particular objid.

See also

See also: @lock, @unlock.

Relevant help files: help @lock ownership, help @lock carry, help @lock, help @lock keys, help @lock normal, help @lock is, help @lock evaluation, help @lock attribute2, help @lock indirect, help @lock compound, help @lock evaluation2, help @lock attribute.