An image as a room description?

Hey all–

I’d like to display an image before the text of a room description in each room (a different image for each room). I found Emily Short’s “Location Images,” but it relies on another of her extensions called “Simple Graphical Window,” and Inform doesn’t like that extension. For instance, these error messages pop up when I paste the SGW code in:

Problem. The sentence ‘The graphics window is a graphics g-window’ appears to say two things are the same - I am reading ‘graphics window’ and ‘graphics g-window’ as two different things, and therefore it makes no sense to say that one is the other:

and

Problem. The sentence ‘The graphics window is spawned by the main window’ appears to say two things are the same - I am reading ‘graphics window’ and ‘spawned by the main window’ as two different things, and therefore it makes no sense to say that one is the other:

Is there a simpler way to display images (a unique one for each room) than messing with these? I don’t need them centered or anything, just shown automatically when the player enters that room.

1 Like

Maybe you’ve got a version conflict between some of the extensions which are indirectly included.

On the contents page of the Index tab, you can see all of them listed. I got Location Images to work with this combination of extensions:

Included from the source text

Location Images  by Emily Short

Included by the extension Location Images

Simple Graphical Window  by Emily Short version 9/160121

Included by the extension Simple Graphical Window

Glulx Entry Points  by Emily Short version 10/200602
Glulx Text Effects  by Emily Short version 5/150123

Included by the extension Glulx Entry Points

Glulx Definitions  by Dannii Willis version 1/160919
Glk Object Recovery  by Dannii Willis version 1/171025
Glk Events  by Dannii Willis version 1/160919

It might be necessary to get some of those versions from the “Friends of I7” Github repository. Or you could go the other route, as in this thread, and delete and re-download the extensions via the Public Library in the IDE.

Thanks, but I’ve never been able to download any extensions into Inform, probably because I suck. I have to copy and paste the code for everything not included with Inform into my code.
And this is so many things to mess with that my brain goes blank even thinking about it, considering the trouble I have with even one extension.

I was truly hoping there was just a way to do something like:

When play begins:
      now the description of RoomX is the figure of RoomX.

But if not then I’ll probably just shelve this project.

Location Images is very short, it just consists of these lines:

Include Simple Graphical Window by Emily Short.

A room has a figure-name called room-illustration. 
	
The image-setting rule is listed in the carry out looking rules. 

This is the image-setting rule:
	now currently shown picture is the room-illustration of the location;
	follow the current graphics drawing rule.

The “carry out looking” part is whereby the picture gets displayed automatically.

We can use the code above and just swap out the lines which refer to definitions from “Simple Graphical Window”, which we don’t want to include, for the “normal” picture-displaying statement, as described in chapter “23.6. Displaying the figures”.

So we have:

A room has a figure-name called room-illustration. 
	
The image-setting rule is listed in the carry out looking rules. 

This is the image-setting rule:
	display the room-illustration of the location.

[Define a figure in the usual way:]
Figure of A is the file "placeholder1.png".

[And then, when you define rooms, you'd use, just as for Location Images:]
The Living Room is a room. The room-illustration is Figure of A.

There are probably various ways to tweak this (for example, by saying “is listed first in the carry out looking rules”), but it should work as a start.

I did this and it worked:

After going to home:
	say "[bold type]Home[roman type][line break]";
	display figure of homepic;
	say "Home description.".

Instead of looking:
	if the location is home:
		say "[bold type]Home[roman type][line break]";
		display figure of homepic;
		say "Home description.".

Is there any reason not to do this?

I totally understand if you prefer working on the game, but it could be worth trying to troubleshoot the issue. Are there any error messages when you try to install an extension? It might be an IDE bug which only surfaces in some specific circumstances, or something might be unclear in the documentation.

There are two main ways to install an extension (at least on the Windows IDE):

  • via the Extensions tab, subtab “Public Library”, unfolding the categories, and downloading and installing the extensions from there, or

  • via the top menu: “File → Install Extension…” and then navigating to a folder where one previously downloaded “.i7x” files, for example from the Friends of I7 Github repository mentioned above. Then double-click on the .i7x file which contains the extension you want to install.

Yes, I’d say there are two problems there:

  1. You’d need to write similar code blocks for every location, rather than having a slightly more generic solution as in Location Images (or my suggestion above), where you’d only have to define the “room-illustration” for each room.
  2. I wouldn’t do it in an “Instead of looking” rule. The Standard Rules contain several “carry out looking” rules, which would then be prevented from running. I’d rather just add the display rule into the set of carry out looking rules, as Location Images does (and the example I gave above).
    (Also, note that a general “instead of looking” rule will always kick in, so you’d definitely need to write additional code to take care of that; or you could make the preamble more specific by saying “Instead of looking when the location is home” etc., but that still runs into the problem mentioned above, of preventing the Carry Out rules from running.)
2 Likes

One day I will forget my frustration at the hours and hours I spent trying to download extensions, and I will try again. That day is not soon, but it will come.

I don’t get any messages at all. Things just don’t install. I’m definitely screwing it up, but I tried to troubleshoot it for a really long time, and then I hit my limit. I’ll get over it one day.

And thanks for the advice on “Looking” rules. I can modify that. I don’t have many locations in this project, and so it’s not an onerous task to just use that code. The only reason I’m doing this is a TALP project I’m playing with, and I know graphics are a thing there. Probably I won’t bother with it again.

Just for additional information, the “carry out looking” rules from the Standard Rules take care of a lot of stuff; they consider what’s visible from the player’s point of view (might be in a container, or it might be dark etc.) and call the functions which describe the visible items; and when the player is on a chair, they print the additional “(on the chair)” after the room title, and things like that.

One usually doesn’t want to circumvent or rebuild/replicate that, that’s why I’d advise against an Instead rule in this case. (Well, one can tack a “continue the action” onto an instead rule, so that it goes on to the check and carry out phases, but that also wouldn’t give the desired results if one already does some of the work, like printing the room title and description, in one’s own rule beforehand.)

2 Likes