Turning Inform 7 list into Inform 6 array

My next thing I’m working on for Bisquixe is to add image support.

The Quixe interpreter actually already has image support, it just requires a manual setup phase where you have to use a tool or type in a list of javascript objects for each object.

I’d like to automate that. I have some ideas on what to do on the quixe end (I’m going to model some of the pre-existing code that uses arrays, and just use jquery to manually set the game_options info when play begins.)

However, I need to send everything to quixe through inform 6.

So my current plan is to do something like:

To image-upload (currentList - a list of names of figures):
	(- convert {currentList} to array somehow;
	glk_add_images(thatarray)
       -)

I imagine I’d actually need to split it up, since 4 things have to be passed (the glulx id number, the url, the height and the width). So something like:

  1. Create a list of the id numbers, and pass it to a global inform 6 array.
  2. Create a list of urls, and pass it to a global inform 6 array.
  3. Likewise create global inform arrays for height and width.
  4. Shove them all into my new glk_add_images() function which will have 4 arrays as input.

The part where I’m stuck is how to get the inform 7 list and make it an inform 6 array. So far I haven’t used any code that mixes Inform 6 and Inform 7, and I haven’t created any global inform 6 variables to be used in one function and passed to another.

If this works, I won’t have to add any image code to Bisquixe, as Quixe already has a lot.

2 Likes

The original plan was that the I7 compiler should do this work. After all, I7 figured out the list of images in the first place; it knows where they all are.

This got filed (https://inform7.atlassian.net/jira/software/c/projects/I7/issues/I7-2383) but nobody seems to have tackled it.

2 Likes

That makes a lot of sense, especially since you already made that nice python script that does it automatically!

I’m still going to try learning this stuff (arrays would be useful for many purposes), but it would be neat to see it added to the compiler itself!