/* First of all, a class for complex items. It does nothing except say * yes, they are complex. */ class complex: item iscomplex = true ; /* Okay. What we have here is a new function I created. It looks much * like listcont, but is only ( and always ) called to get the item * listing for a room. Hopefully, hopefully, hopefully, this will * allow us to give long descriptions for some objects, and short ones * for the rest. Note the long descs are only used in room listings, not * for containers. */ roomcont: function( obj ) { local i, count, tot, ctot, stot, list, slist, clist, cur, disptot; count := 0; list := obj.contents; slist := []; clist := []; tot := length( list ); i := 1; /* The first thing to do is to sort the items. Items with complex descriptions * are added to the c(omplex)list, and everything else is added to the * s(imple)list. */ while ( i <= tot ) { cur := list[i]; if ( cur.iscomplex ) { clist := clist + cur; } else { slist := slist + cur; } i := i + 1; } /* Now we can define some things. And reset i, the generic counter. */ ctot := length( clist ); stot := length( slist ); disptot := itemcnt ( slist ); i := 1; /* Print the items on the clist first... */ if ( ctot ) { while ( i <= ctot ) { cur := clist[i]; cur.cdesc; // list this object's cdesc if ( cur.islamp and cur.islit ) " (providing light)"; /* (Do we need extra space or not?) */ if ( not ( ( i + 1 ) > ctot ) ) { " "; } i := i + 1; } } /* ...reset values... */ i := 1; /* ...and go on and print the items with normal descs, as usual. */ if ( stot ) { /* Do we need some spaces first? */ if ( ctot ) " "; /* Now, let's proceed. */ "You see "; while ( i <= stot ) { cur := slist[i]; if ( cur.isListed ) { if ( count > 0 ) { if ( count+1 < disptot ) ", "; else if (count = 1) " and "; else ", and "; } count := count + 1; cur.adesc; // list this object if ( cur.islamp and cur.islit ) " (providing light)"; } i := i + 1; } " here."; } } /* Now, all that's left is to modify the function used to look around... */ modify room nrmLkAround( verbosity ) = // lookAround without location status { local l, cur, i, tot; if ( verbosity ) { "\n\t"; self.ldesc; l := self.contents; tot := length( l ); i := 1; while ( i <= tot ) { cur := l[i]; if ( cur.isfixed ) cur.heredesc; i := i + 1; } } "\n\t"; if (itemcnt( self.contents )) { roomcont( self ); } listcontcont( self ); "\n"; l := self.contents; tot := length( l ); i := 1; while ( i <= tot ) { cur := l[i]; if ( cur.isactor ) { if ( cur <> Me ) { "\n\t"; cur.actorDesc; } } i := i + 1; } } ; /* And voila! Pretty cool, eh? Yes, I know it is rather kludgey, and possibly * buggy. Sorry. All comments to scythe@u.washington.edu. Please do not claim * this work as your own, but please feel free to use and distribute. Thank you */ /* All that is needed to make an item complex is to make it class complex, * and give a cdesc for it. For example: * nugget: complex, item * sdesc = "gold nugget" * ldesc = "It's a nugget of gold!" * cdesc = "A glittering gold nugget is here." * [...and so on.] * Enjoy! */