Newsgroups: rec.arts.int-fiction
Subject: Inform: timed delay
From: tim.middleton@canrem.com (Tim Middleton)
Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!ka.sub.net!xlink.net!howland.reston.ans.net!math.ohio-state.edu!news.cyberstore.ca!vanbc.wimsey.com!fonorola!portnoy!canrem.com!tim.middleton
Distribution: world
Message-ID: <60.5806.4154.0N1E7E6B@canrem.com>
Date: Wed, 21 Jun 95 10:22:00 -0500
Organization: CRS Online  (Toronto, Ontario)
Lines: 58

I've seen a few people at various times in the past asking about delay
routines in inform -- something to pause for a specified amount of time. I
was playing around with it today and came up with something someone might
find useful, although it's not a very optimal solution (perhaps someone has
something better). Anyhow it simply is these two functions:

 [ EndTimer; return 1; ];
 [ Delay t k; read_char 1 t #r$EndTimer k; ];

Put those into your code somewhere and then you can call DELAY(n) where n is
the number of seconds (I've heard seconds are not necessarily accurate in
z-machine though, so don't count on exact precision) you want to pause.

The biggest limitation of this routine is that if a key is pressed the pause
aborts immediately... so it can't FORCE a pause, but as long as no keys are
pressed it will wait for however many seconds you ask it to.

Here's a quick (annoyingly) hacked "shell" Demo if anyone wants to give it a
quick try (has to be an advanced story to use the read_char function)...

 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

 Switches dsv5x;
 Constant Story "SHELL";
 Constant Headline "^An non-Interactive Delay Timer Test.^";

 Include "Parser";
 Include "VerbLib";

 Object Blank_Room "Blank Room"
   with description "An empty room."
   has  light;

 [ EndTimer; return 1; ];
 [ Delay t k; read_char 1 t #r$EndTimer k; ];

 [ Initialise;
   location=Blank_Room;
   Print "^^^^^Wel";    delay(1);
   Print "come ";       delay(2);
   print "to ";         delay(2);
   print "the ";        delay(2);
   print "horribly ";   delay(5);
   print "annoyingly "; delay(5);
   print "delayed ";    delay(5);
   print "shell";       delay(1);
   print "."; delay(1); print "."; delay(1); print "."; delay(1);
   "^^";
 ];

 Include "Grammar";
 end;

 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


---
  ...with love and a banana fish.          <as544@torfree.net>
