Vorple Screen Effects by Juhana Leinonen Search for other extensions by this author Approved for the Public Library

Versions

Download version 2/140430For Inform 7 6L38

Links

Description

Vorple equivalent of Basic Screen Effects by Emily Short. Waiting for a keypress, clearing the screen, aligning, styling and coloring text.

Tags effects typography vorple

Documentation

Vorple Screen Effects duplicates in Vorple the effects provided by Basic Screen Effects by Emily Short and adds a couple of new ones. Chapter: Differences with Basic Screen Effects The following phrases work identically in both offline and online interpreters. See the documentation of Basic Screen Effects for more information. clear the screen; wait for any key; wait for the SPACE key; pause the game; stop game abruptly; The following phrases are available but behave slightly different: center (text); (color) letters; turn the background (color); Vorple doesn't have a status line so any phrases related to changing or displaying the status line do not do anything (except in offline interpreters). The phrase "clear only the main screen" does the same as "clear the screen". And finally, these phrases not found in Basic Screen Effects have been added: right-align (text); turn the foreground (color); (color) background; In addition a mechanism for styling text beyond the Z-machine colors, italics and bold text is added. Chapter: Text styles The following styles are provided with the extension: cursive emphasis fantasy monospace nowrap strikethrough strong transient underline The "cursive" style displays text in a font resembling cursive writing, "fantasy" uses a decorative font resembling handwriting and "monospace" is a fixed width font (corresponding to Inform's [fixed letter spacing]). The actual font used depends on the web browser, operating system, and user preferences. "Emphasis" and "strong" are usually (but not guaranteed to be) italic and bold text respectively. The "nowrap" style does not allow line breaks inside the style. It's mostly used when displaying numbers that use space as a separator. For example, we don't want the text "The suitcase contains a statue worth 100 000 dollars" to be split between "100" and "000": The suitcase contains a statue worth 100 000 dollars. If we add the "nowrap" style ("The suitcase contains a statue worth [nowrap style]100 000[end style] dollars.") the number is guaranteed to stay on the same line: The suitcase contains a statue worth 100 000 dollars. We should take care not to apply the nowrap style to very long pieces of text. If the text is longer than the normal line width it overflows beyond the normal text area. The transient style does not change the text's appearance, but the all transient text will fade out and disappear at the start of the next turn. The following styles can be used to change the font size, proportional to the default font: xx-small x-small small large x-large xx-large New styles can be added if a CSS file with corresponding style instructions is supplied with the story. Release along with style sheet "emotions.css". angry is a Vorple style. When play begins: say "You are feeling [angry style]especially furious[end style] today!". The "emotions.css" file: .angry { color: red; font-size: larger; font-weight: bold; } The style's name is applied to the text as a class, so it should always be one word only. Pay attention to the capitalization of the style's name when defining it: Inform 7 is case-insensitive, but CSS styles are not. If you define the style as "Angry is a Vorple style" the corresponding CSS rule must also be for ".Angry". Chapter: Colors Styles for eight colors (red, green, yellow, blue, magenta, cyan, white and black) are provided as foreground and background colors. They correspond to the equivalent Z-machine colors. The basic set of colors can be used like Z-machine colors provided in Basic Screen Effects. say "A [green letters]frog[default letters] jumps into the [blue letters]pond[default letters]."; The coloring will work both in Vorple and in offline interpreters. Background colors work a bit differently. In Z-machine there's no way to change the background of something that's already been printed so if we want to change the interpreter's background color we have to clear the screen right after changing the background color. This is not necessary in Vorple, so the phrase "turn the background (color)" takes effect immediately. For changing the background color of a shorter piece of text, "[(color) background]...[end style]" can be used. To recap: say "a [green letters]frog[default letters]"; will print "frog" in green text in both Vorple and Z-machine say "a [green background]frog[default letters]"; will print "frog" with a green background in both Vorple and Z-machine, and turn the background green; will turn the whole screen's background green in Vorple, and the background of text from then on in Z-machine. Chapter: Centering and aligning text Offline interpreters can't center variable width text, but for web browsers it's not a problem. By default "center (text)" does not change the font style. Saying "center (text), fixed letter spacing" is more similar to the original effect. We can also show text aligned right: right-align "Over here!"; This will only work online. In offline interpreters the text will be left-aligned. Example: * Letters from a Madman - Example of all different styles available in the extension. The letter in this example story has all the styles defined in the extension, plus a couple of combinations and colors. *: "Letters from a Madman" Include Vorple Screen Effects by Juhana Leinonen. Release along with the "Vorple" interpreter. The Front lawn is a room. The mailbox is an openable, closed, fixed in place container in the Front lawn. A letter is in the mailbox. The description of the letter is "[cursive style][xx-large style]Dear [red letters]recipient[default letters],[end style][end style] [strikethrough style]Why[end style] I [emphasis style]know[end style]. [strong style]I have not forgotten.[end style] [monospace style]He is not [underline style]the one[end style].[end style] There are [nowrap style]10 000 000 000[end style] beetles in my head. [end is nigh] [fantasy style][x-large style]We are [yellow background]alone[default letters][end style][end style] He comes. [small style]He comes.[end style] [x-small style]He comes.[end style] [xx-small style]He comes.[end style] [transient style] This is a [x-large style]secret.[end style][end style]". To say end is nigh: right-align "The end is nigh." Test me with "open mailbox / read letter". Example: *** Monty Hall - A game show where the result is displayed with fancy font effects. Imagine a game show where you are presented with three doors. Behind one of them is a brand new car, and behind the rest are goats. You get to choose one of the doors. Then the game host opens one of the other doors revealing a goat, and you are given a chance to either switch to the one remaining door or open the one you picked originally. The Monty Hall paradox is a counterintuitive statistical fact that switching the door gives a much higher chance at finding a car behind it. We'll display the game's result using a custom-made CSS style file. It also styles the room header and uses a font from Google Fonts (http://www.google.com/fonts/). The CSS file can be downloaded from http://vorple-if.com/vorple/doc/inform7/examples/resources/css/montyhall.css. *: "Monty Hall" Let's Make a Deal is a room. Include Vorple Screen Effects by Juhana Leinonen. Release along with the "Vorple" interpreter. Release along with style sheet "montyhall.css". Chapter 1 - Game rules A gamedoor is a kind of container. door A, door B and door C are fixed in place closed gamedoors in Let's Make a Deal. A goat is a kind of thing. There are 2 goats. A car is a thing. Definition: a gamedoor is unused if nothing is in it. Definition: a gamedoor is wrong if a goat is in it. Definition: a gamedoor is correct if the car is in it. To decide which gamedoor is the remaining gamedoor which is not (first - a gamedoor) or (second - a gamedoor): repeat with X running through gamedoors: if X is not the first and X is not the second: decide on X. When play begins: now the car is in a random gamedoor; repeat with G running through goats: now G is in a random unused gamedoor. Instead of opening a gamedoor when every gamedoor is closed: let host-chosen door be a random wrong gamedoor which is not the noun; let optional door be the remaining gamedoor which is not the host-chosen door or the noun; say "'But wait!' the host says. 'You still have a chance to change your mind. Let's open [host-chosen door] which reveals a goat. You can still open [noun], or you can switch and open [optional door] instead. Which will you choose?"; now the host-chosen door is open. Instead of opening a closed gamedoor: say "'Congratulations!'"; end the story saying "You win [a random thing in the noun]!". Chapter 2 - Room header style room-header is a Vorple style. Rule for printing the name of a room (called the place) while looking: say "[room-header style][printed name of place][end style]". Chapter 3 - Epitaph style prize is a Vorple style. Before printing the player's obituary: say prize style; After printing the player's obituary: say end style. Test me with "open A / open A".