Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!Dortmund.Germany.EU.net!Germany.EU.net!howland.reston.ans.net!vixen.cso.uiuc.edu!usenet.ucs.indiana.edu!news.cs.indiana.edu!shulick@guava.ucs.indiana.edu
From: "Sam Hulick" <shulick@guava.ucs.indiana.edu>
Subject: Inform giftware: "gonear" replacement
Message-ID: <1995Sep9.235721.23190@news.cs.indiana.edu>
Organization: Vallen Software
Date: Sat, 9 Sep 1995 23:57:09 -0500
Lines: 52


Another gift for you Inform coders out there.  Here is a replacement
"gonear" that checks for objects that either have no location, or are in
many rooms at once.  Enjoy.

[ GonearSub x cc inp ch;
   if (noun in nothing && noun.&found_in == 0)
   {
      PrintShortName(noun); " has no location, though.";
   }
   if (noun.&found_in == 0)
   {
      x = noun;
      while (parent(x) ~= 0) x = parent(x);
      PlayerTo(x);
   }
   else
   {
      x = noun;
      print "Object ~"; PrintShortName(noun); print "~ has a found_in property.^";
      print "Please choose one of its locations:^";
      x = (noun.&found_in)-->0;
      cc = 0;
      while (x >= selfobj+1 && x <= top_object)
      {
         print "   ", cc, ") "; PrintShortName(x); print "^";
         cc++;
         x = (noun.&found_in)-->cc;
      }
      print "^Choose: ";

      for (::)
      {
         @read_char 1 0 0 inp;
         ch = inp - '0';
         inp = (noun.&found_in)-->ch;
         if (inp >= selfobj+1 && inp <= top_object)
         {
            PrintShortName(inp); print "^";
            PlayerTo(inp);
            break;
         }
         else "^Invalid choice.";
      }
   }
];

-- 
--- 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
