Standard actions which change the state of things
locking it withunlocking it withswitching onswitching offopeningclosingwearingtaking off
Locking something with something (past tense locked it with): applying to one thing and one carried thing
Locking is the act of using an object such as a key to ensure that something such as a door or container cannot be opened unless first unlocked. (Only closed things can be locked.)
Locking can be performed on any kind of thing which provides the either/or properties lockable, locked, openable and open. The 'can't lock without a lock rule' tests to see if the noun both provides the lockable property, and if it is in fact lockable: it is then assumed that the other properties can safely be checked. In the Standard Rules, the container and door kinds both satisfy these requirements.
We can create a new kind on which opening, closing, locking and unlocking will work thus: 'A briefcase is a kind of thing. A briefcase can be openable. A briefcase can be open. A briefcase can be lockable. A briefcase can be locked. A briefcase is usually openable, lockable, open and unlocked.'
Inform checks whether the key fits using the 'can't lock without the correct key rule'. To satisfy this, the actor must be directly holding the second noun, and it must be the current value of the 'matching key' property for the noun. (This property is seldom referred to directly because it is automatically set by assertions like 'The silver key unlocks the wicket gate.')
The Standard Rules provide locking and unlocking actions at a fairly basic level: they can be much enhanced using the extension Locksmith by Emily Short, which is included with all distributions of Inform.
Typed commands leading to this action
"lock [something] with [something preferably held]" - locking it with
Rules controlling this action
check an actor locking something with can't lock without a lock rule name unlist
check an actor locking something with can't lock what's already locked rule name unlist
check an actor locking something with can't lock what's open rule name unlist
check an actor locking something with can't lock without the correct key rule name unlist
carry out an actor locking something with standard locking rule name unlist
report an actor locking something with standard report locking rule name unlist