1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-26 04:00:43 +03:00

Inessential extensions removed from core Inform repository

This commit is contained in:
Graham Nelson 2023-07-09 12:07:18 +01:00
parent fe9aa9e32d
commit 1cd2558257
20 changed files with 60 additions and 1879 deletions

View file

@ -141,21 +141,7 @@ The following webs are the source for the two most important extensions shipped
Other extensions shipped with Inform are not presented as webs, but as single files:
* [Basic Help Menu by Emily Short](<inform7/Internal/Extensions/Emily Short/Basic Help Menu.i7x>) - __v1__
* [Basic Screen Effects by Emily Short](<inform7/Internal/Extensions/Emily Short/Basic Screen Effects.i7x>) - __v9__
* [Complex Listing by Emily Short](<inform7/Internal/Extensions/Emily Short/Complex Listing.i7x>) - __v9__
* [Glulx Image Centering by Emily Short](<inform7/Internal/Extensions/Emily Short/Glulx Image Centering.i7x>) - __v4__
* [Glulx Text Effects by Emily Short](<inform7/Internal/Extensions/Emily Short/Glulx Text Effects.i7x>) - __v6__
* [Inanimate Listeners by Emily Short](<inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x>) - __v2__
* [Locksmith by Emily Short](<inform7/Internal/Extensions/Emily Short/Locksmith.i7x>) - __v14__
* [Menus by Emily Short](<inform7/Internal/Extensions/Emily Short/Menus.i7x>) - __v3__
* [Punctuation Removal by Emily Short](<inform7/Internal/Extensions/Emily Short/Punctuation Removal.i7x>) - __v6__
* [Skeleton Keys by Emily Short](<inform7/Internal/Extensions/Emily Short/Skeleton Keys.i7x>) - __v1__
* [Epistemology by Eric Eve](<inform7/Internal/Extensions/Eric Eve/Epistemology.i7x>) - __v9__
* [Approximate Metric Units by Graham Nelson](<inform7/Internal/Extensions/Graham Nelson/Approximate Metric Units.i7x>) - __v1__
* [English Language by Graham Nelson](<inform7/Internal/Extensions/Graham Nelson/English Language.i7x>) - __v2__
* [Metric Units by Graham Nelson](<inform7/Internal/Extensions/Graham Nelson/Metric Units.i7x>) - __v2__
* [Rideable Vehicles by Graham Nelson](<inform7/Internal/Extensions/Graham Nelson/Rideable Vehicles.i7x>) - __v3__
### Website templates and interpreters shipped with Inform

View file

