Parameters in Before conditionals

I want to preempt a door from being opened when it is closed (not locked).
I have a Before condition that check every color door: red, blue, yellow, etc.
How can I make convert many color-specific Before opening red door:
into a more generic one, like Before opening [door]:

I would think this kind of thing would be in standard library (I couldn’t find it) or at least mentioned in the Design Manual (again I couldn’t find it).
Any help?

Before opening a door:

This thread probably belongs in the Inform 6/7 Development board.