Introducing hyperlinks
Bisquixe is not the only way to implement hyperlinks in an Inform game, but it does offer a very lightweight, flexible, and legible option for authors.
In bisquixe, we use the phrase
hyperlink "[link text]" as "[command text]";
link text specifies the words that the player sees on screen. command text is the player’s command that is exectuted when the player clicks on the link text.
hyperlink "jump as high as you can" as "jump";
Note that while hyperlinks operate at a basic level within other interpreters, we cannot adjust their appearance or employ advanced techniques discussed in later posts.
Since we are using printed text, we Bisquixe authors can style our links. IF we wish to style a link via an inline style, we can take this approach:
css-set-fast ".Style_link a:link; color; maroon";
This construction invokes our custom class immediately follow by a link pseudoclass with out a semicolor or separator between them.
We can change the color property of a:link to suit a background color, and this often be necessary to provide players with adequate color contrast. Note that a:link affects all printed links. If we change this value in game—remember that Bisquixe changes CSS on the fly—every on-screen link will be affected.
Because not every color matches every background, a best practice is to set a common default via a:link, then go further to configure colors for custom classes.
lab is a room.
include simple multimedia effects for v10 by mathbrush.
release along with a "bisquixe" interpreter.
when play begins:
css-set-fast ".Style_jmp; font-size; 25px";
css-set-fast ".Style_jmp a:link; color; black";
css-set-fast ".Style_jmp; background; orange";
css-set-fast ".Style_jmp; font-family; sans-serif";
to say jmp:
set-any-class "jmp";
the description of lab is "[lab]";
to say lab:
hyperlink "On the count of three, [jmp]Jump as high as you can![roman type] You can do it." as "jump";
Note that we use a to say lab phrase to define our hyperlink, then add it inline to out “Jump as high as you can!” text. Since we will usually want our links to print as part of some larger text, this is a commonly-used tactic.
It’s useful to think of hyperlinks as a form of specialized text. With few exceptions, we handle them as we would other substitutions. As we’ll see in the next post, this affords many opportunities to us as authors.
