Implicit Action Detection

Here’s a small challenge, when presented to myself, I simply could not solve:

Imagine a “screen door” as a twist on the AutoClosingDoor. It has the following characteristics:

  • When moving through the door, the door should automatically close
  • An explicit open action should result in the door being closed (IE, the open command should fail)

[code]> x door
A thinly wooden-framed screen door fashioned with a spring that causes to to automatically close.

south
(first opening the door)
Southern room description

The door swings shut behind you.

north
(first opening the door)
Northern room description

The door swings shut behind you.

open door
You open the door. As you let go, it swings shut.[/code]

The problem was when implementing the Open verb for the door, there was simply no way I could determine whether or not the Open action was being performed explicitly or implicitly. Anyone know how to determine, inside a check() whether the command is implicit or not?

You should be able to use something like this (untested) code:

if (!gAction.isImplicit) { failCheck('You pull the door open, but when you let it go it swings closed again. '); }
gAction is the current action. I found the isImplicit property by looking up the Action class in the Library Reference Manual and then searching the page for “implicit”.

Argh! Thanks Emerald.