Understand [verbing a not-door-noun] as [enter xyz door]

Hi all
I want Inform 7 to understand that when a player types “climb through fence” that it needs to recognise that the player wants to go through the door in the fence named “hole in the wall”


The Main Street South is south of the Main Street Entrance. "You can see that half remembered gap in the fence from here."
The hole in the fence is a door. The hole in the fence is open. The hole in the fence is west of the Main Street South and east of the Garden South. 

Understand "climb through fence" as "go through hole in the fence". Understand "enter fence" as "go through hole in the fence". Understand "step through fence" as "go through hole in the fence". Understand "get in fence" as "go through hole in the fence."

Any suggestions on how to make it recognise people’s understandable shortenings of sentences to refer to a ridiculously named door?

To begin with, an Understand line has to have an action on the right, not a quoted string. So to get your lines to be grammatical they’d have to look like this:

Understand "climb through fence" as entering the hole in the fence.

However, trying to understand entire quoted commands like this is a bad idea. It basically short-circuits the parser and takes us back to the bad old days when games would only recognize the exact wording of a command. In particular, if you use a line like the one I just typed, the game will understand CLIMB THROUGH FENCE but not CLIMB THROUGH THE FENCE. It’s much better to have commands understood flexibly instead of trying to hard-code the nouns.

Another thing that you should know is that the action for going through a door is the entering action, “enter” and “go through” are already coded in as commands that represent the entering action, and if you have an object named “hole in the fence” then Inform will understand every individual word as referring to that object. So “ENTER FENCE” and “GO THROUGH FENCE” already work before you write any Understand commands!

In this particular case, it’s almost enough to just have all the commands you have understood as entering:

Understand "climb through [something]" as entering. Understand the command "step" as "go".

It should never be harmful to have “climb through” understood as entering–if the player types CLIMB THROUGH BOX and the resulting action is that they get in the box, it won’t be disconcerting. The second command maps “step” to “go” wherever it occurs in a command, which means “step in fence” and “step through fence” get turned into “go in fence” and “go through fence”–which are understood as entering the hole in the fence, so they do what you want. And “step inside” will be understood as “go inside,” which would work when you can go in the inside direction.

But there’s a complication (which lets me demonstrate another way of doing things like this). The line

Understand "get in [something]" as entering.

doesn’t have the desired effect, because Inform wants to understand that command as taking the hole in the fence. (Since “in” and “fence” are both words in its name.) I don’t have time to try to solve this right now (that is, I tried something and it didn’t work.)

Another technique that will often come up is to redirect an action to an action on a different object. So if we had implemented the fence and the hole as different objects, we could try this:

Before entering the fence: try entering the hole instead.

and in combination with our other modifications, this would let a command like “step through fence” be understood as the action of entering the fence, which would then get redirected to the action of entering the hole.

In general it’s better to try this kind of stuff rather than short-circuiting the parser.