Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!newsserver.jvnc.net!newsserver2.jvnc.net!howland.reston.ans.net!spool.mu.edu!news.cs.indiana.edu!shulick@cherry.ucs.indiana.edu
From: "Sam Hulick" <shulick@cherry.ucs.indiana.edu>
Subject: Inform: CorpseDropsAll()
Message-ID: <1995Aug19.143105.25878@news.cs.indiana.edu>
Organization: Vallen Software
Date: Sat, 19 Aug 1995 14:30:56 -0500
Lines: 49


Just some more code for y'all.  Perhaps when your NPCs die, you want
them to drop their items.  This routine is kinda sloppy.. feel free to
touch it up.

[ CorpseDropsAll o hasC;
   print "As "; if (self has female) print "she"; else print "he";
   print " dies, "; if (self has female) print "she"; else print "he";
   print " drops everything to the floor";

   hasC = 0;
   for (o = child(self): o ~= 0: o = sibling(o))
   {
      if (o has clothing && o has worn) hasC = 1;
   }

! Not too efficient, bleah.. but it works.
   for (o = child(self): o ~= 0:)
   {
      if (o has clothing && o has worn)
         o = sibling(o);
      else
      {
         move o to parent(self);
         o = child(self);
      }
   }

   if (hasC == 0) print ".^";
   else
   {
      print ", except ", (Poss) self, " clothing (";
      WriteListFrom(child(self), ENGLISH_BIT + RECURSE_BIT + TERSE_BIT);
      print ").^";
   }

   rtrue;
];

[ Poss o;
   if (o hasnt animate) print "its";
   else { if (o has female) print "her"; else print "his"; }
];

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