Question about INFORM7 IF playing from Web Pages

I got an e-mail this morning from a multimedia developer who found my online version of Emily Short’s Metamorphoses, asking some technical questions about whether it is possible to give web-based users tasks to perform in an interactive fiction game, and have the game notify the outside world when the task is completed. I’m reproducing it here with permission.

Dennis,
Hi. I write with something of a request. I wonder if you can help?
I’ve been able to find one of Emily Short’s IF stories playing within a web page on your site <http://jerz.setonhill.edu/if/gallery.metamorp/index.html>. This is the only time I’ve been able to find IF playing this way – most IF seems to get played as a self-standing application – and so I wondered if you might be able to give me some idea about how the web-based IF is accomplished?
As an old (in both senses of the word) player of IF, and now a self-professed multimedia developer, I am trying to see if I can use INFORM7 to write some “tasks” for users of a web-based ‘community’ site that I’m working with. The idea would be bring up a short IF task as an alternative activity for a user who requests one, on the  
web page, get the user to work through it, and get the story to send a message to the web server on successful completion (or on saving, etc.).
If you have time to reply, and if you can help, I would be most grateful.
Regards,
Denis Williamson
Hong Kong

I’m posting my response here, in the hopes that anyone with a better answer will share it.

The Inform system produces game files that run on the Z-machine, which is a virtual machine that exists only in software. When you see an IF game running in a web page, it is probably using Matthew Russoto’s ZPlet, which is a Java interpreter for the Z-machine.  I wouldn’t know how it is possible to send a message from within the virtual machine to the outside world, but my programming skills are very modest, so just because I can’t imagine how to do it doesn’t mean it’s impossible.  I don’t know all that much about the Z machine — Andrew Plotkin or Matthew Russoto would be the ones to ask (both of whom read the rec.arts.int-fiction Usenet group).

It should be a fairly trivial thing to have a small stand-alone ZPlet program that ends with the player finding a magic word, which the user would then just manually key into some other program.  I embedded a few small IF programs in a web page designed to teach my students about exposition in interactive fiction — that might give you some idea of what you can accomplish. I don’t try to communicate to the outside world from within the sample games, but there is some crude interaction (in in the form of questions the web site asks about the in-game experience.)

The Glulx interpreter has some significant multimedia capability, and there is a Java interpreter for Glulx, Zag, by Jon Alfred Zeppeiri. Inform 7 can output gamefiles in the Glulx format.  (It requires the Java Runtime environment to be installed on your local computer, so it’s not as point-and-click simple as ZPlet.)

TADS also has some multimedia capabilities, but it is a completely different system from Inform and I have not recently checked out its capabilities. It has had HTML hyperlinking for some time, so I imagine it should not be too hard to send a message to the outside world.

The website Homestarrunner.com created a flash-based spoof of text adventures called Thy Dungeonman. I don’t know whether the flash code has been released, or whether some other text-adventure fan might have released a homebrew version of the code. But that game was released long before Inform 7, so my guess is the creation of such a flash-based game would be hackish.

I just Googled and found Flashonate, a flash-based z-machine interpreter, by Peter Rogers. He has released the code as GPL.

I hope you will share whatever you learn as you investigate the possibilities.

Update: I posted the question to rec.arts.int-fiction, where the IF gurus are.