Inform 6 -> Inform 7: Player exiting calls routine

My adventure in porting a game from Inform 6 to Inform 7 continues. :astonished: :wink:

In Inform 6, the following source code calls the “Ejection” routine when the player types UP or OUT, which prints some text and moves the player to a new location:[code]! Direction routine from the office in “Toyshop” by Graham Nelson.

Object Chamber “Featureless Chamber”
description “”,
u_to [;
out_to [;
has light;[/code]
In the following Inform 7 code, typing the dummy verb CHICK at the prompt triggers the “Transport one” routine:[code]“Forcing the Status Line 02” by Jay Goemmer

Include Basic Screen Effects by Emily Short.

The story headline is “An Interactive Example”.

To redraw status line: (- DrawStatusLine(); -).

When play begins:
say “Introductory text here.[paragraph break]”;
say “[bracket]MORE[close bracket]”;
wait for any key;
clear the screen.

Chamber is a room. The printed name is “Featureless Chamber”. The description is “Type CHICK to begin the demonstration.”.

Midair is a room. The printed name is “Suspended in Midair”.

Endgame is a room. The printed name is “That’s all, folks!”

Understand “chick” as transport one.

Transport one is an action applying to nothing.

Report transport one:
clear the screen;
move the player to Midair, without printing a room description;
say “[line break]Narrative text here.[paragraph break]More narrative text droning on.[paragraph break]Rattling on nonsensically some more.[paragraph break]”;
redraw status line;
say “[bracket]MORE[close bracket]”;
wait for any key;
clear the screen;
move the player to Endgame, without printing a room description;
say “Thanks for coming. You can let yourself out by typing ‘QUIT.’”.[/code]
How do I trigger the “Transport one” routine when the player types UP or OUT at the prompt?

I’ve read and re-read the “Recipe Book” and “Writing with Inform,” as well as searching this forum, to no avail. I think it might have to do with “going,” but I just can’t get any farther than that.

Any help is incredibly welcome. Thanks in advance! :smiley:


No need to define a new action, simply put that code in the body of this rule:

Instead of going up or going inside when the location is chamber:


I cut and pasted your code, and got the following error message:

"This is the report produced by Inform 7 (build 6G60) on its most recent run through:

Problem. You wrote ‘Instead of going up or going inside when the location is Chamber’ , which seems to introduce a rule, but the circumstances (‘going up or going inside when the location is Chamber’) seem to be too general for me to understand in a single rule. I can understand a choice of of actions, in a list such as ‘taking or dropping the ball’, but there can only be one set of noun(s) supplied. So ‘taking the ball or taking the bat’ is disallowed. You can get around this by using named actions (‘Taking the ball is being mischievous. Taking the bat is being mischievous. Instead of being mischievous…’), or it may be less bother just to write more than one rule.

See the manual: 7.8 > Rules applying to more than one action"

(shrug) Your solution looks like it should work, but I’ve discovered that Inform can be mercilessly picky. :blush: :cry:

(chuckling) I have no idea what to “fix” here.

Thanks again,

Oh sorry. The error message says that only one noun is allowed, but I said two: up and inside.

Instead try these:

[code]Instead of going up when the location is chamber:

Instead of going inside when the location is chamber:
try going up instead;[/code]


Thanks so much! The revised version works perfectly! :smiley:

Note that you can say “Instead of going up in chamber:” and “Instead of going inside in chamber:”; I think this will always have the same effect as “when the location is chamber.” (Well, I guess that if you had a “before” rule" that moved the player to a different room then it might be different, but I doubt you’ll do that.)

See section 7.13 of Writing with Inform for some subtleties here.

If in chamber is depreciated, see section 3.25.

No, that deprecation applies to “if X in Y” as a conditional test. “Fooing X in Y” is still supported as an action description. (See examples in 7.11, etc.)

You can also say “Instead of going up from chamber”. (But this is slightly different: it only triggers after the “going” action has found a valid exit. So it wouldn’t work for this example.)

matt w,

Thanks for the additional insight.

(chuckling) I wouldn’t do that… :wink: :smiley:

“because ‘the location of the rabbit’ is a quantity which changes in play (the player can pick up the rabbit and take him to the Dome, for instance).”

Ah, excellent! Good point! Thanks for showing me exactly where to look. :smiley:

zarf, that’s very confusing, especially because “Fooing X when in Y” also compiles (unless you use no deprecated features).

“Fooing X in Y” is odd – it essentially unrolls WhetherIn() to put the relevant test in the rule preamble. I guess it makes sense to keep it, because there isn’t any other nice way to check regions.