Story Substrate by Jeff Nyman


Story files are built on a particular version of Inform 7 which is utilizing a series of extensions to provide functionality. Inform 7 is, in turn, backed up by a version of Inform 6 which is itself using a particular Inform 6 library. Much of this information is printed as part of the "banner" that displays when a story file starts or if a "version" command is used. There may be a desire to get some of that information individually and that's what this extension helps to do.

There is also the interpreter that the story itself is running on. This extension will attempt to gather some of that information, although interpreter information can only be recovered in a Glulx context.

All of this is what I refer to as the "substrate." This extension helps recover and display that information.

Section - Serial Number

To get the serial number:

say "Serial number: [story serial number]."

Section - IFID

IFID stands for Interactive Fiction IDentifier. An IFID is a number that is unique to each story file. This gives players, authors, and archivists a universal and unambiguous way in which to refer to a given story file. The IFID forever refers to that story file in all of its versions, regardless of its serial number, release number and so forth. Conceptually it's pretty much identical to the idea of the ISBN system for books. The IFID system is defined by the Treaty of Babel, which was created in 2006.

To get the IFID:

say "IFID: [story IFID number]."

Section - Inform 7

Inform 7 provides a specific compiler called NI (Natural Inform) which has its own version. To get that version:

say "Inform 7 compiler: [I7 build]."

NI is the Inform 7 compiler that in turn relies on a specific Inform 6 compiler. To get that version:

say "Inform 6 compiler: [I6 build]."

Inform 6 relies on a specific library of code. To get the version of the Inform 6 library:

say "Inform 6 library: [I6 library]."

All of the above translates into what I call the "Inform 7 Identity", meaning that with the above information you can construct a very specific identity for the particular version of Inform that was used to compile a given story file. You can get that full identity with:

say "Inform 7 Identity: [I7 identity]."

This "identity" is essentially what's printed as part of the starting banner. Having a simple way to refer to the string, however, means you can recover it if you decided to override how, or even if, the banner is displayed.

Section - Interpreter Style (Glulx Only)

There have been various ways to get information about the interpreter that the story file is running on. Most of them are imperfect at best so this extension doesn't really try to do much of what's called "interpreter sniffing." These next bits only work under Glulx interpreters.

To get the Glulx verison number that the story is being interpreted under:

say "Glulx version: [current Glulx version number]."

Glulx is the virtual machine, which has its own version number, as distinct from the interpreter that is implementing the virtual machine. To get the Glulx interpreter version number:

say "Interpreter version: [current interpreter version number]."

There is yet one more level to consider which is the I/O implementation being used, which has to do with Glk. This, too, will have its own version. To get the I/O version:

say "I/O version: [current IO version number]."

Whether the above information is useful really depends on whether you are using some effect or feature that is known to exist only within certain Glulx versions or with certain Glk I/O implementations. The interpreter version is less useful without knowing what the actual interpreter is so, for now, that's included for completeness of versioning information rather than as anything terribly useful.

That said, I have implemented those parts of Interpreter Sniffing that attempt to look for the current implemenation of either the IO verison or the Glulx verison. You can have those displayed as such:

say "Current IO Implementation: [current IO implementation].";
say "Current Glulx Implementation: [current Glulx implementation]."

You can try to determine what the current interpreter is by the following:

say "Current Interpreter: [current interpreter]."

However the mechanisms in place to be able to detect are extremely poor, at best. So it's unclear if this is has any real value.