Ah, yes, <" ; + GiveTopic matchTopic(fromActor, obj) { /* we match any coin */ return obj.ofKind(Coin) ? matchScore : nil; } handleTopic(fromActor, obj) { /* accept the coin into my actor's inventory */ obj.moveInto(getActor()); /* add our special report */ gTranscript.addReport(new AcceptCoinReport(obj)); /* register for collective handling at the end of the command */ gAction.callAfterActionMain(self); } afterActionMain() { /* * adjust the transcript by summarizing consecutive coin * acceptance reports */ gTranscript.summarizeAction( {x: x.ofKind(AcceptCoinReport)}, {vec: '\^' + getActor().theName + ' accepts the ' + spellInt(vec.length()) + ' coins. ' }); } ; + AskForTopic [ironKey, brassKey, rustyKey] handleTopic(fromActor, topic) { ">, very interesting...
So, you want a key, do you? Let's see... "; SimpleLister.showSimpleList(topic.inScopeList + topic.likelyList); "..."; } ; class AcceptCoinReport: MainCommandReport construct(obj) { /* remember the coin we accepted */ coinObj = obj; /* inherit the default handling */ gMessageParams(obj); inherited('Bob accepts {the obj/him}. '); } /* my coin object */ coinObj = nil ; bill: Person 'bill' 'Bill' @livingRoom isProperName = true isHim = true obeyCommand(issuer, action) { return true; } wantsFollowInfo(obj) { return true; } /* * Make Bill go after Bob. This normally wouldn't be important, * since the relative order of actor turns is usually arbitrary, but * we want our test scripts to be stable so we establish a fixed * order. We accomplish the order adjustment simply by giving Bill a * slightly higher schedule order than the default. */ calcScheduleOrder() { inherited(); scheduleOrder += 1; } ; livingRoom: HouseRoom roomName = 'Living Room' destName = 'the living room' desc = "It's a nice, big room. A potted plant is the only attempt at decoration. Passages lead north, east, and west. To the south, the front door of the house leads outside. " north = diningRoom east = den south = frontDoor out asExit(south) west = platformRoom ; + tricycle: Vehicle, BasicChair 'tricycle/trike' 'tricycle' "It's a child's three-wheeled bike. " gaveInstructions = nil allowedPostures = [sitting] /* * Customize the travel arrival/departure messages for certain types * of connectors. The default message is of the form "The tricycle * (carrying whoever) arrives from the east." This isn't great for * the tricycle, which only carries one rider, and which only goes * when the rider makes it go; a better message would be "Bob rides * the tricycle in from the east," which better captures that the * rider is the one making the tricycle go somewhere. */ sayArrivingDir(dir, conn) { local actor = getTravelerActors()[1]; "<
Actuarial Life Insurance Company! Call for best rates! (800)555-1212!" ; ++ DefaultConsultTopic "You can't find any such listing. "; /* ------------------------------------------------------------------------ */ /* * Platform room */ platformRoom: HouseRoom 'Platform Room' 'the platform room' "This room is obviously highly contrived. Filling one end of the room is a platform, almost like a theater stage, raised a couple of feet above the floor. At opposite ends of the platform are two smaller platforms, one red and one blue; atop each smaller platform is a chair of the same color as its platform. In the center of the main platform is a raised dais, upon which <
Oh, hi!he says.
I\'d sure like to talk to you about life insurance.<.convnode sales-1> " ; +++ ByeTopic, ShuffledEventList ['
I have to go,you say. <.p>
Thanks for your time!the salesman says. ', '
Thanks, but not right now,you say. <.p>
I\'ll be here when you\'re ready!the salesman says. '] ; +++ ImpByeTopic, ShuffledEventList ['The salesman waves.
Okay, I\'ll wait here!he says. ', '
Thanks for your time!the salesman says. ', 'The salesman calls after you,
I\'ll be here if you need me!'] ; ++ ConvNode 'sales-hello' npcGreetingMsg = "<.p>The man in the bad suit walks up to you and extends his hand; by habit you shake his hand.
Hello, friend! My name is Ron, and I represent the Acturial Life Insurance Company.He releases your hand after a vigorous shaking.
You know, a lot of people I talk to don't know just how important life insurance is to proper financial planning. Let me ask you this: do you have all the life insurance coverage you and your family need?" npcContinueList: CyclicEventList { [ 'The salesman says eagerly,
Really, do you have enough insurance?', 'Ron says,
The sad fact is, most people don\'t know how much insurance they really need. I\'d really like to tell you about our policies...<.convnode sales-1> ' ]} ; +++ YesTopic "
I'm covered,you say. <.p>Ron smiles and nods.
You know, a lot of people think they're covered. But have you really read your insurance policy? Most insurance policies have so many exclusions and limitations that you just can't rely on them. That's why Acturial Life created a new kind of insurance policy. Let me tell you about it...<.convnode sales-1> " ; +++ NoTopic "
Why, no,you say. <.p>Ron smiles eagerly.
Well, then it's a good thing I was in your neighborhood today! Let me tell you about our policies...<.convnode sales-1> " ; ++ ConvNode 'sales-1' npcGreetingMsg = "<.p>Ron walks up to you.
Hello again, friend! It would be my pleasure to help you with your insurance needs." npcContinueList: ShuffledEventList { ['The salesman looks serious for a moment.
Most people don\'t know this, but death is our number one killer,he says earnestly. He goes back to smiling.
Fortunately, death is covered under our policy\'s loss-of-life section.', 'Ron says,
You know, life insurance is a lot more interesting than most people think.', 'The salesman says,
I\'m really glad I was in the neighborhood today. Everyone needs more insurance than they think.' ]} ; ++ AskTellTopic, StopEventList @insPolicy [ '
Okay, tell me about your policy,you say. <.p>
Our policy is the best in the business,Ron says.
For starters, it\'s guaranteed go pay, which most policies aren\'t. There\'s so much more I can tell you.', '
Tell me more about your policy,you say. <.p>
I could go on all day,the salesman says. ' ] ; ++ AskTellTopic, StopEventList @insCompany ['
I\'ve never heard of your company,you say. <.p>
Most people haven\'t,Ron says.
We\'re the best-kept secret in the business.', '
Why would you want to keep your company a secret?<.p>
One word: savings. We save on marketing expenses, and pass the low cost on to you.', '
What else can you tell me about your company?<.p>
I\'d rather tell you about the policy.'] ; /* some topics for the salesman to talk about */ insPolicy: Topic 'life insurance policy/policies'; insCompany: Topic 'acturial life insurance company'; /* ------------------------------------------------------------------------ */ /* * Den */ den: HouseRoom roomName = 'Den' destName = 'the den' desc = "This small room is dominated by a desk, a massive steel edifice painted a drab gray, something that would be more at home in a government office during the cold war. Behind the desk, built in to the north wall, is a bookcase. A passage leads west. " west = livingRoom north = bookcasePassage roomParts = static (inherited() - defaultNorthWall) ; + Decoration 'north wall*walls' 'north wall' "A floor-to ceiling bookcase<< bookcasePassage.isOpen ? " (which has swung aside to expose a passage to the north)" : "">> is built into the wall. " ; + bookcase: Fixture 'book case/bookcase' 'bookcase' desc { "It's a floor-to-ceiling bookcase built in to the north wall, behind the desk, filled with hundreds of dusty tomes. "; if (bookcasePassage.isOpen) "The bookcase is evidently a secret door, because it has moved sideways to expose a passage to the north. "; } ; + bookcasePassage: BasicOpenable, HiddenDoor 'passage' 'passage' "It leads north. " initSpecialDesc { if (isOpen) "The bookcase has moved aside to reveal a passage to the north. "; } ; + Decoration 'dusty book/books/tome/tomes' 'books' "There must be hundreds of books, all with incomprehensible titles and authors you've never heard of. " isPlural = true dobjFor(Read) { verify() { } action() { "Much as you enjoy reading, you can't find any book whose title even means anything to you, let alone holds any interest. "; } } ; + desk: Immovable, Surface 'massive big huge edifice drab gray grey steel metal desk' 'desk' desc { "It's a big desk with a single drawer (currently <
' + gAction.text_ + 'on the paper. '); } } ; +++ typewriterPaper: Thing 'piece/paper' 'piece of paper' isListedInContents = nil desc { if (textList.length() == 0) "The paper is blank. "; else { "The typewritten letters on the page have that uneven darkness and wandering alignment characteristic of the work a well-worn manual typewriter:\b"; foreach (local cur in textList) "\t<
Use of this product in a manner inconsistent with its labeling is a violation of Adventure Game Law." dobjFor(Eat) remapTo(Eat, ratPoison) lookInDesc = "It's full of white powder. " ; +++ ratPoison: Component, Food 'white powder' 'white powder' "The box is full of white powder. " cannotTakeMsg = 'You\'d best leave the poison in the box. ' cannotMoveMsg = 'You\'d best leave the poison in the box. ' cannotPutMsg = 'Best to leave the poison in the box. ' dobjFor(Pour) { verify() { } action() { "You'd best leave the poison in its box. "; } } dobjFor(PourInto) asDobjFor(Pour) dobjFor(PourOnto) asDobjFor(Pour) dobjFor(Eat) { preCond = [touchObj] verify() { dangerous; } action() { "It's not very tasty, but it sure is deadly. "; /* terminate the game */ finishGameMsg(ftDeath, [finishOptionUndo, finishOptionCredits]); } } ; class MyMatch: Matchstick 'match*matches' 'match' ; ++ Matchbook 'match book/matches/matchbook*matches' 'book of matches' matchName(origTokens, adjustedTokens) { /* * if the name is just 'match', ignore it - we want to allow * 'match' as an adjective because we want to match 'match * book', but just plain 'match' is very unlikely to mean us */ if (origTokens.length() == 1 && getTokVal(origTokens[1]) == 'match') return nil; /* inherit default handling */ return inherited(origTokens, adjustedTokens); } /* put this after the individual matches when we match a plural */ pluralOrder = 110 ; +++ MyMatch; +++ MyMatch; +++ MyMatch; +++ MyMatch; +++ MyMatch; /* ------------------------------------------------------------------------ */ /* * Additional verbs */ DefineTAction(Inflate); VerbRule(Inflate) ('inflate' | 'blow' 'up') dobjList | 'blow' dobjList 'up' : InflateAction verbPhrase = 'inflate/inflating (what)' ; DefineTAction(Deflate); VerbRule(Deflate) 'deflate' dobjList : DeflateAction verbPhrase = 'deflate/deflating (what)' ; DefineTAction(LookOver); VerbRule(LookOver) 'look' 'over' dobjList : LookOverAction verbPhrase = 'look/looking (over what)' ; DefineTAction(Ride); VerbRule(Ride) 'ride' singleDobj : RideAction verbPhrase = 'ride/riding (what)' ; DefineTAction(Answer); VerbRule(Answer) 'answer' dobjList : AnswerAction verbPhrase = 'answer/answering (what)' ; modify Thing dobjFor(Inflate) { preCond = [touchObj] verify() { illogical('{That dobj/he} {is}n\'t something {you/he} can inflate. '); } } dobjFor(Deflate) { preCond = [touchObj] verify() { illogical('{That dobj/he} {is}n\'t something {you/he} can deflate. '); } } dobjFor(LookOver) { preCond = [objVisible] verify() { illogical('{You/he} see{s} nothing unusual. '); } } dobjFor(Ride) { verify() { illogical('{That dobj/he} {is}n\'t something {you/he} can ride. '); } } dobjFor(Answer) { preCond = [objVisible] verify() { illogical('{The dobj/he} didn\'t ask {you/him} anything. '); } } ; DefineTopicAction(ThinkAbout) execAction() { "You think about <
T3 Library Sampler This is the T3 Library Sample Game. It's just an example of how to create a game using the T3 standard library (also known as adv3). |
This is a second column that uses character-based wrapping instead
of word-based wrapping. The two columns should more or less balance
out, although the word-based column will want a bigger share because
of its larger minimum width.
| |