// // Plural-Singular TADS 2.2 Utility by Andrew Pontious © 1996 // // In general, this changes all error or informational messages written up in // ADV.t so that they are sensitive to the true/false property isThem. If // isThem = true for an object, any error message generated by ADV.t will give // it the plural designation. The one message generated by the parser itself // dealing with object pronouns is when you don't include an indirect object // in a verb which requires one, for example, if you write "put ball" and // that's it. The parser will say, "What do you want to put it on?" There's no // way to make the pronoun isThem-sensitive in this version of TADS, so // instead I change the pronoun entirely to "that" (see the end of this // utility). WorldClass's way of dealing with this is to take out the pronoun // entirely, so you'd get a parser response like "On What?" // Also the original code has been tightened up and streamlined // using the << >> marks for embedding expressions in a string and the // <<{condition} ? {true-expression} : {false-expression}>> for embedding // conditional text-printing in a string, instead of ending the string and // switching to if/else statements. Compare this to the original ADV.t // to see the difference. // Last change! The format strings were reworked so they would reflect // isThem; while I was at it, I decided to have them reflect isHer. // If you don't set isHer, isHim, or isThem, I've made the format strings // say "it," WHICH IS DIFFERENT from the Actor default, which was to use // the "he" variants. I decided to do so that you wouldn't have to fiddle // with the strings to have them say "it" (say for a swamp monster, etc.), // you'd just have to add isHim to all your masculine actors who have been // getting by using the default in the past. // Note: there seems to be a typo in ADV.t's showcontcont routine. It // flips around the isqcontainer test so that it shows the contents // of isqcontainer = true object and doesn't show them when it's false! // This is in direct contradiction to the directions in the notes before // listcontcont, which say to set isqcontainer to true if you don't want // the contents listed. In my modification, I fixed this. // Note #2: normal ADV.t has no error message if you try to lock a // lockable with a key when it doesn't need a key and it's not already locked. // If it is locked, you get "It's already locked" or something similar, but // nothing otherwise. That case "falls through the cracks." Same for unlock. // So I added appropriate error messages to lockable. // // Modified Functions from ADV.t // // Modifications to Showcontcont replace showcontcont: function( obj ) { if( itemcnt( obj.contents )) { if( obj.issurface ) { if( not obj.isqsurface ) // Error in ADV.t? "Not" was missing { /* * Changed "is," whose plurality depends on results of * of listcont, which can't be evaluated easily from here, * to more clumsy but workable "can be seen". */ "Sitting on <>, "; listcont( obj ); " can be seen. "; } } else if ( obj.contentsVisible and not obj.isqcontainer ) { "\^<> seem<> to contain "; listcont( obj ); ". "; } } if ( obj.contentsVisible and not obj.isqcontainer ) listfixedcontcont( obj ); } // // Modified Objects from ADV.t // // Modifications to Thing: Object modify thing // Automatically leave off "a" from adesc if plural adesc = { "<><>"; } // Automatically leave off "s" from end of pluraldesc if plural pluraldesc = { "<><>"; } // Probably best to change this rather than leave this default. ldesc = { "<> like << self.isThem ? "" : "an">> ordinary <> to %me%."; } circularMessage(io) = { local cont; "%You% can't put <> in <>, because <> <> <> <> <>"; for (cont := io.location ; cont <> self ; cont := cont.location) { ", which <> "; if (cont.location = self) "already "; "<> <>"; } "."; } verDoPutIn( actor, io ) = { if ( io = nil ) return; if ( self.location = io ) { "\^<> <> already in <>! "; } else if (io = self) { "%You% can't put <> in <>! "; } else if (io.isIn(self)) self.circularMessage(io); else self.verifyRemove( actor ); } verDoPutOn( actor, io ) = { if ( io = nil ) return; if ( self.location = io ) { "\^<> <> already on <>! "; } else if (io = self) { "%You% can't put <> on <>! "; } else if (io.isIn(self)) self.circularMessage(io); else self.verifyRemove( actor ); } verDoTakeOut( actor, io ) = { if ( io <> nil and not self.isIn( io )) { "\^<> <>n't in <>. "; } self.verDoTake(actor); /* ensure object can be taken at all */ } verDoTakeOff( actor, io ) = { if ( io <> nil and not self.isIn( io )) { "\^<> <>n't on <>. "; } self.verDoTake(actor); /* ensure object can be taken at all */ } verDoAskAbout( actor, io ) = { "Surely, %you% can't think <> know<> anything about <>! "; } verDoTellAbout( actor, io ) = { "It doesn't look as though <> <> interested. "; } verDoEat( actor ) = { "\^<> do<>n't appear appetizing. "; } verDoDrink( actor ) = { "\^<> do<>n't appear appetizing. "; } doShowTo( actor, io ) = { if( io <> nil ) "\^<> <>n't impressed. "; } verIoShowTo( actor ) = { "\^<> <>n't impressed. "; } verDoClean( actor ) = { "\^<> look<> a bit cleaner now. "; } doCleanWith( actor, io ) = { "\^<> look<> a bit cleaner now. "; } verIoMoveWith( actor ) = { "\^<> do<>n't seem to help. "; } ; // Modifications to SwitchItem: Fixeditem modify switchItem doSwitch( actor ) = { self.isActive := not self.isActive; "Okay, <> <> now switched "; if ( self.isActive ) "on"; else "off"; ". "; } verDoTurnon( actor ) = { /* You can't turn on something in the dark unless you're carrying it. You also can't turn something on if it's already on. */ if (not actor.location.islit and not actor.isCarrying(self)) "It's pitch black."; else if ( self.isActive ) "<> already turned on! "; } doTurnon( actor ) = { self.isActive := true; "Okay, <> now turned on. "; } verDoTurnoff( actor ) = { if ( not self.isActive ) "<> already turned off! "; } doTurnoff( actor ) = { self.isActive := nil; "Okay, <> now turned off. "; } ; // Modifications to Actor: MovableActor: Qcontainer modify movableActor actorAction( v, d, p, i ) = { "\^<> do<>n't appear interested. "; exit; } actorDesc = { "\^<> <> here. "; } verGrab( item ) = { "\^<> <> carrying "; item.thedesc; " and won't let %youm% have it. "; } verDoFollow( actor ) = { "But <> <> right here! "; } // these properties are for the format strings // See the note at the very beginning. fmtYou = { if (self.isThem) "they"; else if (self.isHer) "she"; else if (self.isHim) "he"; else "it"; } fmtYour = { if (self.isThem) "their"; else if (self.isHer) "her"; else if (self.isHim) "his"; else "its"; } fmtYoure = { if (self.isThem) "they're"; else if (self.isHer) "she's"; else if (self.isHim) "he's"; else "it's"; } fmtYoum = { if (self.isThem) "them"; else if (self.isHer) "her"; else if (self.isHim) "him"; else "it"; } fmtYouve = { if (self.isThem) "they've"; else if (self.isHer) "she's"; else if (self.isHim) "he's"; else "it's"; } fmtS = "<>" fmtEs = "<>" fmtHave = "<>" fmtDo = "<>" fmtAre = "<>" fmtMe = { self.thedesc; } disavow = "\"<> don't know much about that.\"" ioGiveTo(actor, dobj) = { "\^<> reject<> the offer."; } sayLeaving = "\n\t\^<> leave<> the area." sayArriving = "\n\t\^<> enter<> the area." ; // Modifications to Follower: Actor modify follower ldesc = { caps(); self.thedesc; " <> no longer here. "; } dobjGen(a, v, i, p) = { if (v <> followVerb) { "\^<< self.myactor.thedesc >> <> no longer here."; exit; } } iobjGen(a, v, d, p) = { "\^<< self.myactor.thedesc >> <> no longer here."; exit; } ; // Modifications to Decoration: Fixeditem modify decoration dobjGen(a, v, i, p) = { if (v <> inspectVerb) { "\^<> <>n't important."; exit; } } ; // Modification to DistantItem: Fixeditem modify distantItem dobjGen(a, v, i, p) = { if (v <> inspectVerb) { "<> too far away. "; exit; } } ; // Modifications to Doorway: Fixeditem, Obstacle modify doorway verDoOpen( actor ) = { if ( self.isopen ) "<> already open. "; else if ( self.islocked ) "<> locked. "; } verDoClose( actor ) = { if ( not self.isopen ) "<> already closed. "; } verDoLock( actor ) = { if ( self.islocked ) "<> already locked! "; else if ( not self.islockable ) "<> can't be locked. "; else if ( self.isopen ) "%You%'ll have to close <> first. "; } verDoUnlock( actor ) = { if ( not self.islocked ) "<> not locked! "; } verDoLockWith( actor, io ) = { if ( self.islocked ) "<> already locked. "; else if ( not self.islockable ) "<> can't be locked. "; else if ( self.mykey = nil ) "%You% %do%n't need anything to lock <>. "; else if ( self.isopen ) "%You%'ll have to close <> first. "; } doLockWith( actor, io ) = { if ( io = self.mykey ) { "Locked. "; self.islocked := true; if ( self.otherside ) self.otherside.islocked := true; } else "<>n't fit the lock. "; } verDoUnlockWith( actor, io ) = { if ( not self.islocked ) "<> not locked! "; else if ( self.mykey = nil ) "%You% %do%n't need anything to unlock <>. "; } doUnlockWith( actor, io ) = { if ( io = self.mykey ) { "Unlocked. "; self.islocked := nil; if ( self.otherside ) self.otherside.islocked := nil; } else "<>n't fit the lock. "; } ldesc = { if ( self.isopen ) "<> open. "; else { if ( self.islocked ) "<> closed and locked. "; else "<> closed. "; } } ; // Modifications to Openable: Container modify openable replace ldesc = { caps(); self.thedesc; if ( self.isopen ) { " <> open. "; pass ldesc; } else { " <> closed. "; /* if it's transparent, list its contents anyway */ if (isclass(self, transparentItem)) pass ldesc; } } verDoOpen( actor ) = { if ( self.isopen ) { caps(); self.thedesc; " <> already open! "; } } verDoClose( actor ) = { if ( not self.isopen ) { caps(); self.thedesc; " <> already closed! "; } } verIoPutIn( actor ) = { if ( not self.isopen ) { caps(); self.thedesc; " <> closed. "; } } verDoLookin( actor ) = { /* we can look in it if either it's open or it's transparent */ if (not self.isopen and not isclass(self, transparentItem)) "<> closed. "; } ; // Modify Lockable: Openable modify lockable verDoOpen( actor ) = { if ( self.islocked ) { "<> locked. "; } else pass verDoOpen; } verDoLock( actor ) = { if ( self.islocked ) { "<> already locked! "; } } doLock( actor ) = { if ( self.isopen ) { "%You%'ll have to close "; self.thedesc; " first. "; } else { "Locked. "; self.islocked := true; } } verDoUnlock( actor ) = { if ( not self.islocked ) "<> not locked! "; } verDoLockWith( actor, io ) = { if ( self.islocked ) "<> already locked. "; // ** New ** ADV.t forgot that you need error message here for // lockables if you try to lock WITH something else if (self.mykey = nil) "%You% %do%n't need anything to lock <>. "; } verDoUnlockWith( actor, io ) = { if ( not self.islocked ) "<> not locked! "; // ** New ** ADV.t forgot that you need error message here for // lockables if you try to unlock WITH something else if (self.mykey = nil) "%You% %do%n't need anything to unlock <>. "; } ; // Modifications to KeyedLockable: Lockable modify keyedLockable doLockWith( actor, io ) = { if ( self.isopen ) { "%You% can't lock << self.thedesc >> when <> open. "; } else if ( io = self.mykey ) { "Locked. "; self.islocked := true; } else "<>n't fit the lock. "; } doUnlockWith( actor, io ) = { if ( io = self.mykey ) { "Unlocked. "; self.islocked := nil; } else "<>n't fit the lock. "; } ; // // Use of 2.2 Feature ParseError: // parseError: function( num, str ) { if( num = 141 ) return ' that '; else return nil; }