Interactive Poetic Interludes
version 2 by Kazuki Mishima
- Example: * Bland Poetry - A short piece of interactive fiction with an interactive poetic interlude.
Uses Basic Screen Effects (built in to Inform 7) by Emily Short to clear the screen.
This extension creates a scene called Poetic Interlude that temporarily suppresses in-world verbs and displays a body of text. It revises the text based on keywords found in the currently displayed text rather than using verb commands.
This extension includes a room (called Recitation) specifically for the Poetic Interlude scene. Therefore, you will have to take care of letting Inform know in which room play should start. For example:
Starting Room is a room. The player is in Starting Room.
To set up the body of text that is displayed, the author must implement a "poem", which is a kind of thing defined in the extension. A poem can be read or unread. It is unread by default. A poem has a table-name called textual content which should point to a table containing the lines of poetry or pieces of text to be displayed, the place of each within the whole, and the keywords that trigger them. The table has to follow a certain format, which I find hard to explain except by example:
Many Lines is a poem. The textual content of Many Lines is the Table of Many Lines.
Table of Many Lines
|--||a number||some text|
|--||1||"The first line"|
|"first"||2||"of three or more"|
|"line"||2||"of a bland poetic narrative"|
|"three"||3||"is, by itself, still only one.[fin]"|
|"more"||3||"holds untold possibility in finite space.[fin]"|
|"bland"||3||"shows so little promise.[fin]"|
|"poetic"||3||"may contain no play on words.[fin]"|
|"narrative"||3||"tells no story worth hearing.[fin]"|
Note that invoking [fin] or [fín] brings the poem to an end. Also note that a keyword can not be "quit" or "restart" or correspond to any of these out-of-world actions.
When displayed, the poem will grow line by line as the player uses keywords to choose lines from the table. These will be displayed with automatic line breaks between them unless the author invokes this code:
You can define multiple poems this way, keeping them in separate objects for use at different points in the story.
To start poetic interlude, the author must manipulate "the current poem", which points to the poem queued for display. By default, the current poem points to a null poem object marked as read. When the current poem is unread, the Poetic Interlude scene will start and display whatever poem is current. So, to invoke the poem created in the example above, one would leave at the end of a rule:
change the current poem to Many Lines.
The Poetic Interlude Scene moves the player to a purpose-created room where no room-specific rules can get in the way. When the interlude ends, it is up to the author to decide how play should proceed. This is probably best done with a scene, like so:
After the Poem is a scene. After the Poem Begins when Many Lines is read.
When After the Poem begins:
say "After reading that bland poem you realize where you really want to be.";
move the player to the Bar, printing an abbreviated room description.
When the end of a poem is reached, it is marked as read, so this property of a poem object can be used to trigger the next scene.
It should be noted that any rules applying to in-world commands should be restricted so that they don't apply during the Poetic Interlude scene, because otherwise they may interfere with the keyword mechanism:
Instead of jumping when Poetic Interlude is not happening:
say "You've better things to do at present."
The Table of Informational Messages may be amended if desired as explained in Writing with Inform, Chapter 15.19 "Table Amendments." For reference, the table is below:
Table of Informational Messages
|word-not-valid-yet||"[line break][line break](That word is not part of the poem yet.)[line break]"|
|word-not-valid||"[line break][line break](That word is not part of the poem at all.)[line break]"|
In the poem display rule, comment out or otherwise remove the "clear only the main screen;" line to remove the screen-clearing mechanism. The author may wish to do this for longer works or to allow for the possibility of a smaller game screen.