Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!Dortmund.Germany.EU.net!Germany.EU.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!lerc.nasa.gov!purdue!news.cs.indiana.edu!shulick@guava.ucs.indiana.edu
From: "Sam Hulick" <shulick@guava.ucs.indiana.edu>
Subject: Re: Inform: How to tell diff. between a room & an item?
Message-ID: <1995Sep12.122438.5461@news.cs.indiana.edu>
Organization: Vallen Software
References: <1995Sep9.184839.13884@news.cs.indiana.edu> <GDR11.95Sep10174242@stint.cl.cam.ac.uk>
Date: Tue, 12 Sep 1995 12:24:33 -0500
Lines: 36

gdr11@cl.cam.ac.uk (Gareth Rees) writes:
>"Sam Hulick" <shulick@guava.ucs.indiana.edu> wrote:
>> How can one tell if an object 'o' is a room or an item?
>
>There is no way in Inform to do this.  Items and rooms are the same
>kinds of data.  You could even use a room as an item or an item as a
>room, as long as you were careful with the various aliased properties.
>
>Perhaps if you explained why you need to know whether an object is a
>room or not, then I could suggest a sensible work-round.
>

For my "missed" meta verb.  Right now I check for a room if parent(o) ==
zero and o.&name = 0.  But recently, I've found that I might want to use
the name property on rooms.. so now what?

[ MissedSub o sc;
   print "Items are ", OBJECT_SCORE, " points, rooms are ", ROOM_SCORE, ".^";
   for (o = selfobj+1: o <= top_object: o++)
   {
      if (o has scored && o hasnt visited && o hasnt moved)
      {
         print "You missed "; PrintShortName(o);
         if (parent(o) == 0 && o.&name == 0) { print " (room)"; sc = sc + ROOM_SCORE; }
         else { print " (item)"; sc = sc + OBJECT_SCORE; }
         print ".^";
      }
   }
   print "This accounts for a total of ", sc, " points.^";
];

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