How much can I hack the banner text?

+2 votes
108 views
asked Mar 27 in Authoring by Ryan Veeder (290 points)
recategorized Mar 27 by Alex

Often I feel the urge to do wacky stuff with banner text. Right now I want to change the story title on the fly.

In the Z-Machine, you can simply suppress the real banner text and print a fake version with all the right information and the title in bold type. Easy.

But Glulx treats the banner text a little differently than the Z-Machine does: The story title gets to appear in a slightly larger font. A faked banner is not going to hold up to scrutiny, and even if it fools the player, it still doesn't have the majesty that accompanies a bigger font.

Is it possible to make Inform 7 print title-styled text in non-banner contexts? Is it possible to change what the game thinks the title is in mid-game?

3 Answers

+2 votes
answered Mar 27 by Juhana (246 points)
selected Mar 27 by Ryan Veeder
 
Best answer

There is a built-in extension called Glulx Text Effects by Emily Short that defines a "header style" that is used to print the story title in the banner. If you don't want to include the whole extension only for the header style, you can define it simply with this rule:

To say header style:
    (- glk_set_style( style_Header ); -).

The story title is a read-only attribute but if you're going to replace the banner that doesn't really matter because that's the only place where it's displayed. You can just make a new variable that holds the changing title.

All in all you could do this:

My title is text that varies. My title is usually "My Awesome Adventure".

Rule for printing the banner text:
    say "[header style][my title][roman type][line break]";
    say "[story headline][line break]";
    rule succeeds.

You can't get the serial number and I7 version out of the box. There's an extension Extended Banner by Stephen Granade that defines them, but it's not 100% compatible with the latest Inform.

 

+1 vote
answered Mar 27 by AndrewS (250 points)
edited Mar 27 by AndrewS

Here's code to change the title with a specific command. Basically the Banner function in Printing.i6t reads Story, a constant, so you can't change that. So you need to modify the Banner function.

 

This compiled for me in 6g but there may be more to do for 6, or to do what you specifically want.

 

"story" by Andrew Schultz

room 1 is a room.

Include (-

[ Banner;
   BeginActivity(PRINTING_BANNER_TEXT_ACT);
   if (ForActivity(PRINTING_BANNER_TEXT_ACT) == false) {
           VM_Style(HEADER_VMSTY);
        print (string) randStory-->storyNum;
        VM_Style(NORMAL_VMSTY);
        new_line;
        print (string) Headline;
        #ifdef Story_Author;
        print " by ", (string) Story_Author;
        #endif; ! Story_Author
        new_line;
        VM_Describe_Release();
        print " / Inform 7 build ", (string) NI_BUILD_COUNT, " ";
        print "(I6/v"; inversion;
        print " lib ", (string) LibRelease, ") ";
        #Ifdef STRICT_MODE;
        print "S";
        #Endif; ! STRICT_MODE
        #Ifdef DEBUG;
        print "D";
        #Endif; ! DEBUG
        new_line;
    }
    EndActivity(PRINTING_BANNER_TEXT_ACT);
];

-) instead of "Banner" in "Printing.i6t".


Include (-

Global storyNum = 1;

Array randStory --> 8 "The Lion the Witch and the Wardrobe" "Prince Caspian" "The Voyage of the Dawn Treader" "The Silver Chair" "The Horse and His Boy" "The Magician's Nephew" "The Last Battle";

-) after "Definitions.i6t".

to story-process:
    (- storyNum = storyNum + 1; if (storyNum >= 8) { storyNum = 1; } -)

to story-fix (x - a number):
    (- storyNum = x; -)

chapter incing

incing is an action applying to nothing.

understand the command "inc" as something new.

understand "inc" as incing.

carry out incing:
    story-process;
    the rule succeeds;
 
test newban with "inc/version/inc/version/inc/version/inc/version/inc/version/inc/version/inc/version/"
commented Mar 27 by AndrewS (250 points)
edited Mar 27 by AndrewS
My i6 is shaky, but basically, I changed the line in Definitions.i6t from

print (string) Story to print (string) randStory-->storyNum;

You could then change the title whenever you wanted with

story-fix 5;

Or whatever. You could change similar parts of the banner in other ways, e.g. the Headline or the Author. You just might have more cryptic comments from the I6 compiler if things go wrong.

Also you may've noticed the reason header text looks different is the VM_Style(HEADER_VMSTY); line before it. So that is how header style is called.
+1 vote
answered Mar 27 by Dannii (329 points)

AndrewS gives a good answer for how to do it through I6, but if you want to keep to using I7, then all you need to use is Glulx Text Effects. The title of the game is printed using the header style, so you can use [header style] in your texts just as you would [bold type]. You can also use GTE to change how all the styles are displayed too.

PS: Because I normally use Gargoyle I forgot that the default header style is larger. Gargoyle doesn't support font sizes :(

This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...