Interpreter Sniffing by Friends of I7
With Interpreter Sniffing included we can determine the interpreter the story is running under by writing
the current interpreter
as in
if the current interpreter is Zoom:
....
At present, the possibilities are
FyreVM
Zoom
Git/Gift-based interpreter
and
Unknown interpreter
They all have the kind
an interpreter
For more detail, we can ask about
the current Glulx implementation
which has kind
a Glulx implementation
and the possibilities
Git/Gift Glulx
FyreVM Glulx
and
Unknown Glulx implementation
Likewise, we may wish to know
the current IO implementation
which has the kind
an IO implementation
It may be
FyreVM channel system
CocoaGlk
Unknown Glk implementation
or
Unknown non-Glk implementation
All of these tests have associated phrases to determine corresponding version numbers:
the current interpreter version number
the current Glulx version number
and
the current IO version number
Each of these decides on a value with the kind
a version number
which is an arithmetic kind of value written in three parts, major version, minor version, and patch level, separated by dots. For example,
3.1.2
has major version 3, minor version 1, and patch level 2.
With this syntax we can write conditionals like
if the current Glulx version number is at least 3.1.2:
....
Finally, it is possible for the interpreter to change mid-story if the player saves and restores. If the change can be detected, rules in
the when the interpreter changes rulebook
will be run; these are written
When the interpreter changes:
....
Note that these rules are run as soon as possible, and the story might not have regained its bearings yet. (In particular, no Glk recovery has happened.) It is generally not safe to produce output within such rules; we should instead note the differences and respond at a less precarious time, such as before the next command prompt.
Example: * Fourth Wall - Interpreter information in the story banner and other parts of the story.
"Fourth Wall"
Include Interpreter Sniffing by Friends of I7.
After printing the banner text:
say "[The current interpreter] [the current interpreter version number][line break]".
Terp is a room.
"[A lonely wooden sign] swings from an otherwise bare ceiling, and three of the walls are similarly blank. Through [the fourth wall], however, you can vaguely make out [the author]."
The ceiling is scenery in the terp.
The description is "Blank, unstoried."
Some blank walls are scenery in the terp.
The description is "Blank, unstoried."
A lonely wooden sign is scenery in the terp.
The description is "The sign reads '[The current Glulx implementation] [the current Glulx version number]'."
The fourth wall is scenery in the terp.
Understand "etched" and "surface" as the fourth wall.
The description of the fourth wall is "Etched on the surface is the text, '[The current IO implementation] [the current IO version number]'."
Instead of searching the fourth wall:
try examining the author.
The author is a scenery person in the terp.
The description is "As best you can tell, [the author] is [the author's name]."
Include (- #ifdef Story_Author; Constant Author_Name = Story_Author; #ifnot; Constant Author_Name = (+ "Anonymous" +); #endif; -) after "Definitions.i6t".
To decide what text is the author's name: (- Author_Name -).
Interpreter changed is a truth state that varies; interpreter changed is false.
When the interpreter changes:
now interpreter changed is true.
Before reading a command when interpreter changed is true:
say "Whoa, déjà vu. (It happens when they change something.)";
now interpreter changed is false.
Test me with "x sign / x wall / x author".