I7 - Printing the reference_ID of an included BLORB Figure

I need the reference_ID of each image I include as a Figure in Inform 7.

I’m assuming there is a way to wrap an I6 function with I7 for this, but am not sure how to do it.

This is for Zifmia. When an author uploads their BLORB file, the Zifmia server will unpack all the parts and store them in their proper places. The ULX file will be added to the database as a game and the image and sound files will be copied to an HTML sub-folder for relative reference by the game play web page.

The author would include their spot art as Figures and then reference them in text with some markup such as [show Figure 1 on the left].

So the entire code might look like this:

The Figure of the Barren Valley is the file “barrenvalley.png”.

The Barren Valley is a room. “[Show Figure of the Barren Valley on the left]You are in a barren valley, dust packed hillocks pock either side with a muddy trail leading north.”

This would be printed as markup that Zifmia will translate to HTML.

So the actual output will be:

[image 3 png left ‘Barren Valley’]You are in a barren valley, dust packed hillocks pock either side with a muddy trail leading north.

And Zifmia will look for the [image tag and translate it so the text becomes:

Barren ValleyYou are in a barren valley, dust packed hillocks pock either side with a muddy trail leading north.

The author can place spot art on the left side of a paragraph (wrapped), right side of a paragraph (wrapped), left of the main column but aligned with the top of the paragrah, right of themain column but aligned with the top of the paragraph, or as a modal popup CSS window. These translate roughly as:

[show the figure of the barren valley embedded on the left]
[show the figure of the barren valley embedded on the right]
[show the figure of the barren valley separate on the left]
[show the figure of the barren valley separate on the right]
[show the figure of the barren valley popup]

Sounds will be handled differently since they’re not localized to any particular piece of text.

If someone could help with the reference_ID printing and the show printing action, I would appreciate it.

David C.

The Blorb ID of a figure is contained in the ResourceIDsOfFigures table. You can get at it like this (slightly simplified from the Standard Rules):

To display (F - figure name): (- DisplayFigure(ResourceIDsOfFigures-->{F}); -)

–Erik

Okay - so I have:

To display (F - figure name): (- DisplayFigure(ResourceIDsOfFigures–>{F}); -)

To embed left (F - figure name):
say "[bracket]image “;
display “[name of F]”;
say " embed left[bracket]”.

But this isn’t working. How do I call the display phrase within my embed phrase?

David C.

Sorry, I didn’t realize that you also weren’t sure how to print the result. Here’s one way:

[code]When play begins:
Show Figure of Forked Road on the left.

To decide what number is reference of (F - figure name): (- ResourceIDsOfFigures–>{F} -).

To show (F - a figure name) on the left:
say “[bracket]image [reference of F] embed left[close bracket]”.[/code]

–Erik

Yeah - still a newbie in many ways.

Here are the additional lines for the zifmia extension…

To decide what number is reference of (F - figure name): (- ResourceIDsOfFigures–>{F} -).
To say embed (F - a figure name) on the left: say “[bracket]embed left [reference of F] ‘[F]’[close bracket]”.
To say embed (F - a figure name) on the right: say “[bracket]embed right [reference of F] ‘[F]’[close bracket]”.
To say place (F - a figure name) on the left: say “[bracket]place left [reference of F] ‘[F]’[close bracket]”.
To say place (F - a figure name) on the left: say “[bracket]place right [reference of F] ‘[F]’[close bracket]”.
To say popup (F - a figure name): say “[bracket]popup [reference of F] ‘[F]’[close bracket]”.

…which allows:

Figure 1 is the file “cloak-small.png”.

Foyer of the Opera House is a room. “[embed Figure 1 on the left]You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. The entrance from the street is to the north, and there are doorways south and west.”

…and prints…

[embed left 3 “Figure 1”]You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. The entrance from the street is to the north, and there are doorways south and west.

…which will translate to…

Figure 1You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. The entrance from the street is to the north, and there are doorways south and west.

I’m sure someone might ask why I don’t do the HTML conversion within I7 and we have to remember, the output of I7 shouldn’t know anything about implementation. It will tell us we should display an image, that it should be embedded with the text, and on the left…but it doesn’t know how we intend to do that. It does not care. If were implementing the client in iOS, we could handle this entirely differently than a browser, but we would have all the information we need to display the image.

Thanks a bunch,

David C.

…although now that I think about it, I should probably use JSON…

{“reference:”,3,“placement:”,“left”,“embed:”,“true”,“alternateText:”,“Figure 1”}

David C.