Compile issue when trying to create generic First Carry Out Looking rule to display room illustration with Simple Graphical Window extension

Continuing my prior experiment with the Simple Graphical Window extension I’ve been trying to figure out how to display a room’s illustration prior to its text description.

This code below works in Inform 6M62 v1.68.1. There are three rooms, each room has an image associated with it, and a “first carry out looking…” rule is used to display the room illustration before the room text.

"text-graphics" by Bill Maya

Include Simple Graphical Window by Emily Short [v10/161003; includes v15/170131 of Flexible Windows]

The player is in the Map Room.

When play begins:
	close the graphics window; [Since we are not using it]

Map Room is a room.
First carry out looking in the Map Room: display the Figure of Map Room.

The Library is a room.
The Library is north of the Map Room.
First carry out looking in the Library: display the Figure of Library.

The Workshop is a room.
The Workshop is west of the Map Room.
First carry out looking in the Workshop: display the Figure of Workshop.

Figure of Map Room is the file "map-room-0a.png".
Figure of Library is the file "library-3a.png".
Figure of Workshop is the file "workshop-1a.png".

From reading two prior posts I see that I can create a generic first carry out looking rule instead of having individual first carry out looking rules for specific rooms.

So I added this code to my example above.

A room has a figure name called illustration.

First carry out looking when the illustration of the location is not Figure of cover:
	display the illustration of the location.

The code compiles with those lines added.

However, when I add this line to the Map Room.

The illustration of Map Room is Figure of Map Room.

The code will not compile and gives me the following error message.

Problem. In the sentence 'The illustration of Map Room is Figure of Map Room'  , it looks as if you intend 'The illustration of Map Room is Figure of Map Room' to be asserting something, but that tries to set the value of the 'illustration' property to an object - which must be wrong because this property has to be a figure name.

Here is the complete code for reference purposes (you can find a repository with all the code and images here).

"text-graphics" by Bill Maya

Include Simple Graphical Window by Emily Short [v10/161003; includes v15/170131 of Flexible Windows]

The player is in the Map Room.

When play begins:
	close the graphics window; [Since we are not using it.]

A room has a figure name called illustration.

First carry out looking when the illustration of the location is not Figure of cover:
	display the illustration of the location.

Map Room is a room.
[The illustration of Map Room is Figure of Map Room.] [<- This is the line that does not compile.]
First carry out looking in the Map Room: display the Figure of Map Room.

The Library is a room.
The Library is north of the Map Room.
First carry out looking in the Library: display the Figure of Library.

The Workshop is a room.
The Workshop is west of the Map Room.
First carry out looking in the Workshop: display the Figure of Workshop.

Figure of Map Room is the file "map-room-0a.png".
Figure of Library is the file "library-3a.png".
Figure of Workshop is the file "workshop-1a.png".

I’m a bit mystified since my understanding is that the Figure statements associated with the image files are figure names. I’ll continue reading and researching but was wondering if anyone else had any thoughts or suggestions.

The posted code is difficult for me to test in the IDE, however, the compilation error you’ve referenced disappears when I move the line declaring the Figure of map room to before the invocation of it in the offending line. As in:

Map Room is a room.
Figure of Map Room is the file "map-room-0a.png".[<- moved to here]
The illustration of Map Room is Figure of Map Room. [<- This is the line now seems to compile.]

Thanks @BadParser. It didn’t occur to me that the error was being thrown because the figure names associated with the images were not declared at the time I tried to assign them to the individual rooms (it’s always the simplest thing). :man_facepalming:t2:

The GitHub repository has been updated with the corrected code.

1 Like