Constant Story "The Zippered Container"; Constant Headline "^An Exercise in Containers ^All Rights Given Away to Inform Community^^"; Include "Parser"; Object LibraryMessages, with before [;EmptyT: "The bag is zipped.";]; Include "Verblib"; Include "Grammar"; [Initialise; Banner(); location = PlainRm; lookmode = 2; print "^You are in a plain room with no exits.^ You see a funny-looking bag here.^^"; return 2;]; Object PlainRm "Plain Room" with description "A plain ordinary room with no exits.", cant_go "You end up right where you started!", has light ; Object -> ZipBag "Zippered Bag" with name 'zippered' 'zipper' 'bag', description "this bag is made of indesructable blue cloth and has the obligatory zipper on it.", describe "^There is an indestructable blue cloth bag here with a zipper on it.", before [; open: if (self has open) "The bag is already unzipped."; "The bag can only be unzipped."; close: if (self hasnt open) "The bag is already zipped shut."; "The Bag can only be zipped."; attack,damage: "Read the description again Booby! ",(The)self," can NOT be damaged!"; receive: if (self hasnt open) "You need to unzip the bag before doing that."; move noun to self; "You place ",(the)noun," back inside the bag."; UnZip: if (self has open) "But the bag is already unzipped."; give self open; if (child(self)==0) "You unzip the Bag revealing it to be totally empty."; print "You unzip the Bag revealing:^"; WriteListFrom(child(noun), INDENT_BIT + NEWLINE_BIT + TERSE_BIT + CONCEAL_BIT, 1); rtrue; Zip: if (self hasnt open) "But the Bag is already zipped!"; give self ~open; "You re-zip the Bag.";], has container openable ; Object -> -> BigRock "Big Rock" with name 'big' 'rock', description " A very large rock which barely fits in the bag.", ; Object -> -> SmallRock "Smaller Rock" with name 'smaller' 'rock', description "A slightly smaller rock which fits easily in the bag.", ; Object -> -> TinyRock "Tiny Rock" with name 'tiny' 'rock', description " A Very tiny rock which also fits easily in the bag.", ; [DamageSub; "You can't damage that!";]; [UnZipSub; "You can't unzip that!";]; [ZipSub; "You can't zip that!";]; Verb 'unzip' * noun -> Unzip; Verb 'zip' * noun -> Zip; verb 'damage' * noun -> Damage;