In Inform 7, what is the opposite of entering a container?

411 Views Asked by At

I have an Inform 7 story in which the player starts the game inside a container. I would like to say some text when the player leaves the container. When I use the conditional: "After exiting..." I get an error. "After entering..." works, so I assume I just have the wrong verb for exiting.

Here's the code in question:

The Hibernation Chamber is a room. 
The Hibernation Pod is a container in the Hibernation Chamber. The Hibernation Pod is enterable and fixed in place. The description is "It looks just like the twenty or so others in the room, except the lid is open."
The player is in the Hibernation Pod. 
After exiting the Hibernation Pod, say "You stand, blinking, and looking at two concentric arcs of identical, shiny white hibernation pods in a strange octagonally shaped room. The only break in the pods is for doors to the north and northeast. A bulky table with a clear top occupies the center of the two arcs of pods."

If I replace "After exiting" with "After entering" it builds and runs just fine. But, I want the rule to fire when the player gets out of the pod, not into the pod.

So what is the opposite of "entering" a container in Inform 7? I tried "exiting", "leaving", "getting out of", all to no avail. It just gives the following error:

Problem. You wrote 'After exiting the Hibernation Pod' , which seems to introduce a rule taking effect >only if the action is 'exiting the Hibernation Pod'. But that did not make sense as a description of an >action. I am unable to place this rule into any rulebook.

I have scoured the manual and examples, but nothing has helped. I'd be happy just to find a list of verbs that Inform 7 understands.

2

There are 2 best solutions below

0
On BEST ANSWER

The keyword is "from".

The player does not exit a container, player exits from a container.

Here's the same code, this time with "exiting from" and it works.

The Hibernation Chamber is a room. 
The Hibernation Pod is a container in the Hibernation Chamber. The Hibernation Pod is enterable and fixed in place. The description is "It looks just like the twenty or so others in the room, except the lid is open."
The player is in the Hibernation Pod. 
After exiting from the Hibernation Pod, say "You stand, blinking, and looking at two concentric arcs of identical, shiny white hibernation pods in a strange octagonally shaped room. The only break in the pods is for doors to the north and northeast. A bulky table with a clear top occupies the center of the two arcs of pods."
1
On

You can find a list of verbs Inform 7 understands under the Index in the Inform 7 program (try Actions → Alphabetical). However, the entry for exiting still isn't very clear on how to match the “container exited from” in a rule (image). The documentation is a little lacking here.

The magic that makes from work is this bit of the Standard Rules:

Exiting is an action applying to nothing.
The exiting action translates into I6 as "Exit".
The exiting action has an object called the container exited from (matched as "from").

As you can see, Inform 7 considers “exiting” an action applying to nothing. (Philosophically, there's only one thing you can ever exit, and it's “whatever container or room you're in”. It wouldn't make sense to exit lamp or exit table. So it doesn't need an object.) It's a little pesky, but that's why *exiting the Hibernation Pod doesn't work.

Instead, that container exited from action variable is set to “whatever container or room you're in” at the start of an exiting action:

Setting action variables for exiting:
    now the container exited from is the holder of the actor.

The fact that this action variable is matched as "from" is a convenience that lets us abbreviate:

After exiting when the container exited from is the Hibernation Pod, …

into:

After exiting from the Hibernation Pod,

See §12.10. Action variables.