Using external files, together with a simple Unix script running in the background, to provide live news headlines inside a story file.

This example can only work if we have a separate program running in the background while the story file is being played, and as such it will only work if we set things up in a special way. Exactly how to do this will vary from platform to platform.

First, the source text for the Inform end of the communication line:

"Flathead News Network"
The file of RSS Requests is called "rssrequest".
The file of RSS Responses (owned by project "RSS-SCRIPT") is called "rssreply".
To request (RSS feed address - text):
   mark the file of RSS Responses as not ready to read;
   write the RSS feed address to the file of RSS Requests.
Newsroom is a room. "This is the secret nerve-centre of FNN, the Flathead News Network."
The BBC button is in the Newsroom. Instead of pushing the BBC button: say "Bong!"; request "".
The NASA button is in the Newsroom. Instead of pushing the NASA button: say "Bang!"; request "".
The WHO button is in the Newsroom. Instead of pushing the WHO button: say "Bing!"; request "".
A screen is in the Newsroom.
Instead of examining the screen:
   if ready to read the file of RSS Responses, say "From the screen you read:[line break][text of the file of RSS Responses]";
   otherwise say "The screen remains blank for now."

As far as the story file is concerned, then, it sends a request down the communication line by writing the chosen RSS feed to the file named "rssrequest", and expects a reply to come back down the line by being written to the file "rssreply". However, the story file needs to expect that this might take some time. (Maybe forever, if there is no program responding, or if the Internet connection is not working.) The story file marks the "rssreply" file as not ready before it makes a request; if it subsequently finds that the file is now ready, that must mean that the other program has done the honours, and that all is well. In the mean time, "The screen remains blank for now."

Now for the RSS-SCRIPT program. The following provides a crude but workable program suitable for running as a Perl script on a system which provides the standard Internet fetching program "curl": Mac OS X, for instance. (If you have OS X, you can paste the following into a (Unix-format) text file called "", place it in your home folder, open the Terminal utility, type "perl", and then hide the Terminal window again.)

for (;;) { # repeat forever:
   system("sleep 1"); # wait 1 second
   open REQUEST, "rssrequest.glkdata" or next;
   # the request file has been detected:
   $header_line = <REQUEST>; # the header line
   $rss_feed = <REQUEST>; # the actual content - the RSS feed URL
   close REQUEST;
   if ($header_line =~ m/^\*/) { # if the request file is marked ready
      $rss = system("curl $rss_feed >rawrss.txt"); # download the RSS feed
      # read the RSS XML into a single Perl string:
      open RAWRSS, "rawrss.txt" or next;
      $raw = "";
      while ($nl = <RAWRSS>) {
         $raw = $raw." ".$nl;
      close RAWRSS;
      # look for the title and description of the first item:
      if ($raw =~ m/\<item\>\<title.*?\>(.*?)\<\/title\>.*?\<description.*?\>(.*?)\<\/description\>/) {
         # write the reply:
         open REPLY, ">rssreply.glkdata" or next;
         print REPLY "* //RSS-SCRIPT// rssreply\n", $1, "\n", $2, "\n";
         close REPLY;
         # request safely dealt with, so we can remove it:
         system("rm 'rssrequest.glkdata'");