Displaying the chapter of your zcode story file?

Not certain if this is explained already, but is there a way to show the chapter heading of my game before I begin my room name and description like Textfyre’s “Shadow of the Cathedral?” For instance:

The Inform 7 release is 6L38 and I am compiling to zcode btw.

You can break your game up into scenes, and then make the headers display when the scenes start, like so:

[code]The Shadow of the Cathedral is a scene.
The Shadow of the Cathedral begins when play begins.

When The Shadow of the Cathedral begins: say “[bold type]Chapter 1 - The Shadow of the Cathedral[roman type][line break]”.[/code]

Much obliged! :sunglasses:

Is there way how I can post the scene before a room? Like the starting room, and a specified room? Sorry for seeming imbecile questions. I looking through the docs that come with Inform 7 at the moment, it is rather intriguing how scenes work.

A small point: CKY’s code will print the first chapter heading before the game’s banner text. But you said you wanted the introductory text, then the banner, then the first chapter heading. Here’s one way of doing it.

The Shadow of the Cathedral is a scene.
The Shadow of the Cathedral begins when printing the banner text is going on.

After printing the banner text: follow the scene changing rules.

When play begins:
   say "Intro text..."

Edit: I just saw your most recent post. Can you explain more exactly what you want? I’d guess you want something like this.

The Chapel is a room.

A Whisper from the Crypt is a scene. 
A Whisper from the Crypt begins when the player is in the Chapel.
When A Whisper from the Crypt begins: say "[bold type]Chapter 2 - A Whisper from the Crypt[line break]"

Before printing the name of the Chapel: follow the scene changing rules.

Of course, it might be easier not to use the scene mechanics at all, since we seem to be subverting them all the way, and just write a rule such as:

Before going when the room gone to is the Chapel and the Chapel is unvisited:
     say "[line break][bold type]Chapter 2 - A Whisper from the Crypt[roman type][line break]".

Here’s a more elegant second attempt.

"Chapter Headings" by JRB

A scene can be narrative. 
The chapter number is a number variable. 
When a narrative scene (called the chapter name) begins:
	increment the chapter number;
	say "[line break][bold type]Chapter [the chapter number] - [The chapter name][roman type][line break]"

After printing the banner text: follow the scene changing rules.
A last carry out going rule: follow the scene changing rules.


The Shadow of the Cathedral and A Whisper from the Crypt are narrative scenes. The Shadow of the Cathedral begins when printing the banner text is going on. The Shadow of the Cathedral ends when the player is in the Chapel. A Whisper from the Crypt begins when The Shadow of the Cathedral ends.

When play begins: say "Can you fathom the mystery of the Tomb of St Aedwytha?"
When Shadow of the Cathedral ends: say "The door creaks open, and you tiptoe nervously into the dimness beyond..."

The Cloisters is a room. "You feel the ghosts of long-dead monks watch disapprovingly, as you
edge your way around the ancient stone pillars. A dreadful doorway lies to the east."
The Chapel is a room. The Chapel is east from The Cloisters.

Thanks guys, this is very helpful indeed! :smiley:

Note the source code for Shadow is on Github.

github.com/ChicagoDave/textfyre … orm/Source

The relevant bits are:

[code]Part 3 - Chapter Break Mechanics

The current game chapter is a number that varies.

When play begins:
now the current game chapter is 1;
send hints for 1;
change the right hand status line to “”;
change the left hand status line to “Chapter [current game chapter]: [current chapter name] – [location]”.

Table of Chapter Titles
title chapter
“Between a Rack and a Gear-Trace” 1
“No Place to Hide” 2
“In the Cathedral of Time” 3
“The Figure in Grey” 4
“The Rooftops of St Philip” 5
“The Clockmaker” 6
“The Counting House” 7
“The Secret in the Docklands” 8
“Covalt’s Device” 9
“Back to the Cathedral” 10
“Into the Crypt” 11
“Midnight” 12

To say current chapter name:
say title corresponding to a chapter of the current game chapter in the table of Chapter Titles;

Section 1 - Release method

When play begins:
state chapter;

To end a/the chapter:
increase the current game chapter by 1;
send hints for current game chapter;
state chapter;
pause the game;

To state chapter:
if XML is in use:
select the chapter channel;
say “Chapter [current game chapter]: [current chapter name]”;
select the main channel;
[/code]

That’s a much better way of doing it I think.

You could also do something like this:

After printing the banner text while not Requesting the story file version: Say "[line break][bold type]Chapter 1: Blah Blah[roman type][paragraph break]".