Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!newsserver.jvnc.net!newsserver2.jvnc.net!netnews.upenn.edu!dsinc!spool.mu.edu!sdd.hp.com!swrinde!sgigate.sgi.com!sgiblab!news.cs.indiana.edu!shulick@guava.ucs.indiana.edu
From: "Sam Hulick" <shulick@guava.ucs.indiana.edu>
Subject: Re: Dials in Inform
Message-ID: <1995Sep4.232440.1990@news.cs.indiana.edu>
Organization: Vallen Software
References: <1995Aug22.014214.4726@rs6000.cmp.ilstu.edu>
Date: Mon, 4 Sep 1995 23:24:35 -0500
Lines: 37

ceforma@rs6000.cmp.ilstu.edu (Christopher E. Forman) writes:
>What's the simplest way to implement a dial that can be set to any number
>between 1 and 10 in Inform?

The following exists in library/parser.h:

Verb "set" "adjust"
                * noun                           -> Set
                * noun "to" special              -> SetTo;

So there you have it.  The following was tested and does work. :)

Object dial "funky dial"
 with  name "dial",
       description [;
          print "A dial, with a pointer that points to one of ten \
                 numbers.  It is currently set to ";
          EnglishNumber(self.number);
          ".";
       ],
       number 1,
       before [;
        SetTo: if (special_number < 1 || special_number > 10)
                  "You can only set it between one and ten.";
               if (self.number == special_number)
                  "It is already set to that number.";
               self.number = special_number;
               print "The dial clicks as you turn it to ";
               EnglishNumber(self.number); ".";
       ],
 has   static;

-- 
--- Sam Hulick ------------- shulick@indiana.edu ---------------------
Systems Consultant        | Homepage:
Indiana College Placement |    http://copper.ucs.indiana.edu/~shulick/
  and Assessment Center   | PGP public key available on request
