Watertight door

A watertight door conventionally is locked and unlocked using a wheel. So I built a door with a wheel as a key and as a part of the door. However ‘Lock/Unlock door with wheel’ doesn’t work because you can’t take the wheel.

Can anyone suggest an elegant way of getting round this? Can I suppress the standard rule in this case?

I can think of several laborious methods such as temporarily detaching and re-attaching the wheel, or by having a loose wheel kicking around that the player has to carry. Or by making the wheel a device rather than a key and juggling the locked status of the door in the background.

You could do this, although it’s not terribly elegant:

[code]Cave is a room. The beyond is a room.
The watertight door is a door. The watertight door is east of the cave and west of the beyond.
The watertight door is locked.

The wheel is part of the watertight door. The wheel unlocks the watertight door.

Rule for implicitly taking the wheel when the current action is the action of unlocking the watertight door with the wheel:
if the watertight door is locked, try turning the wheel instead;
otherwise say “The door is already unlocked.”

Rule for implicitly taking the wheel when the current action is the action of locking the watertight door with the wheel:
if the watertight door is unlocked, try turning the wheel instead;
otherwise say “The door is already locked.”

Instead of turning the wheel:
if the watertight door was locked:
say “With a scraping sound, you unlock the door!”;
now the watertight door is unlocked;
if the watertight door was unlocked:
say “With a scraping sound, you lock the door again!”;
now the watertight door is locked;
rule succeeds.[/code]

Brilliant. Intercepting the implicit taking of the wheel. And it really IS more elegant than anything I came up with.

Thanks.

My pleasure. Also, I’d try to catch “unlock door” as well:

Does the player mean unlocking the watertight door with the wheel: it is very likely. Does the player mean locking the watertight door with the wheel: it is very likely.

Thanks for that, too. As a very new Inform 7 user, that’s the first time I’d come across a use for Does the player mean.

I also popped in a line of code to catch the case where the player tries to lock the door when it’s open.

Good call. Check out the Locksmith extension, though: I have vague recollections of it doing something like that already, so if you want to add more sophisticated locking behavior, you might not need to reinvent the wheel.

As a player, the first command I would try would be “turn wheel”
Just sayin’!

McT