Sharpee
Chord / Cookbook / Containers & Locks / locking and unlocking

locking and unlocking, with a key

lockable with the <key entity> declares the key contract in one line, and forward references are legal. Keyless LOCK on a keyed lock asks for the key; the wrong key refuses; lock state then gates opening. (A Chord lockable starts unlocked, and this strongbox declares starts open; the transcript locks the box itself first, though a story could seed the state instead with starts locked.)

The author writes:

create the Strong Room
  a room

  A windowless room with one iron shelf.

create the strongbox
  a container, openable, lockable with the brass key, starts open
  in the Strong Room

  A squat strongbox with a bright keyhole.

create the brass key
  aka key
  in the Strong Room

  A small brass key.

create the hairpin
  in the Strong Room

  A sturdy steel hairpin.

create the deed
  in the strongbox

  A property deed, folded in thirds.

create the player
  starts in the Strong Room

The player sees:

> take the brass key
Taken.

> take the hairpin
Taken.

> close the strongbox
You close the strongbox.

> lock the strongbox
What do you want to lock it with?

> lock the strongbox with the brass key
You lock the strongbox with the brass key.

> open the strongbox
The strongbox is locked.

> unlock the strongbox with the hairpin
The hairpin doesn't fit the strongbox.

> unlock the strongbox with the brass key
You unlock the strongbox with the brass key.

> open the strongbox
You open the strongbox.

Inside the strongbox you see deed.