An author's reference for Bisquixe, a tool for adding audiovisual content to Inform projects (update: linking to external files)

Documentation Review: Including Image Files in an Inform Project

Before discussing images in a web-based Inform game, it is best to review the inclusion of image files in an Inform project. These are discussed in Chapter 23 of the Inform 10 Documentation. The perspective of this reference is that images can add a lot to a project. At the same time, poorly-chosen ones can detract.

Images, then, are yet another question of art that creators and critics must answer. How do we go about implementing them?

Declaring image files

The practice for adding files to Inform projects is to declare them. The declaration involves two values: thefigure name and the "[file name]". The figure name is what we use to refer to the file within our project. The file name is mentioned only once in this initial declaration.

In other words, files are incorporated into Inform by declaring values that do not change. We cannot have an image file that varies, for instance, though we can have a figure name that varies. Declaring an image file requires a reference name beginning with the word figure. For example:

figure frob is the file "frob.jpg".

The formatting is very specific. File names are always placed within quotation marks, and only designated file types are permitted. The permitted image types are Joint Photographic Experts Group (JPEG) and Portable Network Graphics (PNG). When releasing a project, inform will verify file extensions.

Inform will test-compile a project whether the files are present or not, but to release a project with designated image files, said files must be located in the .materials\figures directory.

Once we have a figure name, we can use it in rules and definitions.

Displaying image files within an Inform project

It is useful to think of an Inform game’s output as something emerging from a line-feed printer. The output hits the page, feeds forward, and then the next bit of output displays, and so on. These units of output are, in a web-based inform game, referred to as a .BufferLine. Even though an image may take up far more space on the screen than a snippet of text might, each
displays as a .BufferLine class within the larger .BufferWindow.

The displayed image is just like displayed text in that once it reaches the page, it cannot be changed or altered. Like text output, it will scroll up and out of sight as more .BufferLine content is added to the .BufferWindow.

In this sense, it is useful to think of a phrase beginning with display as a very specialized relative of say. Both send output directly to a .BufferLine. We use display as follows:

	display figure frob;

Again, only our declared figure name is used. It isn’t possible to refer directly to the image by file name here.

Since this pharase sends output as a .BufferLine, we invoke it just as we would while saying a text.

instead of jumping:
	display figure frob;

or

this is the frob visibility rule:
	display figure frob;

or

to say iFrob:
	display figure frob;

or even

after printing the name of the frob (this is the frob display rule):
	display figure frob;

Using Inform’s built-in support for alt-text

We can declare text descriptions for images when we declare the images themselves. The text description is appended in parentheses at the end of the phrase. For instance:

figure frob is the file "frob.jpg" ("A multi-pronged frob with a knurled handle.").

Some authors may wish to take a further step and create a separate screen reader mode. Acessibility is a subject that merits dedicated consideration. Please refer to

(add link to accessibility post once written)

More on the figure name value.

Because figure name is a value, we can use it in conditions and rules. Consider:

to decide which figure name is the current figure:
	if the location is lab, decide on figure frob;

instead of jumping:
	display the current figure;

Internally, multimedia resources (sound and image files) each have an assigned Glulx resource ID. This happens automatically; authors do not assign them or request that they be assigned. They can be referred to in this way:

	...Glulx resource ID of figure frob...

In practice, authors seldom need to refer to a file’s Glulx resource ID, but authors of web games may find it necessary to do so. This will be explained in the next post, which explores specific considerations for using images in web-based Inform games.