@ -13,6 +13,8 @@ void ExtensionIndex::write(inform_project *proj) {
linked_list *L = NEW_LINKED_LIST(inbuild_search_result);
linked_list *U = NEW_LINKED_LIST(inbuild_copy);
linked_list *R = NEW_LINKED_LIST(inbuild_requirement);
int internals_used = 0, materials_used = 0, externals_used = 0;
int internals_installed = 0, materials_installed = 0;
@<See what we have installed and used@>;
text_stream HOMEPAGE_struct;
@ -33,12 +35,20 @@ void ExtensionIndex::write(inform_project *proj) {
inbuild_requirement *req = Requirements::anything_of_genre(extension_bundle_genre);
if (LinkedLists::len(search_list) > 0) Nests::search_for(req, search_list, L);
ExtensionIndex::find_used_extensions(proj, U, R);
inbuild_search_result *ecd;
LOOP_OVER_LINKED_LIST(ecd, inbuild_search_result, L) {
if (Nests::get_tag(ecd->nest) == INTERNAL_NEST_TAG) internals_installed++;
else if (Nests::get_tag(ecd->nest) == MATERIALS_NEST_TAG) materials_installed++;
}
inbuild_copy *C;
LOOP_OVER_LINKED_LIST(C, inbuild_copy, U)
if ((C->nest_of_origin) &&
(Nests::get_tag(C->nest_of_origin) != INTERNAL_NEST_TAG) &&
(Nests::get_tag(C->nest_of_origin) != MATERIALS_NEST_TAG))
Nests::add_search_result(L, C->nest_of_origin, C, req);
if (C->nest_of_origin) {
switch (Nests::get_tag(C->nest_of_origin)) {
case INTERNAL_NEST_TAG: internals_used++; break;
case MATERIALS_NEST_TAG: materials_used++; break;
default: externals_used++; Nests::add_search_result(L, C->nest_of_origin, C, req); break;
}
}
@<Write the body of the HTML@> =
HTML::begin_html_table(OUT, NULL, TRUE, 0, 4, 0, 0, 0);
@ -71,36 +81,34 @@ void ExtensionIndex::write(inform_project *proj) {
int usage_state = TRUE;
@<Display an alphabetised directory@>;
HTML_TAG("hr");
HTML_OPEN("p");
HTML_OPEN("b");
WRITE("These are available, but are not used by '%S'...", proj->as_copy->edition->work->title);
HTML_CLOSE("b");
HTML_CLOSE("p");
usage_state = FALSE;
@<Display an alphabetised directory@>;
if ((internals_used < internals_installed) || (materials_used < materials_installed)) {
HTML_OPEN("p");
HTML_OPEN("b");
WRITE("These are available, but are not used by '%S'...", proj->as_copy->edition->work->title);
HTML_CLOSE("b");
HTML_CLOSE("p");
usage_state = FALSE;
@<Display an alphabetised directory@>;
}
@ From here on, then, all the code in this section generates the main directory
page, not the index of terms, which is all handled by
//ExtensionDictionary::write_to_HTML//.
@<Display the location of installed extensions@> =
int nbi = 0, nps = 0, nex = 0;;
inbuild_search_result *ecd;
LOOP_OVER_LINKED_LIST(ecd, inbuild_search_result, L) {
if (Nests::get_tag(ecd->nest) == INTERNAL_NEST_TAG) nbi++;
else if (Nests::get_tag(ecd->nest) == MATERIALS_NEST_TAG) nps++;
else nex++;
}
HTML_OPEN("p");
pathname *P = Nests::get_location(Projects::materials_nest(proj));
P = Pathnames::down(P, I"Extensions");
PasteButtons::open_file(OUT, P, NULL, PROJECT_SPECIFIC_SYMBOL);
WRITE("&nbsp;");
if (nps > 0) {
if (materials_installed > 0) {
WRITE("%d extension%s installed in the .materials folder for the "
"project '%S'. (Click the icon to show the location.)",
nps, (nps==1)?" is":"s are", proj->as_copy->edition->work->title);
"project '%S'",
materials_installed, (materials_installed==1)?" is":"s are",
proj->as_copy->edition->work->title);
int i = materials_installed, u = materials_used;
@<Say how many of those installed are used@>;
WRITE(" (Click the icon to show the location.)");
} else {
WRITE("No extensions are installed in the .materials folder for the "
"project '%S'. (Click the icon to show the location. "
@ -113,22 +121,43 @@ page, not the index of terms, which is all handled by
HTML_OPEN("p");
HTML_TAG_WITH("img", BUILT_IN_SYMBOL);
WRITE("&nbsp;");
WRITE("As well as being able to use extensions installed into its own folder, "
"any project can use extensions which come built into the Inform app. There "
"are currently %d.", nbi);
WRITE("The Inform app comes with a small number of built-in extensions, which "
"you need not install, and which are automatically included if necessary. "
"'%S' has access to %d", proj->as_copy->edition->work->title, internals_installed);
int i = internals_installed, u = internals_used;
@<Say how many of those installed are used@>;
HTML_CLOSE("p");
if (nex > 0) {
if (externals_used > 0) {
HTML_OPEN("p");
HTML_TAG_WITH("img", LEGACY_AREA_SYMBOL);
WRITE("&nbsp;");
WRITE("And '%S' still uses %d extension%s from the legacy extensions area. Best "
"practice is to install %s into .materials instead, which the Inform app "
"can do for you.",
proj->as_copy->edition->work->title, nex, (nex==1)?"":"s", (nex==1)?"it":"them");
proj->as_copy->edition->work->title, externals_used, (externals_used==1)?"":"s", (externals_used==1)?"it":"them");
HTML_CLOSE("p");
}
@<Say how many of those installed are used@> =
if (u == 0) {
if (i == 1) {
WRITE(", but it doesn't use it.");
} else if (i == 2) {
WRITE(", but it doesn't use either of them.");
} else {
WRITE(", but it doesn't use any of them.");
}
} else if (u < i) {
WRITE(", but it uses only %d.", u);
} else if (u == 1) {
WRITE(", and it uses it.");
} else if (u == 2) {
WRITE(", and it uses both of them.");
} else {
WRITE(", and it uses all of them.");
}
@ The following is an alphabetised directory of extensions by author and then
title, along with some useful information about them, and then a list of
any oddities found in the external extensions area.
@ -323,14 +352,8 @@ the usual ones seen in Mac OS X applications such as iTunes.
HTML::begin_span(OUT, I"extensionindexentry");
if (d != SORT_CE_BY_AUTHOR) {
WRITE("%S", ecd->copy->edition->work->raw_title);
if (Str::len(ecd->copy->edition->work->raw_title) +
Str::len(ecd->copy->edition->work->raw_author_name) > 45) {
HTML_TAG("br");
WRITE("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
} else {
WRITE(" ");
}
WRITE("by %S", ecd->copy->edition->work->raw_author_name);
if (Nests::get_tag(ecd->nest) != INTERNAL_NEST_TAG)
WRITE(" by %S", ecd->copy->edition->work->raw_author_name);
} else {
WRITE("%S", ecd->copy->edition->work->raw_title);
}

View file

@ -1,50 +0,0 @@
Version 4 of Glulx Image Centering (for Glulx only) by Emily Short begins here.
"Glulx Image Centering adds the ability to display an image that is centered (left/right) on the screen."
Include Glulx Text Effects by Emily Short.
Table of User Styles (continued)
style name background color color first line indentation fixed width font weight indentation italic justification relative size reversed
special-style-1 -- -- -- -- -- -- -- center-justified -- --
To display (chosen figure - a figure-name) centered:
say first custom style; say " ";
display chosen figure inline;
say " [line break]";
say roman type;
To display (chosen figure - a figure-name) inline:
(- DrawInline({chosen figure}); -)
Include (-
[ DrawInline N;
glk_image_draw(gg_mainwin, ResourceIDsOfFigures-->N, imagealign_InlineUp, 0);
];
-)
Glulx Image Centering ends here.
---- Documentation ----
Glulx Image Centering adds the ability to display an image that is centered (left/right) on the screen. To do this, it uses up the first of the two available custom user text styles, defining it to be center-justified.
To invoke Glulx Image Centering, we say
display figure foo centered.
To display cover art in our game, we might include something like this:
Include Glulx Image Centering by Emily Short. Include Basic Screen Effects by Emily Short.
When play begins:
display figure of small cover centered;
pause the game.
This would display a picture in the middle of the screen, then wait for a keypress, then clear the screen before going on with the game.
A word of warning: not all Glulx interpreters will necessarily handle this operation correctly. Authors are advised to check the performance of their game on a variety of interpreters, or have their beta-testers do so.

View file

@ -1,387 +0,0 @@
Version 6 of Glulx Text Effects (for Glulx only) by Emily Short begins here.
"Gives control over text formatting in Glulx."
[ Rewritten by Dannii Willis. ]
Use authorial modesty.
Chapter - Specifying styles
[ It is important that the values be specified precisely in the following orders, because otherwise the I6 assumptions about the relation of named values to number constants will be wrong. ]
A glulx text style is a kind of value.
The glulx text styles are all-styles, normal-style, italic-style, fixed-letter-spacing-style, header-style, bold-style, alert-style, note-style, blockquote-style, input-style, special-style-1 and special-style-2.
A text justification is a kind of value.
The text justifications are left-justified, left-right-justified, center-justified, and right-justified.
A font weight is a kind of value.
The font weights are light-weight, regular-weight, and bold-weight.
Section - The Table of User Styles definition
[ This table is given its own section so that it can be replaced to add extra columns needed by other extensions (such as Flexible Windows) ]
Table of User Styles
style name (a glulx text style) background color (a text) color (a text) first line indentation (a number) fixed width (a truth state) font weight (a font weight) indentation (a number) italic (a truth state) justification (a text justification) relative size (a number) reversed (a truth state)
with 1 blank row
Chapter - Sorting the Table of User Styles
[ We sort the table of styles to combine style definitions together ]
Before starting the virtual machine (this is the sort the Table of User Styles rule):
[ First change empty style names to all-styles ]
repeat through the Table of User Styles:
if there is no style name entry:
now the style name entry is all-styles;
sort the Table of User Styles in style name order;
let row1 be 1;
let row2 be 2;
[ Overwrite the first row of each style with the specifications of subsequent rows of the style ]
while row2 <= the number of rows in the Table of User Styles:
choose row row2 in the Table of User Styles;
if there is a style name entry:
if (the style name in row row1 of the Table of User Styles) is the style name entry:
if there is a background color entry:
now the background color in row row1 of the Table of User Styles is the background color entry;
if there is a color entry:
now the color in row row1 of the Table of User Styles is the color entry;
if there is a first line indentation entry:
now the first line indentation in row row1 of the Table of User Styles is the first line indentation entry;
if there is a fixed width entry:
now the fixed width in row row1 of the Table of User Styles is the fixed width entry;
if there is a font weight entry:
now the font weight in row row1 of the Table of User Styles is the font weight entry;
if there is a indentation entry:
now the indentation in row row1 of the Table of User Styles is the indentation entry;
if there is a italic entry:
now the italic in row row1 of the Table of User Styles is the italic entry;
if there is a justification entry:
now the justification in row row1 of the Table of User Styles is the justification entry;
if there is a relative size entry:
now the relative size in row row1 of the Table of User Styles is the relative size entry;
if there is a reversed entry:
now the reversed in row row1 of the Table of User Styles is the reversed entry;
blank out the whole row;
otherwise:
now row1 is row2;
increment row2;
Chapter - Setting the styles - unindexed
Last before starting the virtual machine (this is the set text styles rule):
repeat through the Table of User Styles:
if there is a background color entry:
set the background color for the style name entry to the background color entry;
if there is a color entry:
set the color for the style name entry to the color entry;
if there is a first line indentation entry:
set the first line indentation for the style name entry to the first line indentation entry;
if there is a fixed width entry:
set fixed width for the style name entry to the fixed width entry;
if there is a font weight entry:
set the font weight for the style name entry to the font weight entry;
if there is a indentation entry:
set the indentation for the style name entry to the indentation entry;
if there is a italic entry:
set italic for the style name entry to the italic entry;
if there is a justification entry:
set the justification for the style name entry to the justification entry;
if there is a relative size entry:
set the relative size for the style name entry to the relative size entry;
if there is a reversed entry:
set reversed for the style name entry to the reversed entry;
To set the background color for (style - a glulx text style) to (N - a text):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_BackColor, GTE_ConvertColour( {N} ), (+ all-styles +) ); -).
To set the color for (style - a glulx text style) to (N - a text):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_TextColor, GTE_ConvertColour( {N} ), (+ all-styles +) ); -).
To set the first line indentation for (style - a glulx text style) to (N - a number):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_ParaIndentation, {N}, (+ all-styles +) ); -).
To set fixed width for (style - a glulx text style) to (N - truth state):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_Proportional, ( {N} + 1 ) % 2, (+ all-styles +) ); -).
To set the font weight for (style - a glulx text style) to (N - a font weight):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_Weight, {N} - 2, (+ all-styles +) ); -).
To set the indentation for (style - a glulx text style) to (N - a number):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_Indentation, {N}, (+ all-styles +) ); -).
To set italic for (style - a glulx text style) to (N - a truth state):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_Oblique, {N}, (+ all-styles +) ); -).
To set the justification for (style - a glulx text style) to (N - a text justification):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_Justification, {N} - 1, (+ all-styles +) ); -).
To set the relative size for (style - a glulx text style) to (N - a number):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_Size, {N}, (+ all-styles +) ); -).
To set reversed for (style - a glulx text style) to (N - a truth state):
(- GTE_SetStylehint( wintype_TextBuffer, {style}, stylehint_ReverseColor, {N}, (+ all-styles +) ); -).
Include (-
[ GTE_SetStylehint wintype style_to_set hint N all_styles i;
if ( style_to_set == all_styles )
{
for ( i = 0: i < style_NUMSTYLES : i++ )
{
glk_stylehint_set( wintype, i, hint, N );
}
}
else
{
glk_stylehint_set( wintype, style_to_set - 2, hint, N );
}
];
-).
[ Previously you would have to manually convert colours to their integer values, but in version 5 the extension will do it for you. Short (#FFF) web colours aren't supported. ]
Include (-
[ GTE_ConvertColour txt p1 cp1 dsize i ch progress;
! Transmute the text
cp1 = txt-->0;
p1 = TEXT_TY_Temporarily_Transmute( txt );
dsize = BlkValueLBCapacity( txt );
for ( i = 0 : i < dsize : i++ )
{
! Decode the hex characters
ch = BlkValueRead( txt, i );
if ( ch == 0 )
{
break;
}
else if ( ch > 47 && ch < 58 )
{
progress = progress * 16 + ch - 48;
}
else if ( ch > 64 && ch < 71 )
{
progress = progress * 16 + ch - 55;
}
else if ( ch > 96 && ch < 103 )
{
progress = progress * 16 + ch - 87;
}
}
! Clean up and return
TEXT_TY_Untransmute( txt, p1, cp1 );
return progress;
];
-).
Chapter - Additional style phrases
To say alert style:
(- glk_set_style( style_Alert ); -).
To say blockquote style:
(- glk_set_style( style_BlockQuote ); -).
To say header style:
(- glk_set_style( style_Header ); -).
To say input style:
(- glk_set_style( style_Input ); -).
To say note style:
(- glk_set_style( style_Note ); -).
To say special-style-1:
(- glk_set_style( style_User1 ); -).
To say special style 1:
(- glk_set_style( style_User1 ); -).
To say first special/custom style:
(- glk_set_style( style_User1 ); -).
To say special-style-2:
(- glk_set_style( style_User2 ); -).
To say special style 2:
(- glk_set_style( style_User2 ); -).
To say second special/custom style:
(- glk_set_style( style_User2 ); -).
Glulx Text Effects ends here.
---- Documentation ----
Glulx Text Effects provides an easy way to set up special text effects for Glulx.
Chapter: Styles in Glulx
Unlike the Z-Machine, which allows arbitrary combinations of features (such as color and boldness) to be applied to text, Glulx requires the author to define and then use text styles.
There are eleven of these styles:
Table of styles
normal-style the style used for regular text
italic-style used for italic text (this is what the "[italic type]" phrase uses)
bold-style used for bold text (this is what the "[bold type]" phrase uses)
fixed-letter-spacing-style used for monospaced text (this is what the "[fixed letter spacing]" phrase uses)
alert-style used when printing an end of game message such as "*** You have died. ***"
blockquote-style used for printing box quotations
header-style used to print the title of the game
input-style used for the player's own input
note-style used for messages such as "[Your score has increased by one point.]"
special-style-1 these two styles are not used by Inform, and you are free to use them for any purpose you want
special-style-2
Additionally, when defining styles you can set "all-styles" which will define all eleven styles at once.
Chapter: Style features
Each text style has the following features:
Table of style features
background color specifies the background color of the text
color specifies the color of the text itself
fixed width a truth state (default: false). If true then the text will be displayed with a fixed width (monospace) font
font weight specifies the weight of the font. Can be set to "light-weight", "regular-weight" (the default), or "bold-weight"
indentation a number (default: 0) specifying the number of units of indentation for the whole block of text. Units are defined by interpreter, but are often equivalent to spaces
first line indentation a number (default: 0) specifying additional indentation for the first line of the text block
italic a truth state (default: false). If true then the text will be displayed in italics
justification can be set to "left-justified", "center-justified", "right-justified", or "left-right-justified" for justified on the left and right (often called full justification)
relative size a number (default: 0) specifying how many font sizes above or below the browser's default a style should be set to
reversed a truth state (default: false). If true then the foreground and background colors of the text will be reversed. This is most commonly used for the status line
Not all interpreters support all of these features. Notably, Gargoyle does not support justification or font sizes. If the interpreter does not support one of the features it will just be quietly ignored.
Chapter: Defining styles
To define the features each style should have, add a table continuation to the Table of User Styles in your code. For example:
Table of User Styles (continued)
style name color italic relative size
all-styles "#FF0000" true --
header-style "#0000FF" false 1
special-style-1 "#00FF00"
This definition table above will make everything red and italics, except for the title which will be blue and a size bigger. Special style 1 is set to green, but it won't be used without the author manually turning it on.
Your table continuation does not need to include every column in the Table of User Styles, nor does it need to define every style. You can also continue the table multiple times, and even define a style in multiple places; if you do then the definitions will be combined together. If you do not want to set a feature for a style you can leave it blank with "--".
Colors are defined by specifying a web (CSS) color in a text. Web colors specify the red/green/blue components of a color in hexadecimal, and a correctly specified color will be 6 characters long (with an optional # at the beginning.) Note that short (#000) web colors are not supported.
If you use a color many times you can define it as a text constant, and then use that in the table:
Red is always "#FF0000".
Table of User Styles (continued)
style name color
special-style-1 red
Chapter: Using the styles
You may invoke the text styles by using the following phrases
Table of style phrases
normal-style "[roman type]"
italic-style "[italic type]"
bold-style "[bold type]"
fixed-letter-spacing-style "[fixed letter spacing]" (Return to regular variable spaced type with either "[variable letter spacing]" or just "[roman type]")
alert-style "[alert style]"
blockquote-style "[blockquote style]"
header-style "[header style]"
input-style "[input style]"
note-style "[note style]"
special-style-1 "[special-style-1]", "[first special style]", or "[first custom style]" (there are multiple options to support older code)
special-style-2 "[special-style-2]", "[second special style]", or "[second custom style]"
Chapter: About this extension
This extension was originally by Emily Short. Version 5 was rewritten by Dannii Willis.
The latest version of this extension can be found at <https://github.com/i7/extensions>. This extension is released under the Creative Commons Attribution licence. Bug reports, feature requests or questions can be made at <https://github.com/i7/extensions/issues>.
Example: * Gaudy - A visually overpowering exercise in modifying all the built-in text styles.
*: "Gaudy"
Include Version 5 of Glulx Text Effects by Emily Short.
Use scoring.
Texty Room is a room. "This is a room of [bold type]bold[roman type] and [italic type]italic[roman type] texts as well as messages in [fixed letter spacing]fixed width[variable letter spacing] text."
Table of User Styles (continued)
style name relative size color background color
italic-style -1 "#0000FF" [ blue ] --
fixed-letter-spacing-style -- "#444444" [ dark-grey ] --
header-style 10 -- --
bold-style 2 "#888888" [ medium-grey ] "#80DAEB"
alert-style 5 "#FF0000" [ red ]
note-style -- "#00FF00" [ green ]
blockquote-style -- "#FFFF00" [ yellow ]
input-style -1 "#FF00FF" [ magenta ]
Instead of waiting:
increase the score by 5.
Instead of jumping:
end the story finally.
Every turn:
display the boxed quotation "Tempus fugit."
Test me with "z / z / z / jump".
Example: ** The Gallic War - An excuse to print a large, fancily-formatted bit of text using custom styles.
*: "The Gallic War" by Julius Caesar.
The story headline is "An interactive campaign".
Lessons is a room.
Include Glulx Text Effects by Emily Short.
Include Basic Screen Effects by Emily Short.
Table of User Styles (continued)
style name justification italic indentation first line indentation font weight color
special-style-2 left-right-justified true 15 -4 light-weight "#888888" [ medium-grey ]
When play begins:
now the left hand status line is "";
now right hand status line is "";
say "[second custom style]Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani, tertiam qui ipsorum lingua Celtae, nostra Galli appellantur. Hi omnes lingua, institutis, legibus inter se differunt. Gallos ab Aquitanis Garumna flumen, a Belgis Matrona et Sequana dividit.
Horum omnium fortissimi sunt Belgae, propterea quod a cultu atque humanitate provinciae longissime absunt, minimeque ad eos mercatores saepe commeant atque ea quae ad effeminandos animos pertinent important, proximique sunt Germanis, qui trans Rhenum incolunt, quibuscum continenter bellum gerunt. Qua de causa Helvetii quoque reliquos Gallos virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, cum aut suis finibus eos prohibent aut ipsi in eorum finibus bellum gerunt.";
pause the game;
say roman type;
now the left hand status line is "[location]";
now the right hand status line is "[turn count]".
Bank of the Garumna is a room.

View file

@ -1,58 +0,0 @@
Version 2 of Inanimate Listeners by Emily Short begins here.
"Allows the player to address inanimate objects such as a talking computer, microphone, or telephone in a form such as ASK COMPUTER ABOUT COORDINATES."
Use authorial modesty.
A thing can be addressable. The addressable property is defined by Inter as "talkable".
Persuasion rule for asking an addressable thing (called the target) to try doing something (this is the unsuccessful persuasion of inanimate objects rule):
if the target is a person or the target is not addressable:
make no decision;
say "[The target] [cannot] do everything a person can." (A).
Inanimate Listeners ends here.
---- Documentation ----
Ordinarily, if the player tries to speak to an inanimate object, he receives a response such as "You can only do that to something animate."
Sometimes, however, we'd like to have an item in the game that is not a person but still responds to queries -- much like the shipboard computer on Star Trek.
"Inanimate Listeners" allows us to declare any objects to be addressable, as in
The computer is an addressable scenery thing in the Bridge.
Once this is done, the player can ask questions or make remarks to the computer, which we can then handle in the same way we might handle remarks made to a non-player character.
By default, a persuasion rule also prevents us from ordering inanimate objects to do a full range of actions; the player will receive a response like this:
>computer, n
The computer cannot do everything a person can.
If we wish to remove this, we need to use the following line:
*: The unsuccessful persuasion of inanimate objects rule is not listed in any rulebook.
We can then substitute our own persuasion rules allowing the inanimate item to do specific actions.
Example: * Command Chair - A computer that answers questions and responds to comments.
*: "Command Chair"
Include Inanimate Listeners by Emily Short.
Bridge is a room. "Beeping and blinking, the computer awaits your instructions and requests."
The computer is an addressable scenery thing in the Bridge.
Instead of asking the computer about "coordinates": say "'Our coordinates are 3,4,5.'"
Instead of telling the computer about "coordinates": say "'Space is surprisingly small,' you tell the computer. [paragraph break]'Parse not found,' the computer complains."
The command chair is an enterable supporter in the Bridge. The player is on the command chair.
Test me with "ask computer about coordinates / tell computer about coordinates / computer, n / ask chair about coordinates".

View file

@ -1,384 +0,0 @@
Version 6 of Punctuation Removal by Emily Short begins here.
Use authorial modesty.
Section 1 - Wrappers
To remove stray punctuation:
(- PunctuationStripping(); players_command = 100 + WordCount(); -)
To remove quotes:
(- QuoteStripping(); players_command = 100 + WordCount(); -)
To remove apostrophes:
(- SingleQuoteStripping(); players_command = 100 + WordCount(); -)
To remove question marks:
(- QuestionStripping(); players_command = 100 + WordCount(); -)
To remove exclamation points:
(- ExclamationStripping(); players_command = 100 + WordCount(); -)
To remove periods:
(- PeriodStripping(); players_command = 100 + WordCount(); -)
To resolve punctuated titles:
(- DeTitler(); players_command = 100 + WordCount(); -)
Section 2 (for Z-machine only)
Include (-
[ DeTitler i j buffer_length flag;
buffer_length = buffer->1+(WORDSIZE-1);
for (i = WORDSIZE : i <= buffer_length: i++)
{
if ((buffer->i) == '.' && (i > WORDSIZE + 1))
{
! flag if the period follows Mr, Mrs, Dr, prof, rev, or st
!
! This is hackish, but our hearts are pure
if ((buffer->(i-1)=='r') && (buffer->(i-2)=='m') && ((buffer->(i-3)==' ') || ((i-3) < WORDSIZE))) flag = 1;
if ((buffer->(i-1)=='r') && (buffer->(i-2)=='d') && ((buffer->(i-3)==' ') || ((i-3) < WORDSIZE))) flag = 1;
if ((buffer->(i-1)=='t') && (buffer->(i-2)=='s') && ((buffer->(i-3)==' ') || ((i-3) < WORDSIZE))) flag = 1;
if ((buffer->(i-1)=='s') && (buffer->(i-2)=='r') && (buffer->(i-3)=='m') && ((buffer->(i-4)==' ') || ((i-4) < WORDSIZE))) flag = 1;
if ((buffer->(i-1)=='v') && (buffer->(i-2)=='e') && (buffer->(i-3)=='r') && ((buffer->(i-4)==' ') || ((i-4) < WORDSIZE))) flag = 1;
if ((buffer->(i-1)=='f') && (buffer->(i-2)=='o') && (buffer->(i-3)=='r') && (buffer->(i-4)=='p') && ((buffer->(i-5)==' ') || ((i-5) < WORDSIZE))) flag = 1;
if (flag) buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ PunctuationStripping i;
for (i = 2 : i <= (buffer->1) + 1 : i++)
{
if ((buffer->i) == '"' or '?' or '!')
{ buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ SingleQuoteStripping i;
for (i = 2 : i <= (buffer->1) + 1 : i++)
{
if ((buffer->i) == 39)
{ buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ QuoteStripping i;
for (i = 2 : i <= (buffer->1) + 1 : i++)
{
if ((buffer->i) == '"')
{ buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ QuestionStripping i;
for (i = 2 : i <= (buffer->1) + 1 : i++)
{
if ((buffer->i) == '?')
{ buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ ExclamationStripping i;
for (i = 2 : i <= (buffer->1) + 1 : i++)
{
if ((buffer->i) == '!')
{ buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ PeriodStripping i j;
for (i = 2 : i <= (buffer->1) + 1 : i++)
{
if ((buffer->i) == '.')
{ buffer->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Section 3 (for Glulx only)
Include (-
[ DeTitler i j buffer_length flag;
buffer_length = (buffer-->0)+1;
for (i = 1 : i <= buffer_length: i++)
{
if ((buffer-->i) == '.' && (i > 1))
{
! flag if the period follows Mr, Mrs, Dr, prof, rev, or st
!
! This is hackish, but our hearts are pure
if ((buffer-->(i-1)=='r') && (buffer-->(i-2)=='m') && ((buffer-->(i-3)==' ') || ((i-3) < 1))) flag = 1;
if ((buffer-->(i-1)=='r') && (buffer-->(i-2)=='d') && ((buffer-->(i-3)==' ') || ((i-3) < 1))) flag = 1;
if ((buffer-->(i-1)=='t') && (buffer-->(i-2)=='s') && ((buffer-->(i-3)==' ') || ((i-3) < 1))) flag = 1;
if ((buffer-->(i-1)=='s') && (buffer-->(i-2)=='r') && (buffer-->(i-3)=='m') && ((buffer-->(i-4)==' ') || ((i-4) < 1))) flag = 1;
if ((buffer-->(i-1)=='v') && (buffer-->(i-2)=='e') && (buffer-->(i-3)=='r') && ((buffer-->(i-4)==' ') || ((i-4) < 1))) flag = 1;
if ((buffer-->(i-1)=='f') && (buffer-->(i-2)=='o') && (buffer-->(i-3)=='r') && (buffer-->(i-4)=='p') && ((buffer-->(i-5)==' ') || ((i-5) < 1))) flag = 1;
if (flag) buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ BufferOut i;
for (i = 1 : i <= (buffer-->0) : i++)
{
print (char) (buffer-->i);
}
];
[ PunctuationStripping i;
for (i = 1 : i <= (buffer-->0) : i++)
{
if ((buffer-->i) == '"' or '?' or '!')
{ buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ SingleQuoteStripping i;
for (i = 1 : i <= (buffer-->0) : i++) {
if ((buffer-->i) == 39)
{ buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
[ QuoteStripping i;
for (i = 1 : i <= (buffer-->0) : i++) {
if ((buffer-->i) == '"')
{ buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ QuestionStripping i;
for (i = 1 : i <= (buffer-->0) : i++)
{
if ((buffer-->i) == '?')
{ buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ ExclamationStripping i;
for (i = 1 : i <= (buffer-->0) : i++)
{
if ((buffer-->i) == '!')
{ buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Include (-
[ PeriodStripping i j;
for (i = 1 : i <= (buffer-->0) : i++)
{
if ((buffer-->i) == '.')
{ buffer-->i = ' ';
}
}
VM_Tokenise(buffer, parse);
];
-)
Punctuation Removal ends here.
---- DOCUMENTATION ----
Punctuation Removal provides phrases for removing unwanted punctuation marks from the player's command before attempting to interpret it. These are
remove exclamation points
remove question marks
remove quotes
and, to do all three of these things at once,
remove stray punctuation.
Also provided, but not included in "remove stray punctuation", is
remove periods
which we should use sparingly, since the player's command might reasonably include multiple actions separated by full stops. Similarly dangerous is
remove apostrophes
A more common need is to be able to parse titles such as "mr." and "mrs." sensibly. Inform reads any full stop as the end of the sentence, which leads to such exchanges as
>x mr. sinister.
You see nothing special about Mr. Sinister.
That's not a verb I recognise.
because Inform has interpreted as though the player had typed
>x mr.
You see nothing special about Mr. Sinister.
>sinister
That's not a verb I recognise.
To get around this, we want to remove full stops only when they appear as parts of standard titles. "Punctuation Removal" provides the phrase
resolve punctuated titles
which turns all instances in the player's command of "mr.", "mrs.", "prof.", "st.", "dr.", and "rev." into "mr", "mrs", "prof", "st", "dr", and "rev" respectively. Now (assuming Inform understands "mr" as referring to the correct character) we get such output as
>x me. x mr. sinister.
As good-looking as ever.
You see nothing special about Mr. Sinister.
These phrases should be used during the After reading a command activity, so for instance in a game designed to be very patient with the player's quirks:
After reading a command:
remove stray punctuation.
Or, if we have titled characters,
After reading a command:
resolve punctuated titles.
Example: * Patience - In which question and exclamation marks are pulled from the player's input.
*: "Patience"
Include Punctuation Removal by Emily Short.
The Overpunctuation Arena is a room. "It's madness in here!! Fortunately, you have a lot of patience, right???"
Understand "who is/are [text]" as inquiring about. Inquiring about is an action applying to one topic. Carry out inquiring about a topic listed in the Table of Answers: say "[reply entry][paragraph break]". Understand the command "what" as "who".
Table of Answers
topic reply
"patience" "A virtue."
"virtue" or "a virtue" "A grace."
"Grace" or "a grace" "A little girl who doesn't wash her face."
After reading a command:
remove stray punctuation;
if the player's command includes "&", replace the matched text with "and".
Test me with "what is patience? / what is a virtue?! / what is grace???"
Example: * Abbreviation - In which titles such as Mr. and Dr. are correctly parsed.
*: "Abbreviation"
Include Punctuation Removal by Emily Short.
Test me with "x me / x me. x mr. Sinister. / x rev. carl / x mrs. grey / x st. thomas / x prof. green / rev. carl, hello / rev., hello / specialist, hello / x specialist. x st. Aquinas. / x st. x me"
The Ecumenical Rod & Gun Club of Seventh Saint is a room. Mr Sinister is a man in Club. The printed name of Mr Sinister is "Mr. Sinister".
Reverend Carl is a man in Club. The printed name of Reverend Carl is "Rev. Carl". Understand "rev" as Reverend Carl.
St Thomas Aquinas is a man in Club. Understand "saint" as Thomas. The printed name of Aquinas is "St. Thomas Aquinas".
Mrs Grey is a woman in Club. The printed name of Grey is "Mrs. Grey".
Professor Green is a man in Club. The printed name of Green is "Prof. Green". Understand "prof" as professor.
Specialist Joan is a woman in the Club.
After reading a command: resolve punctuated titles.
Example: ** Ownership - In which commands like EXAMINE JACK'S TIE are understood if Jack is wearing a tie, and otherwise not.
The trick here is that we want to write
Understand "[something related by reversed possession]'s" as a thing.
but this won't work, because Inform can't glue a token to an additional following set of characters. If, however, we make the apostrophe go away, we can match "[something related by reversed possession] s" -- an odd phrase, but one which the player is unlikely to type on his own in any other context:
*: "Ownership"
Include Punctuation Removal by Emily Short.
Understand "[something related by reversed possession] s" as a thing.
Jack wears a tie. Jack is in the Turret. The Turret is a room.
After reading a command:
remove apostrophes.
Test me with "x jack's tie".
Note, though, that this kind of gambit should really be used cautiously and with awareness of what else the game is doing. If there are cases where the player should be using apostrophes, we'll want to write more restrictive rules about when to strip them away.

View file

@ -1,99 +0,0 @@
Version 1 of Skeleton Keys by Emily Short begins here.
Section 1 - Multiple locking (in place of Section 9 - Lockability in Standard Rules by Graham Nelson)
A door can be lockable. A door is usually not lockable.
A door can be locked or unlocked. A door is usually unlocked.
A door has an object called a matching key.
A locked door is usually lockable. [An implication.]
A locked door is usually closed. [An implication.]
A lockable door is usually openable. [An implication.]
A container can be lockable. A container is usually not lockable.
A container can be locked or unlocked. A container is usually unlocked.
A container has an object called a matching key.
A locked container is usually lockable. [An implication.]
A locked container is usually closed. [An implication.]
A lockable container is usually openable. [An implication.]
Lock-fitting relates various things to various things.
The verb to unlock (it unlocks, they unlock, it unlocked, it is unlocked) means
the lock-fitting relation.
Section 2 - (for use without Locksmith by Emily Short)
To fit is a verb.
The right second rule is listed instead of the can't unlock without the
correct key rule in the check unlocking it with rulebook.
The right second rule is listed instead of the can't lock without the correct
key rule in the check locking it with rulebook.
This is the right second rule:
if the actor does not carry the second noun:
if the actor is the player:
say "[We]['re not] carrying [the second noun]." (A) instead;
stop the action;
if the second noun does not unlock the noun:
say "[The second noun] [do not fit] [the noun]." (B) instead.
Skeleton Keys ends here.
---- DOCUMENTATION ----
This extension replaces the default behavior of Inform, which allows one key per lock, with a more generous system in which unlocking applies to multiple objects. That means that it is possible to write a skeleton key like so:
Every door is unlocked by the skeleton key.
Because it is possible for more than one key to unlock a given door, the property "matching key" is now meaningless.
The drawback to this arrangement is that it adds more information to every item in the game, which will mean using up several K of dynamic memory. This is not important when compiling to Glulx, but may be problematic for projects targeting the Z-machine.
Skeleton Keys is compatible with, but does not require, Locksmith by Emily Short.
Example: * Vault - Demonstration of a simple skeleton key.
*: "Vault"
Include Skeleton Keys by Emily Short.
The Vault is a room.
The player carries a casket and a box. The casket is a closed locked container. The box is a closed locked container.
The player carries a silver key. Everything is unlocked by the silver key.
Test me with "unlock casket with silver / unlock box with silver key / open casket / i / lock casket with silver / close casket / lock casket with silver".
Example: * Cereal Bar Revisited - Demonstrating compatibility with Locksmith.
*: "Cereal Bar Revisited"
Include Locksmith by Emily Short. Include Skeleton Keys by Emily Short.
The player carries a passkey called the tin key. The tin key unlocks the tin box. The tin box is closed, openable, lockable, and locked. In the box is a single Cheerio.
Cereality is a room. "The newly-opened 'cereal bar' allows you to mix and match cereal types at will." The box is in Cereality.
The passkey description rule is not listed in any rulebook.
The description of a passkey is usually "[if the item described unbolts something][The item described] unlocks [the list of things unbolted by the item described][otherwise]You have yet to discover what [the item described] unlocks[end if]."
The player carries a skeleton key. Every thing is unlocked by the skeleton key.
Test me with "i / x key / unlock box / i / x key".

View file

@ -1,153 +0,0 @@
Version 9 of Epistemology by Eric Eve begins here.
"Keeping track of what the player character knows and sees."
Book 1 - Sight
A thing can be either seen or unseen. A thing is usually unseen.
[It might seem more straightforward simply to write "Now everything visible in
the location is seen." but this turns out to be unacceptably slow in practice.
The following code does approximately the same thing but much faster.]
Carry out looking (this is the mark items as seen when looking rule):
unless in darkness:
now every backdrop in the location is seen;
repeat with item running through things that are enclosed by the location:
if the item is not enclosed by an opaque closed container:
now the item is familiar;
now the item is seen.
Carry out opening a container (this is the mark items as seen on opening a container rule):
repeat with item running through things that are enclosed by the noun:
if the item is unseen and the item is visible:
now the item is familiar;
now the item is seen.
The mark items as seen on opening a container rule is listed after the
standard opening rule in the carry out opening rules.
Book 2 - Familiarity
Chapter 1 - Basic Familiarity
A thing can be familiar or unfamiliar. A thing is usually unfamiliar.
Carry out examining something visible (this is the mark items as seen on examining rule):
now the noun is familiar;
now the noun is seen.
Definition: a thing is known if it is familiar or it is seen.
Definition: a thing is unknown if it is not known.
Chapter 2 - Subject (for use without Threaded Conversation by Emily Short)
A subject is a kind of thing. The specification of a subject is "Something
that conversations can refer to, but which has no real-world presence or
functionality."
Chapter 3 - Familiarity of Subjects
A subject is usually familiar.
Book 3 - Testing commands - not for release
Requesting epistemic status of is an action out of world applying to one visible thing.
Understand "epistat [any thing]" as requesting epistemic status of.
Report requesting epistemic status of (this is the report epistemic status rule):
say "[noun] - [if the noun is seen]seen[otherwise]unseen[end if] /
[if the noun is familiar]familiar[otherwise]unfamiliar[end if] /
[if the noun is known]known[otherwise]unknown[end if]." (A).
Epistemology ends here.
---- DOCUMENTATION ----
The purpose of this extension is to keep track of what objects the player character knows about, either because s/he has seen them, or because they are already familiar for some other reason. It is not intended as a way to track NPC knowledge, which might be better implemented using a system of relations.
When the Epistemology extension is used all game objects are either seen or unseen, either familiar or unfamiliar, and either known or unknown. By default, all objects start unseen and unfamiliar, and hence unknown (although we can of course change this for indivdual objects, groups of objects or kinds). The seen/unseen and familiar/unfamiliar pairs can be tested or set as requires. The known/unknown status may be tested but not directly changed in code, since it derives from the other two: a thing is considered to be known if it is either seen or familiar; otherwise it is unknown.
These distinctions are maintained since the player character may well know about things he or she is yet to see (such as the Magical Golden Golf Ball of Destiny that she has been sent to recover) or are which are in any case unseeable (such as love, freedom, democracy and inflation) which may nevertheless be the subject of conversation or thoughts. Things that are known about but as yet unseen or entities that are abstract can be marked as familiar, either from the outset, or when the player learns about them during the course of the game. Also, there may be cases where it's important to distinguish whether the player character has actually seen the Golden Golf Ball (say) or merely knows about it.
The new kind called subject is provided for more abstract objects such as love and atomic physics. Unlike other things, subjects are considered familiar by default.
As far as possible, the extension tries to keep track of what the player character has seen, first by marking as seen (and familiar) everything that's in plain view in the location when a LOOK command is executed, and second eveything in plain view within a container when that container is opened. The algorithm for doing this may be less than perfect (in the interests of acceptable speed), and there will be cases that it does not cover (for example when an object is moved into the location to simulate its being found under the rug); in such cases it will be necessary explicitly to change the newly-arrived object to seen in our code (if we need to keep track of it).
This extension also marks an object as both seen and familiar when it is examined (which should catch most, if not all, the cases not already covered).
Finally, the testing command EPISTAT X (not for release) is provided to aid testing and debugging games using this extension. For example the command EPISTAT GOLD BALL will show whether the gold ball is seen, familiar or known. This may be useful to help track whether the epistemic status of various objects in our game is actually what we think it should be. EPISTAT (derived from EPIstemic STAtus) is indeed a nasty non-word, but it has the merits of being (a) reasonably brief, (b) acceptably memorable and (c) unlikely to clash with any verbs defined in-game.
(With thanks to Aaron Reed for suggesting some optimization, which also led me to spot a bug.)
Example: * Contemplation - Thinking about things that are known
*: "Contemplation"
Include Epistemology by Eric Eve.
Part 1 - Thought Mechanics
Thinking about is an action applying to one visible thing.
Understand "think about [any thing]" as thinking about.
Understand "think about [any known thing]" as thinking about.
Report thinking about something unknown:
say "[no thoughts]"
Report thinking about something known:
say "[the thought of the noun][paragraph break]"
A thing has a text called thought.
Pondering is an action applying to one topic.
Understand "think about [text]" as pondering. [otherwise we get an ugly response to THINK ABOUT FOO etc.]
Report pondering:
say "[no thoughts]"
To say no thoughts:
say "You have no thoughts on that subject right now."
Part 2 - Scenario
The Study is a Room. "You deliberately keep this room as bare as possible, to prevent material objects distracting you from your thoughts. The two essential objects that remain are a comfortable armchair and the door out into the hall to the west."
The comfortable armchair is an enterable scenery supporter in the Study. The description is "It's nothing special, but it looks comfortable enough." The thought is "You think it's a good place to sit and think."
Understand "arm" or "chair" as the comfortable armchair.
The hall door is an open openable scenery door. The hall door is west of the Study and east of the Main Hall. The thought is "Useful things, doors, you muse: without them it would be so much harder to get from room to room."
The Main Hall is a Room. "This place is almost as sparsely furnished as the Study which lies to the east."
The large oak table is a supporter in the Main Hall. "A large oak table abuts one wall." The thought is "You've never given this table much thought, to be honest -- it's just a table, after all."
A note is on the large oak table. The description of the note is "The note reads: 'To find fame, love, and everlasting happiness, you need to go on the quest of the Great Golden Golf Ball of Destiny.'"
The thought of the note is "You [if we have examined the note]think it contains an interesting proposition[otherwise]wonder what it says[end if]. "
Carry out examining the note: now the Great Golden Golf Ball of Destiny is familiar.
Life is a subject. The thought is "You think [if the golden golf ball is familiar]it has just become a whole lot more interesting[otherwise]it's preferable to the alternative[end if]. "
Liberty is a subject. The thought is "It's a fine word -- but a slippery concept."
Understand "freedom" as liberty.
Love is a subject. The thought is "You [if we have examined the note]think it might be worth questing to find it[otherwise]wonder where it is to be found[end if]. "
Understand "fame" or "everlasting" or "happiness" as love.
The Great Golden Golf Ball of Destiny is a thing. The thought is "You wonder what kind of object it can be to offer so much."
There is an open container called the red box on the large oak table.
The red ball is in the red box.
There is a closed openable container called the green box on the large oak table.
The green ball is in the green box.
Test me with "think about love/think about door/think about golden ball/think about note/think about table/think about life/epistat red ball/epistat green ball/w/think about table/think about note/read note/think about note/think about love/think about golden ball/think about life/epistat golden ball/epistat red ball/epistat green ball/open green box/epistat green ball".

View file

@ -1,671 +0,0 @@
Version 1 of Approximate Metric Units (for Glulx only) by Graham Nelson begins here.
"Scientific kinds of value for simulations. Use Metric Units instead for better accuracy."
Use authorial modesty.
Part I - SI Base Units
Length is a kind of value.
The specification of length is "Used to measure heights, widths, distances,
thicknesses and so on. Inform measures down to about the thickness of the
metal in a paper clip, or up to about the length of the GR5 trail from
Holland to the Mediterranean."
1m (in metric units, in m) or 1 meter (in meters, singular) or 1 metre
(in metres, singular) or 2 meters (in meters, plural) or 2 metres (in
metres, plural) specifies a length.
1mm (in metric units, in mm) or 1 millimeter (in millimeters,
singular) or 1 millimetre (in millimetres, singular) or 2 millimeters
(in millimeters, plural) or 2 millimetres (in millimetres, plural)
specifies a length scaled down by 1000.
1cm (in metric units, in cm) or 1 centimeter (in centimeters,
singular) or 1 centimetre (in centimetres, singular) or 2 centimeters
(in centimeters, plural) or 2 centimetres (in centimetres, plural)
specifies a length scaled down by 100.
1km (in metric units, in km) or 1 kilometer (in kilometers, singular)
or 1 kilometre (in kilometres, singular) or 2 kilometers (in
kilometers, plural) or 2 kilometres (in kilometres, plural) specifies
a length scaled up by 1000.
Mass is a kind of value.
The specification of mass is "Used to measure how much of something is
present. Start fights with other nerds by deliberately mixing this up with
weight, which comes to the same thing for everyday purposes at ground level.
Inform measures down to about the weight of a paper clip, or up to about
the weight of the Space Shuttle stack at liftoff (including fuel
tanks, rocket boosters and fuel)."
1kg (in metric units, in kg) or 1 kilogram (in kilograms, singular) or
2 kilograms (in kilograms, plural) specifies a mass.
1g (in metric units, in g) or 1 gram (in grams, singular) or 2 grams
(in grams, plural) specifies a mass scaled down by 1000.
1 tonne (in metric units, in tonnes, singular) or 2 tonnes (in metric units,
in tonnes, plural) specifies a mass scaled up by 1000.
Elapsed time is a kind of value.
The specification of elapsed time is "Used to measure how much time something takes.
Inform already has a built-in kind of value called 'time', which counts in
minutes and keeps track of the time of day - which is fine for most stories,
but not good enough for science. So we call this more precise version
'elapsed time'. It measures down to one jiffy (0.01s), briefer than one frame
of a Hollywood movie, or up to about nine months, the time it takes for
a child to be conceived and born."
1s (in metric units, in s) or 1 second (in seconds, singular) or 2 seconds
(in seconds, plural) specifies an elapsed time scaled at 100.
1 min (in metric units, in min) specifies an elapsed time scaled up by 60.
1 hr (in metric units, in hr) specifies an elapsed time scaled up by 3600.
1 day (in metric units, in days, singular) or 2 days (in metric units,
in days, plural) specifies an elapsed time scaled up by 86400.
1 week (in metric units, in weeks, singular) or 2 weeks (in metric units,
in weeks, plural) specifies an elapsed time scaled up by 604800.
Electric current is a kind of value.
The specification of electric current is "Used to measure the amount of
electricity flowing through something at any given moment. It measures down to
1mA, roughly the tiniest amount of current which human skin can feel at
all, and right up to the current in a really strong lightning bolt, which
the human skin would probably not have time to feel. (Actually, 100mA or
0.1A is enough to make a fatal shock; electric eels produce about 70mA,
which humans can just about survive.)"
1A (in metric units, in A) or 1 amp (in amps, singular) or 2 amps
(in amps, plural) specifies an electric current.
1mA (in metric units, in mA) or 1 milliamp (in milliamps, singular) or
2 milliamps (in milliamps, plural) specifies an electric current scaled
down by 1000.
Temperature is a kind of value.
The specification of temperature is "Used to measure how hot or cold
something is. Inform measures down to thousandths of a degree centigrade
and can hold a range from liquid helium (just above absolute zero, which is
-273.15C) up to several hundred times hotter than the surface of the Sun
(5800C). Water freezes and boils at 0C and 100C respectively. SI officially
uses degrees Kelvin, not centigrade, but for human situations centigrade is
more convenient, and it amounts to the same thing in most calculations
since the two scales are identical except for their start point. Antarctica
has been recorded at -89C, the Libyan desert at 58C, but the average
surface temperature on Earth is 15C. (Note that Inform writes '1 C' for one
coulomb, and '1C' for one degree centigrade.)"
1C (in metric units, in C) or 1 degree centigrade (in degrees centigrade, singular)
or 2 degrees centigrade (in degrees centigrade, plural) or 1 degree Celsius
(in degrees Celsius, singular) or 2 degrees Celsius (in degrees Celsius, plural)
specifies a temperature scaled at 1000.
Luminosity is a kind of value.
The specification of luminosity is "Used to measure the total amount of
light. (This is not quite the same thing as brightness - that's the amount
of light produced per unit of area, and is called luminance.) Candela is a
term adopted in 1948 to replace the old 'candlepower', but 1 cd remains
about the light of a single candle. A strong light-bulb produces about 100
cd. Inform measures down to a thousandth of a candela, the light from a
very small indicator LED, and up to about the light from the traditional
Blackpool Illuminations. (It's all lasers, low-power bulbs and
carbon-neutral turbines today, but it used to be done with about 20,000
ordinary light bulbs.)"
1 cd (in metric units, in cd) or 1 candela (in candelas, singular) or 2 candelas
(in candelas, plural) specifies a luminosity scaled at 1000.
[There is also the mole, an amount of substance, as used in chemistry.]
Part II - SI Derived Units
Angle is a kind of value.
The specification of angle is "Used to measure a proportion of a complete
circle of turning. Properly speaking the SI unit for angle is the radian, but
though mathematically elegant this is not very convenient for computer use,
so Inform uses degrees: there are 360 degrees in a circle, 60 arc-minutes in
each degree, 60 arc-seconds in each arc-minute. An arc-minute is already very
small - it's about the width of a coin seen from 100m away. (American gun
manufacturers use the term MOA, 'minute of arc', to measure accuracy.) So
Inform measures down to the width of a coin seen from 6km away."
1 deg (in metric units, in deg) or 1 degree (in degrees, singular) or 2 degrees
(in degrees, plural) specifies an angle.
1 arcmin (in metric units, in arcmin) or 1 arc-minute (in arc-minutes, singular)
or 2 arc-minutes (in arc-minutes, plural) specifies an angle scaled down by 60.
1 arcsec (in metric units, in arcsec) or 1 arc-second (in arc-seconds, singular)
or 2 arc-seconds (in arc-seconds, plural) specifies an angle scaled down by 3600.
Length times angle specifies a length.
Frequency is a kind of value.
The specification of frequency is "Used to measure how often a series of events
takes place, with 1 Hertz meaning once per second. Inform measures down to
1 mHz, which is about the frequency of a bus arriving at an urban stop in
daytime, and up to about 2000 kHz. This isn't all that high in the world of
telecommunications, where the 'events' are peaks of radio waves - FM radio
broadcasts at higher frequencies - but Inform's units are designed for human
situations. Human eyes can't detect flickering faster than around 100 Hz, which is
why high-end television sets refresh at about that rate."
1 Hz (in metric units, in Hz) or 1 Hertz (in Hertz) specifies
a frequency.
1 mHz (in metric units, in mHz) or 1 millihertz (in millihertz)
specifies a frequency scaled down by 1000.
1 kHz (in metric units, in kHz) or 1 kilohertz (in kilohertz)
specifies a frequency scaled up by 1000.
Elapsed time times frequency specifies a number.
Force is a kind of value.
1N (in metric units, in N) or 1 Newton (in Newtons, singular) or 2 Newtons
(in Newtons, plural) specifies a force scaled at 1000.
1kN (in metric units, in kN) or 1 kilonewton (in kilonewtons, singular) or 2 kilonewtons
(in kilonewtons, plural) specifies a force scaled up by 1000.
The specification of force is "Used to measure how much push or pull is
needed to make something move (properly speaking, accelerate). 1N is about
the force of Earth's gravity acting on a typical apple. Inform measures
down to 0.001N, a tug which would barely make a small stone move in any
visible way. A climber's rope will typically break under a force of about
20kN, or half that if it's knotted. (Stylishly if bizarrely, some people
call the kilonewton the 'sthène', but Inform doesn't.) Inform goes up to
over 2000kN, roughly the thrust of one of the Space Shuttle Main Engines,
which is about the most violent machine ever built."
Energy is a kind of value.
1J (in metric units, in J) or 1 Joule (in Joules, singular) or 2 Joules
(in Joules, plural) specifies an energy.
1mJ (in metric units, in mJ) or 1 millijoule (in millijoules, singular) or 2 millijoules
(in millijoules, plural) specifies an energy scaled down by 1000.
1kJ (in metric units, in kJ) or 1 kilojoule (in kilojoules, singular) or 2 kilojoules
(in kilojoules, plural) specifies an energy scaled up by 1000.
The specification of energy is "Used to measure how much ability something
has to do work. Inform measures down to 1mJ, which is a tiny amount: human
beings give off about 100J in body heat every second just sitting still.
It measures up to about 2000kJ, twice the food energy stored in a Mars bar, or
enough to run a typical electric radiant heater for an hour."
Force times length specifies an energy.
Pressure is a kind of value.
1Pa (in metric units, in Pa) or 1 Pascal (in Pascals, singular) or 2 Pascals
(in Pascals, plural) specifies a pressure.
1kPa (in metric units, in kPa) or 1 kilopascal (in kilopascals, singular) or 2 kilopascals
(in kilopascals, plural) specifies a pressure scaled up by 1000.
1MPa (in metric units, in MPa) or 1 megapascal (in megapascals, singular) or 2 megapascals
(in megapascals, plural) specifies a pressure scaled up by 1000000.
The specification of pressure is "Used to measure how much force is being
applied per unit of area, sometimes by one object pulled against another,
sometimes by gas or water pressing in on things inside it. Inform measures
down to 1Pa, the tiny pressure which a bank note applies to a table it's
sitting on top of, and right up to 20000MPa, which can compress carbon into
diamonds. Atmospheric pressure at sea level is about 100kPa; water pressure
at the bottom of the Mariana Trench a thousand times greater, at about
100MPa."
Power is a kind of value.
1W (in metric units, in W) or 1 Watt (in Watts, singular) or 2 Watts
(in Watts, plural) specifies a power.
1mW (in metric units, in mW) or 1 milliwatt (in milliwatts, singular) or 2 milliwatts
(in milliwatts, plural) specifies a power scaled down by 1000.
1kW (in metric units, in kW) or 1 kilowatt (in kilowatts, singular) or 2 kilowatts
(in kilowatts, plural) specifies a power scaled up by 1000.
Elapsed time times power specifies an energy.
The specification of power is "Used to measure how much energy something can
apply in a given time - in the same period of time powerful things can do a lot
while feeble things much less. Typical domestic light bulbs take 60W of power
to run (twice as much as the human brain), and electric heaters perhaps 3kW.
Inform measures down to the power of the tiny laser in a CD player, or up to
the power of a small aircraft or diesel train."
Electric charge is a kind of value.
1 C (in metric units, in C) or 1 Coulomb (in Coulombs, singular) or 2 Coulombs
(in Coulombs, plural) specifies an electric charge scaled at 1000.
1 kC (in metric units, in kC) or 1 kilocoulomb (in kilocoulombs, singular)
or 2 kilocoulombs (in kilocoulombs, plural) specifies an electric charge
scaled up by 1000.
The specification of electric charge is "Electricity works because,
although matter is usually 'neutral', electric charge can flow between one
thing and another so that this balance is broken, and then a force is felt
between them. Electric forces are very strong, so even a small charge has a
big effect - a storm cloud might only have a charge of 20 C, but that's
enough to cause thunder and lightning. On the other hand batteries store
very large charges, but of course release them much more slowly - a typical
car battery holds about 200 kC. (Note that Inform writes '1 C' for one
coulomb, and '1C' for one degree centigrade.)"
Elapsed time times electric current specifies an electric charge.
Voltage is a kind of value.
1V (in metric units, in V) or 1 volt (in volts, singular) or 2 volts
(in volts, plural) specifies a voltage.
1mV (in metric units, in mV) or 1 millivolt (in millivolts, singular) or 2 millivolts
(in millivolts, plural) specifies a voltage scaled down by 1000.
1kV (in metric units, in kV) or 1 kilovolt (in kilovolts, singular) or 2 kilovolts
(in kilovolts, plural) specifies a voltage scaled up by 1000.
Voltage times electric current specifies a power. Voltage times electric
charge specifies energy.
The specification of voltage is "Measures the 'potential difference'
between two points, a sort of pulling power for electricity. Inform
measures down below the voltage across a human nerve cell, and up to twice
the maximum voltage ever applied on overhead power lines carried by
electric pylons. Quite low voltages can be dangerous on human skin - a 50V
potential difference between two points on the body can cause enough charge
to flow to electrocute somebody."
Luminance is a kind of value.
The specification of luminance is "Used to measure the brightness of something:
how much light it produces per unit of its surface area. (The actual amount
of light produced is luminosity. A fully lit computer display of 2008 has a
brightness of about 330 cd/sq m, and has a surface area of maybe 0.5 sq m,
so pours out about 150 cd. This is more than a domestic light bulb
produces, but the bulb is much, much brighter - maybe 150000 cd/sq m -
because the light comes out of a smaller area.) Inform's implementation of
luminance is meant for light sources of a reasonable size, quite near to the
player: it measures down to 0.001 cd/sq m, which is so dim it can barely be
seen, and up to about 2000000 cd/sq m, which would be painful to look at."
1 cd/sq m (in metric units, in cd/sq m) or 1 candela per square meter (in
candelas per square meter, singular) or 2 candelas per square meter
(in candelas per square meter, plural) specifies a luminance scaled at 1000.
[I'm leaving out capacitance, resistance, conductance, magnetic flux, magnetic
field, and inductance for now, but they could easily be added.]
[There are also solid angle, luminous flux, and some
specialist measures of radioactive dosage and level of catalysis.]
Part III - SI Compound Units
Area is a kind of value.
1 sq m (in metric units, in sq m) or 1 square meter (in square meters,
singular) or 2 square meters (in square meters, plural) or 1 square metre
(in square metres, singular) or 2 square metres (in square metres, plural)
specifies an area.
1 sq cm (in metric units, in sq cm) or 1 square centimeter (in square
centimeters, singular) or 2 square centimeters (in square centimeters,
plural) or 1 square centimetre (in square centimetres, singular) or 2
square centimetres (in square centimetres, plural) specifies an area scaled
down by 10000.
1 hectare (in metric units, in hectares, singular) or 2 hectares (in metric units,
in hectares, plural) specifies an area scaled up by 10000.
The specification of area is "Measures the extent of a two-dimensional surface,
usually a patch of land or the covering of an object. Inform measures down to
1 sq cm, the area of a small coin, or up to 21 hectares, the grounds of a large
country house or a typical French vineyard. A boxing ring is 36 sq m; a sports
field about 6000 sq m."
Length times length specifies an area. Pressure times area specifies
a force. Area times luminance specifies a luminosity.
A Volume is a kind of value. [That "A" prevents Inform mistaking the line for
a volume heading, in the literary sense.]
1 cu m (in metric units, in cu m) or 1 cubic meter (in cubic meters,
singular) or 2 cubic meters (in cubic meters, plural) or 1 cubic metre
(in cubic metres, singular) or 2 cubic metres (in cubic metres, plural)
specifies an volume.
1 l (in metric units, in l) or 1 liter (in liters, singular) or 2 liters
(in liters, plural) or 1 litre (in litres, singular) or 2 litres (in
litres, plural) specifies a volume scaled down by 1000.
1 cc (in metric units, in cc) or 1 cubic centimeter (in cubic centimeters,
singular) or 2 cubic centimeters (in cubic centimeters, plural) or 1 cubic
centimetre (in cubic centimetres, singular) or 2 cubic centimetres (in
cubic centimetres, plural) or 1 ml (in ml) or 1 millilitre (in millilitres,
singular) or 2 millilitres (in millilitres, plural) or 1 milliliter (in
milliliters, singular) or 2 milliliters (in milliliters, plural) specifies
a volume scaled down by 1000000.
The specification of volume is "Measures the extent of a three-dimensional
space, usually the space taken up by an object or the space inside a
container. Inform measures down to 1 cc (or 1 ml - same thing), about a
teaspoon-full, or up to 2100 cu m, twice the capacity of an Olympic
swimming pool."
Length times area specifies a volume.
Velocity is a kind of value.
1 m/s (in metric units, in m/s) or 1 meter per second (in meters per
second, singular) or 1 metre per second (in metres per second, plural)
specifies a velocity scaled at 100.
1 km/s (in metric units, in km/s) or 1 kilometer per second (in kilometers per
second, singular) or 1 kilometre per second (in kilometres per second, plural)
specifies a velocity scaled up by 1000.
The specification of velocity is "Measures how fast something is moving
relative to something else - usually something apparently fixed, like the ground.
Inform measures down to 0.01 m/s, the speed of a garden snail, and up to about
7% of the speed of light. People walk at about 1.2 m/s, and cars drive at
about 30 m/s; high speed trains are up to 160 m/s. The speed of sound is
around 330 m/s at sea level on a cool day."
Velocity times elapsed time specifies a length.
Acceleration is a kind of value.
1 m/ss (in metric units, in m/ss) or 1 meter per second squared (in meters
per second squared, singular) or 2 meters per second squared (in meters per
second squared, plural) or 1 metre per second squared (in metres
per second squared, singular) or 2 metres per second squared (in metres per
second squared, plural) specifies an acceleration scaled at 1000.
The specification of acceleration is "Measures the rate at which something
is gaining velocity - a positive acceleration makes something speed up,
negative makes it slow down. Accelerations look small, numerically, but have
large effects very quickly in practice - a high-performance Bugatti sports
car accelerates at only about 6 m/ss, but you'd notice all right if it
happened in front of you. The smallest acceleration Inform measures,
0.001 m/ss, is about half the level of gravity on the tiny asteroid Gaspra
(which is about 20km long); on Earth, gravity accelerates falling objects
at about 9.789 m/ss at the equator, 9.832 m/ss at the poles, so people
usually calculate with an average mid-latitudes value of 9.807 m/ss."
Acceleration times elapsed time specifies a velocity. Mass times
acceleration specifies a force.
Momentum is a kind of value.
1 Ns (in metric units, in Ns) or 1 Newton-second (in Newton-seconds) specifies
a momentum scaled at 1000.
The specification of momentum is "Momentum is the product of mass and velocity
for a moving object, so it measures in effect how hard it would shove you;
historical physicists had some trouble finding a good word for this concept,
but it's important because of the Principle of Conservation of Momentum -
the total momentum of all the bodies involved in a collision is constant
whatever happens in it. Billiard balls weigh about 150g, and travel at about
0.25 m/s, so each one has a momentum of about 0.038 Ns."
Mass times velocity specifies a momentum.
Density is a kind of value.
1 kg/cu m (in metric units, in kg/cu m) or 1 kilogram per cubic meter (in
kilograms per cubic meter, singular) or 2 kilogram per cubic meters (in
kilograms per cubic meter, plural) or 1 kilogram per cubic metre (in
kilograms per cubic meter, singular) or 2 kilograms per cubic metre (in
kilograms per cubic meter, plural) specifies a density.
1 g/cu m (in metric units, in kg/cu m) or 1 gram per cubic meter (in
grams per cubic meter, singular) or 2 gram per cubic meters (in
grams per cubic meter, plural) or 1 gram per cubic metre (in
grams per cubic meter, singular) or 2 grams per cubic metre (in
grams per cubic meter, plural) specifies a density scaled down by 1000.
1 g/cc (in metric units, in g/cc) or 1 gram per cubic centimeter (in
grams per cubic centimeter, singular) or 2 gram per cubic centimeters (in
grams per cubic centimeter, plural) or 1 gram per cubic centimetre (in
grams per cubic centimeter, singular) or 2 grams per cubic centimetre (in
grams per cubic centimeter, plural) specifies a density scaled up by 1000.
The specification of density is "Density is the amount of mass per unit volume.
(When people say that a substance is heavy, they usually mean it has a high
density.) The densest stuff on Earth is osmium metal, at 22610 kg/cu m; the
least dense is hydrogen gas, at 90 g/cu m. All else being equal, objects
whose density is below that of water - 1000 kg/cu m - will float up to the
surface if submerged. (That only includes human beings - 1010 kg/cu m - when
they have air in their lungs, reducing their density.)"
Density times volume specifies a mass.
Heat capacity is a kind of value.
1 J/C (in metric units, in J/C) or 1 Joule per degree centigrade (in Joules per
degree centigrade, singular) or 2 Joules per degree centigrade (in Joules per
degree centigrade, plural) specifies a heat capacity scaled at 1000000.
The specification of heat capacity is "Heat capacity is also known as thermal
mass, and measures how much energy it takes to increase the temperature of
something by one degree. (See specific heat capacity for typical values.)
Entropy is also measured as a heat capacity."
Heat capacity times temperature specifies an energy.
Specific heat capacity is a kind of value.
1 J/kg/C (in metric units, in J/kg/C) or 1 Joule per kilogram per degree
centigrade (in Joules per kilogram per degree centigrade, singular) or 2 Joules per
kilogram per degree centigrade (in Joules per kilogram per degree centigrade,
plural) specifies a specific heat capacity scaled at 1000.
Specific heat capacity times a mass specifies a heat capacity.
The specification of specific heat capacity is "Whereas heat capacity measures
the energy needed to heat up a specific object - say, a whole house - specific
heat capacity is the energy needed per kilogram of its mass. Thus wood, at
420 J/kg/C, heats up and cools down twice as fast as brick, marble, sand or
soil, all at about 800 J/kg/C; glass is somewhere in between. Liquid water
takes a lot more energy to heat up, at 4180 J/kg/C; but at least this means
that hot baths stay hot for a little while. Butters and oils tend to be in
the range 1500 to 2000 J/kg/C, and most foodstuffs in the 3000s: banana,
3350 J/kg/C; chicken, 3200 J/kg/C; eggs, 3180 J/kg/C and so forth."
[That leaves torque, energy density, and a few other oddities.]
Approximate Metric Units ends here.
---- DOCUMENTATION ----
(Note: This extension uses integer arithmetic for its calculations, which was the best that could be done until June 2012. The new version of "Metric Units" uses floating-point calculations and is much more accurate, though it only works on versions of the Glulx virtual machine dating from 2011. This is a renamed copy of the old "Metric Units", and is preserved in case people need it to keep older works running.)
The metric system provides a consistent set of units for scientific measurement of the world. Though often associated with the French Revolution or with Napoleon, the system of metric units only really began to displace existing units in May 1875, when it was made official by an international treaty. In 1960, it was renamed the "Système international d'unités", which is usually abbreviated "SI".
This extension is a kit for writers who want to make realistic simulations, backed up by some quantitative physics. It defines kinds of values for the 25 or so SI units in common usage, and more than 100 notations for them. It also makes sure they multiply correctly. For instance, a mass times an acceleration produces a force, so
say "You feel a force of [2kg times 5 m/ss]."
will produce the text "You feel a force of 10N." The easiest way to see how all these units combine is to run one of the examples below and look at the Kinds index which results.
For each unit, both names and notations are allowed. Thus '2 kilograms' is
equivalent to '2kg'. Both English and French spellings of 'meter'/'metre' and 'liter'/'litre' are allowed, but we insist on 'gram' not 'gramme' and 'tonne' not 'ton'. ('Ton' is too easily confused with the Imperial measure, which is not quite the same.) We can print back the same value in a variety of ways. For instance:
say "[m0 in metric units]";
say "[m0 in kg]";
say "[m0 in g]";
say "[m0 in kilograms]";
might produce: '2.04kg', '2.04kg', '2040g', '2.04 kilograms'. The text expansion '... in metric units' prints any value of any of these units in its most natural notation: 2.04kg is thought to be better than 2040g, but 981g would be better than 0.981kg. Or in the case of our variant spellings:
say "[C in metric units]";
say "[C in milliliters]";
say "[C in millilitres]";
might produce '47 ml', '47 milliliters', '47 millilitres'. It's also worth remembering that any value can be rounded:
say "[C to the nearest 5 ml]";
would produce '45 ml', for instance.
For detailed notes on each of the units, consult the Kinds index for any project using this extension.
There are three main restrictions. First, Inform can only represent numbers within a certain range. Each kind of value is set up on the assumption that writers will want it to model human-scale situations - length, for instance, varies from 1mm, the smallest conscious movement a human can make, up to 2150km or so, the length of a continent-spanning footpath. 'Approximate Metric Units' is an extension to help with real-world physics questions like how long a plate dropped off the roof takes to hit the ground, or when a rope will break, or how long a saucepan of water will take to boil. It won't be much use for celestial events like lightning strikes, where enormous energies are released for fleeting periods of time, or for tiny subatomic events.
Secondly, calculations are done with fixed-point arithmetic and will inevitably involve small rounding errors. Working out the same quantity by two different methods, which ought to have the same result according to physics, will often produce slightly different answers because these errors accumulate differently. 'Approximate Metric Units' aspires to help the writer to get physical answers which are about right, not to be a precision tool.
Thirdly, we haven't included every SI unit. There are hundreds of kinds of value which turn up in physics, and we only include the commonest 25 or so. The missing ones which have named SI units are:
solid angle (measured in steradians), luminous flux (lux), electric capacitance (Farads), electric resistance (Ohms), electric conductance (Siemens), magnetic flux (Webers), magnetic field (Teslas), inductance (Henries), radioactivity (Becquerels), absorbed radioactive dose (Grays), equivalent radioactive dose (Sieverts), chemical quantity (mole), catalytic activity (katals).
As can be seen, we've missed out units for chemistry, electromagnetic effects beyond the basic ones, and radioactivity. It would be easy to add any of these which might be needed:
Electric resistance is a kind of value.
1 Ohm (in metric units, in Ohms, singular) or 2 Ohms (in metric units, in Ohms, plural) specifies an electric resistance scaled at 1000.
Electric resistance times electric current specifies a voltage.
Similarly, there are many kinds of value which don't have named SI units, but where physicists write them down as compounds. These are also easy to add as needed:
Angular momentum is a kind of value.
1 Nms specifies an angular momentum scaled at 1000.
Momentum times length specifies an angular momentum.
Besides angular momentum, 'Approximate Metric Units' also leaves out:
volumetric flow (cu m/s), jerk (m/sss), snap (m/ssss), angular velocity (rad/s, though Inform would probably use degrees/s), torque (Nm), wavenumber (1/m), specific volume (cu m/kg), molar volume (cu m/mole), molar heat capacity (J/K/mol), molar energy (J/mol), specific energy (J/kg), energy density (J/cu m), surface tension (J/sq m), thermal conductivity (W/m/C), viscosity (sq m/s), conductivity (S/m), permittivity (F/m), permeability (H/m), electric field strength (V/m), magnetic field strength (A/m), resistivity (Ohm metre).
This extension is pretty faithful to SI conventions. It chooses degrees rather than radians for angle, and centigrade rather than Kelvin for temperature, because these are more useful for humans and easier to represent in text. But otherwise it's strictly metric, and does not define Imperial measures. See the example below for how to add these.
Example: ** Galileo, Galileo - Dropping a cannonball or a feather from a variety of heights.
This experiment was first proposed in Pisa in the 1630s, but more definitively carried out by the crew of Apollo 15 in 1971, using a geological hammer and the feather of a falcon. Galileo's point was that heavy objects and light objects fall at the same speed because of gravity, and that only air resistance makes us think feathers fall more slowly than cannonballs. (Of course, heavy objects do land harder; the hammer kicked up a lot more lunar dust than the feather did.)
*: "Galileo, Galileo"
Include Approximate Metric Units by Graham Nelson.
The acceleration due to gravity is an acceleration that varies.
Laboratory is a room. "An elegant Pisan room, with fine Renaissance panels, except for the teleport corridor to the east." A cannon ball and a feather are in the Laboratory.
Martian Outpost is east of the Laboratory. "A reddish-lit room with steel walls, whose only exit is the teleport corridor to west."
A room has an acceleration called gravitational field. The gravitational field of a room is usually 9.807 m/ss. The gravitational field of the Martian Outpost is 3.69 m/ss.
A thing has a mass. The mass of a thing is usually 10g. The mass of the cannon ball is 2kg.
Dropping it from is an action applying to one thing and one length.
Understand "drop [thing] from [length]" as dropping it from.
Check dropping it from:
if the player is not holding the noun:
say "You would need to be holding that first." instead.
Check dropping it from:
if the length understood is greater than 3m:
say "Just how tall are you, exactly?" instead.
Check dropping it from:
if the length understood is 0m:
try dropping the noun instead.
Equation - Newton's Second Law
F=ma
where F is a force, m is a mass, a is an acceleration.
Equation - Principle of Conservation of Energy
mgh = mv^2/2
where m is a mass, h is a length, v is a velocity, and g is the acceleration due to gravity.
Equation - Galilean Equation for a Falling Body
v = gt
where g is the acceleration due to gravity, v is a velocity, and t is an elapsed time.
Carry out dropping something (called the falling body) from:
now the acceleration due to gravity is the gravitational field of the location;
let m be the mass of the falling body;
let h be the length understood;
let F be given by Newton's Second Law where a is the acceleration due to gravity;
say "You let go [the falling body] from a height of [the length understood], and, subject to a downward force of [F], it falls. ";
now the noun is in the location;
let v be given by the Principle of Conservation of Energy;
let t be given by the Galilean Equation for a Falling Body;
let KE be given by KE = mv^2/2 where KE is an energy;
say "[t to the nearest 0.01s] later, this mass of [m] hits the floor at [v] with a kinetic energy of [KE].";
if the KE is greater than 50J:
say "[line break]This is not doing either the floor or your ears any favours."
Test me with "get ball / drop it from 1m / get ball / drop it from 2m / get ball / drop it from 3m / get ball / drop it from 3.2m / get ball / drop it from 0m / get all / east / drop ball from 3m / drop feather from 3m".
Note the way Inform is able to solve the conservation equation, which says the potential energy at the start equals the kinetic energy at the end, to find the velocity v: this involves taking a square root, but it all happens automatically. Square roots tend to cause rounding errors - so on Mars the cannon ball and feather actually land 0.02s apart, in the calculation above, despite Galileo. But no human observer would notice that discrepancy.
Example: ** The Empire Strikes Back - Using good old Imperial measures of length and area alongside these Frenchified metric ones.
Imperial measures, often going back to obscure customs in Anglo-Saxon England, were inflicted across much of the world in the heyday of the British Empire. Some are still very much alive in England and its former colonies (Australia, India, New Zealand, Canada, Ireland, the USA and so on) - miles and feet, for instance. Others continue only in unscientific social customs, like sport: horse-races are measured in furlongs; the running distance between the two wickets of a cricket pitch is 22 yards, which is 1 chain exactly; and even in France, a football goal must be 8 feet high and 8 yards wide.
*: "The Empire Strikes Back"
Include Approximate Metric Units by Graham Nelson.
Steeple Aston Cricket Pitch is a room.
1 inch (in imperial units, in inches, singular) or 2 inches (in imperial units, in inches, plural) specifies a length equivalent to 2.5cm.
1 foot (in imperial units, in feet, singular) or 2 feet (in imperial units, in feet, plural) specifies a length equivalent to 12 inches.
1 yard (in imperial units, in yards, singular) or 2 yards (in imperial units, in yards, plural) specifies a length equivalent to 3 feet.
1 chain (in imperial units, in chains, singular) or 2 chains (in imperial units, in chains, plural) specifies a length equivalent to 22 yards.
1 furlong (in imperial units, in furlongs, singular) or 2 furlongs (in imperial units, in furlongs, plural) specifies a length equivalent to 10 chains.
1 mile (in imperial units, in miles, singular) or 2 miles (in imperial units, in miles, plural) specifies a length equivalent to 8 furlongs.
1 league (in imperial units, in leagues, singular) or 2 leagues (in imperial units, in leagues, plural) specifies a length equivalent to 3 miles.
1 square foot (in imperial units, in square feet, singular) or 2 square feet (in imperial units, in square feet, plural) specifies an area equivalent to 900 sq cm.
1 square yard (in imperial units, in square yards, singular) or 2 square yards (in imperial units, in square yards, plural) specifies an area equivalent to 9 square feet.
1 acre (in imperial units, in acres, singular) or 2 acres (in imperial units, in acres, plural) specifies an area equivalent to 4840 square yards.
Understand "convert [a length]" as converting. Converting is an action applying to one length.
Carry out converting:
let A be the length understood;
say "Measuring A = [A], which ";
say "= [A in millimetres] ";
say "= [A in centimetres] ";
say "= [A in metres] ";
say "= [A in kilometres] ";
say "= [A in inches] ";
say "= [A in feet] ";
say "= [A in yards] ";
say "= [A in chains] ";
say "= [A in furlongs] ";
say "= [A in miles] ";
say "= [A in leagues].";
say "Metric: [A in metric units].";
say "Imperial: [A in Imperial units].[paragraph break]";
Test me with "convert 1.2m / convert 2m / convert 30cm / convert 20 chains".
The above conversions are based on 1 inch equals 2.5cm, which is not very accurate: 2.54cm would be closer. But to get that accuracy we would need to represent lengths down to 0.4mm, which is below the 1mm cutoff imposed by 'Metric Units'. We'll accept this 2% error in lengths (or 4% error in areas) as harmless, given that we're not going to be doing any serious calculations in Imperial units; if we were, we'd do better to make a fresh extension for them.
Confusions still cause spectacular failures, as when an Air Canada ground crew mixed up pounds and kilograms and fuelled a Boeing 767 so lightly in 1983 that it ran dry at 41,000 feet, losing all engines, avionics and electricity. The captain, by great good luck also an amateur glider pilot, made a now-legendary landing at an obscure airstrip which the first officer by great good luck had once flown from. The USA's Mars Climate Orbiter spacecraft, whose navigation software confused pounds and newtons, was not so lucky and burned up in the Martian atmosphere in 1998 at a cost of $330 million.

View file

@ -24,12 +24,6 @@
-cases [Internal] 'inform7/Tests/Test Internals'
-cases [Make] 'inform7/Tests/Test Makes'
-cases [Filing] 'inform7/Tests/Test Filings'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Complex Listing.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Inanimate Listeners.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Locksmith.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Punctuation Removal.i7x'
-extension [Main] 'inform7/Internal/Extensions/Emily Short/Skeleton Keys.i7x'
-extensions [Main] 'inform7/Internal/Extensions/Graham Nelson'
-examples [Main] resources/Documentation/Examples
-problems [Main] 'inform7/Tests/Test Problems'

View file

@ -10,8 +10,8 @@ rubric text, and the Standard Rules are no exception:
=
Version [[Version Number]] of the Standard Rules by Graham Nelson begins here.
"The Standard Rules, included in every project, define phrases, actions and
activities for interactive fiction."
"The Standard Rules, included in every interactive fiction project, creates
a model world populated by actors who perform actions."
Part One - Preamble

View file

@ -746,10 +746,6 @@ forcetransferkits:
{define: transfer-extensions}
mkdir -p $(INTERNAL)
mkdir -p "$(INTERNAL)/Extensions/Eric Eve"
rm -f $(INTERNAL)/Extensions/Eric\ Eve/*
mkdir -p "$(INTERNAL)/Extensions/Emily Short"
rm -f $(INTERNAL)/Extensions/Emily\ Short/*
mkdir -p "$(INTERNAL)/Extensions/Graham Nelson"
rm -f $(INTERNAL)/Extensions/Graham\ Nelson/*
cp -R -f $(INFORM7WEB)/Internal/Extensions $(INTERNAL)/Extensions/..
@ -826,8 +822,6 @@ $(INTERNALEXEMPLUMFROM):
$(INTERNALEXEMPLUM)
$(INTERNALEXEMPLUM): \
$(INFORM7WEB)/Internal/Extensions/Eric\ Eve/[A-Za-z]* \
$(INFORM7WEB)/Internal/Extensions/Emily\ Short/[A-Za-z]* \
$(INFORM7WEB)/Internal/Extensions/Graham\ Nelson/[A-Za-z]* \
$(INFORM7WEB)/Internal/Languages/*/*.* \
$(INFORM7WEB)/Internal/Templates/*/*.* \

View file

@ -160,21 +160,7 @@ The following webs are the source for the two most important extensions shipped
Other extensions shipped with Inform are not presented as webs, but as single files:
{extension author: Emily Short title: Basic Help Menu}
{extension author: Emily Short title: Basic Screen Effects}
{extension author: Emily Short title: Complex Listing}
{extension author: Emily Short title: Glulx Image Centering}
{extension author: Emily Short title: Glulx Text Effects}
{extension author: Emily Short title: Inanimate Listeners}
{extension author: Emily Short title: Locksmith}
{extension author: Emily Short title: Menus}
{extension author: Emily Short title: Punctuation Removal}
{extension author: Emily Short title: Skeleton Keys}
{extension author: Eric Eve title: Epistemology}
{extension author: Graham Nelson title: Approximate Metric Units}
{extension author: Graham Nelson title: English Language}
{extension author: Graham Nelson title: Metric Units}
{extension author: Graham Nelson title: Rideable Vehicles}
### Website templates and interpreters shipped with Inform