Spoofing a banner text.
last time, of let’s write IF…
Remember that “clicker” number we assigned to every card? We finally found a use for it, using a “to decide” definition to choose an ending for our game based the clicker values. From there, I created tables that we can use to print the texts for the different endings.
what goes in a banner, anyway?
I haven’t really tipped my hand yet: what is this thing supposed to look like? I’d like every card draw to look like a new “game,” with its own banner text, room description, action feedback, ending, and so forth. Once this has happened eight times, the “real” ending will happen according to the code we wrote in the last episode of let’s make IF.

What does the text of a banner look like? A reminder:
Portrait With Wolf ^_^
A fun activity by Drew Cook
Release 0 / Serial number 241007 / Inform 7 v10.1.2 / D
We’ve been at this a while, and probably guess what happens next. We can mockup our own text using substitutions and line breaks.
to say the fake banner:
choose row with an index of the magic number from the table of banner information;
say "[fake title entry]
[lb][subtitle entry]
[lb]Release [RN entry] / Serial number [SN entry] / Inform 7 v10.1.2 / [compiler entry]"
As a reminder from previous posts, I use substitutions for common (tedious) texts like “line break” ([lb]).
This is a lot of substitution. We can hold it all in one table, I think. A row for each “magic number” and columns for each of these instances. We’ll store everything as text. If we preferred, we could make [RN] match the release number to help people keep track, but we are already showing players a tally of card chosen (see last post).
table of banner information
index fake title subtitle RN SN compiler
1 "Portrait With Wolf ^_^" "An absolute delight" "1" "241007" "F"
This is probably going to be hard to look at in your IDE. Resize the pane for best results. You can also place a comment “spacer” between rows with a pair of brackets if it makes things easier to read.
table of banner information
index fake title subtitle RN SN compiler
1 "Portrait With Wolf ^_^" "An absolute delight" "1" "241007" "F"
[]
table of banner information
index fake title subtitle RN SN compiler
2 "Portrait With Wolf ^_^" "An absolute delight" "1" "241007" "F"
As in every other case, empty rows will throw a run-time error, so I’ll fill the table with duplicate rows. The current goal is to build a template that we can fill in later.
When should we print it? How about “before looking”? We’ll need to handle what happens when a player types “look” or “l”, since reprinting the banner doesn’t make sense in those cases. But let’s roll with it for now.
As a final move, we delayed the real banner in a previous episode. Let’s put it back at the very beginning: it seems like a good idea to print the real banner first. The result doesn’t look great; we need bolt text for our title and a paragraph break between the fake banner and the room name. Final version:
to say the fake banner:
choose row with an index of the magic number from the table of banner information;
say "[bt][fake title entry][rt]
[lb][subtitle entry]
[lb]Release [RN entry] / Serial number [SN entry] / Inform 7 v10.1.2 / [compiler entry]
[pb]"
output:
Portrait With Wolf ^_^
An absolute delight
Release 1 / Serial number 241007 / Inform 7 v10.1.2 / F
A Brightly Lit Room!
A bare place. A bright light emerges from an unknown source above.
A small metal table stands under the light. It is covered in gray, chipped paint. The following items rest atop it:
a red card
a blue card
a yellow card
an orange card
>
Pretty convincing, right?
I think this is enough for today. How would you tackle creating nine of these screens, in terms of the text? There’s the possibility of progression (magic number) and different conclusions. My ultimate goal is to make something that anyone could use simply by filling in the tables, no new code required.
next
We’ll continue building our “screen” with an opening blurb and some fake endings, printing at the beginning and ending of every turn.
One response to “let’s write IF #11: repeat the beginning”
-

[…] let’s write IF #11: repeat the beginning […]
LikeLike

Leave a reply to let’s make IF #12: formatting and forgeries – top expert Cancel reply