Locks are a very important part of MUSH building - they help give the world its "flavour", by enforcing rules and conditions.
Basically you could define a lock thus:
@lock east = sex:m*
This only allows "male" character to use the "east" exit.
@lock mirror = #0
This prevents anyone from taking the mirror.
@lock here = Iswizard/1
&Iswizard here = [hasflag(%#, WIZARD)]
@succ here = You notice a secret exit behind the fireplace.
This would show a description about a secret exit to wizards only.
You should generally set a "success" and "failure" message on any object which is locked, so that the player attempting to pass the lock sees an explanatory message. For example:
@lock east = +key
@succ east = You unlock the door and go through it.
@fail east = You must be carrying the key to go through this door.
You should also set "other success" and "other failure" messages on a locked object, so that others in the same room see what is happening to the player.
@osucc east = unlocks the door and passes through.
@ofail east = tugs uselessly at the door.
These messages are covered in more detail in a subsequent page.
Click on Lock Messages for more details about messages that are triggered by attempting to use locked objects.
@lock[/<switch>] <object>=<key>
Locks <object> to a specific key(s). <object> can be specified as <name>
or #<number>, or as 'me' or 'here'. Boolean expressions are allowed, using
'&' (and), '|' (or), '!' (not), and parentheses ('(' and ')') for grouping.
To lock to a player, prefix their name with '*' (ex. '*Moonchilde').
Example:
@lock Purse = me|*Darling
will lock object purse so that only you or player Darling can take it.
Comments to Gammon Software support
Page updated on Wednesday, 15 December 2004