Manual:DIL Manual/key
Jump to navigation
Jump to search
Contents
key
Field (string, read/write; units: all, used on objects).
u.key : string
The key that locks and unlocks the unit, as "keyname@zone", set with key in the zone file. Empty when the unit has no key. The lock and unlock commands in basemove.zon look for a unit with this symbolic name in the player's inventory.
A room's exits have keys of their own: see exit_key.
Notes
- Assigning a string replaces the key; assigning
""or null leaves the unit without one. - Whether the unit can be locked at all is in openflags (
EX_OPEN_CLOSE,EX_LOCKED). - On null it fails.
Example
dilbegin integer has_key(pc : unitptr, item : unitptr);
var
k : unitptr;
code
{
if (item.key == "")
return (FALSE);
k := findsymbolic(pc, item.key, FIND_UNIT_IN_ME);
return (k != null);
}
dilend
Tells whether a player carries the key to an item, as lock and unlock do in basemove.zon.