Inform 7 only ever displaying one image (once)

I’m very new to Inform 7 so apologies if I’ve missed something obvious, but I’ve got a truly baffling problem that doesn’t seem to be covered anywhere else. I’ve added images as “Figures” following the Inform 7 documentation, and the story compiles as expected, saying that the images have been added. The images are called up like so:
Before looking in the Airport Foyer: display the Figure of Airport Foyer.

However, whenever I run the game, only the first image is displayed, and only the first time. That is, the player starts in Airport Foyer and the relevant jpeg appears above the description right where I’d expect. You can then go East to Customer Service Desk (which should have a different image displayed in exactly the same way), but nothing appears. Going back West to Airport Foyer results in exactly the same thing (ie. no image appears), even though that image displayed as expected the first time.

I gather there’s an option to display images only once each - and that would actually be acceptable here - but I haven’t tried to specify anything like that. The behaviour is identical in the IDE and in Lectrote. I’m stuck because obviously the images are included in the game and clearly they can be displayed when it’s run, but except for the very first possible occasion they just aren’t.

Can anybody help me with this? If you’d like to have a look at the game itself, I’ve uploaded it (including source.txt) as a Global Game Jam project.

I am not very savvy on this, but I had a similar issue in the past. Does it look like this at all?

(Here, the problem appears in the browser version of the game.)

The discussion in that thread is about setting up the playable web page. If you load the gblorb file into Lectrote, you’re not having the same problem.

2 Likes

The issue is that the room description generated after going somewhere is not produced by a full ‘Look’ action, whereas the initial room description at the start of the game is.

To quote from the documentation of the Look action:

Finally, note that several actions other than looking also produce room descriptions in some cases. The most familiar is going, but exiting a container or getting off a supporter will also generate a room description. (The phrase used by the relevant rules is ‘produce a room description with going spacing conventions’ and carry out or report rules for newly written actions are welcome to use this too if they would like to. The spacing conventions affect paragraph division, and note that the main description paragraph may be omitted for a place not newly visited, depending on the VERBOSE settings.) Room descriptions like this are produced by running the check, carry out and report rules for looking, but are not subject to before, instead or after rules.

So, you can’t put your display code in a Before rule if you want it to run after going somewhere. Maybe make it a First Carry out rule if you want the picture to appear each time before the text description?

2 Likes

Thank you! This is definitely the source of the problem - images appear as expected if I “look” while in a room.

What is a “First Carry out” rule, though? I can’t find that phrase anywhere in the documentation.

Thanks for the reply! As Andrew Plotkin says, it’s not quite the same issue (though I was hoping for a method of including the images in the browser version, so this is still quite helpful).

1 Like

Putting ‘First’ at the beginning of the preamble of a rule ensures it is filed at the beginning of the rulebook - in this case the ‘Carry out Looking’ rulebook- and is therefore the first rule in the rulebook to be consulted, in this case before all the rules that print out the text of the description. The documentation chapter on Rules will give you more information on this, in particular 19.4 ‘Listing rules explicitly’.

You can see which rules govern each action by perusing the Actions tab of the Index.

So, e.g.

First carry out looking in the Airport Foyer: display the Figure of Airport Foyer.

and so on.

However, to make this easier you might consider attaching the figures to each room so that one rule will display them all, rather than writing out a separate rule for each room:

Every room has a figure name called picture.
First carry out looking when the picture of the location is not Figure of cover:
	display the picture of the location.
The picture of the Airport Foyer is Figure of Airport Foyer.

Figure of cover is the default figure name given to rooms where you don’t explicitly allocate one (see the Kinds tab in the Index)

Thanks again! This is quite a small game so I think I’ll just add a line for each room - but using one rule for all of them would definitely make things easier for larger projects.