Doors that can be locked and unlocked are pretty common elements in most buildings. This demonstrates creating a door that is locked and can be unlocked.
Locked Doors was created with Inform and has IFID E522E2F5-126B-4C28-A101-1CF9D0A0DCC1. To play a work like this one, you need an interpreter program: many are available, among them Zoom
for Mac OS X and for Unix; Windows Frotz or Windows Glulxe for Windows.