!---------------------------------------------------------- ! GTALK.INF: A Demo for Learning Gtalk.h ! Version 3.00 ! by Greg Boettcher, Krister Fundin, and Mark J. Tilford ! This demo is freeware. You may use it for any purpose ! without permission, but please credit us. ! ! Gtalk.inf is a demo for learning the Inform library file ! Gtalk.h. You will need Gtalk.h to compile this demo. ! So if you don't already have Gtalk.h, get it -- and make ! sure you get Gtalk.h version 2.x! It should be available ! from wherever you got this demo. ! ! Version history: See gtalk.h. Constant Story "Introducing Gtalk.h"; Constant Headline "^An Interactive Demo^ by Greg Boettcher.^"; Include "Parser"; Include "VerbLib"; Constant AutoDeactivate; !See Gtalk.h comments, Note #1, !for why this is here. Include "gtalk300"; [ Initialise; location = genericplace; print "Greg's here, one of the guys behind Gtalk.h.^^"; ]; Object genericplace "Place" with description "You are in a place. ", has light; Object note "note" with name 'note' 'paper', description [; font off; print "Handy-dandy list of Inform conversation menu systems to check out:^^ - David Glasser's Phtalkoo.h (based on Adam Cadre's phototalk.inf)^ - L. Ross Raszewski's Converse.h (and his other library files domenu.h, AltMenu.h, Hints.h, and Manual.h)^ - Chris Klimas's Branch.h^ - Adam Stark's Action.h (not for conversation menus)^ - Graham Nelson's Menus.h (not for conversation menus)^ - Greg Boettcher and Mark J. Tilford's Gtalk.h^^"; font on; ]; Object Greg "Greg" genericplace class Character has male animate proper, with name 'Greg' 'Boettcher' 'guy' 'man', description "Greg looks weary.", life [; Answer: NotTalkSub(); rtrue; Order: NotTalkSub(); rtrue; ], before [; TalkTo: self.select(1); rtrue; ! 1, because Quip #1 ], ! is the main menu. weary true, quip [a b; switch (a) { ! Quip #1: Main menu 11: ! Main menu: no quip name needed 12: ! Main menu: no reply needed 13: qtype = MainMenu; qqon = true; 14: ! Here's where we define all the options that are ! ever available from the main menu. For an ! explanation of this syntax, consult the comments ! at the beginning of Gtalk.h, specifically Step 5. return Qlist(b, 8, ! 8 quips in this list 2, ! Quip #2 3, ! Quip #3 4, ! Quip #4 5, ! Quip #5 6) ! Quip #6 | Qlist(b-6, 70, ! Quip #70 50, ! Quip #50 20); ! Quip #20 ! However, if you're writing for Glulx, you have ! the option of using a much easier syntax: ! ! return Qlist(b, 7, 2,3,4,5,70,50,20); ! ! Again, see the Gtalk.h comments for more info. ! Quip #2 21: "~Hi there, who are you?~"; 22: self.qoff(2); self.qon(3, 4); "~My name's Greg Boettcher.~"; 23: qqon = true; ! Quip #3 31: "~Are you related to Curt Boettcher, of the rock group Sagittarius?~"; 32: self.qoff(3); "~No.~"; ! Quip #4 41: "~Are you related to Mike Boettcher, the CNN news correspondent?~"; 42: self.qoff(4); "~No.~"; ! Quip #5 51: "~You look weary.~"; 52: self.qoff(5); "~Well, I should be. I just finished programming a new conversation system.~"; 53: qqon = true; ! Quip #6 61: "~You look remarkably unweary.~"; 62: self.qoff(6); "~Yeah, funny thing, that. I feel great!~"; ! SPECIAL NOTE: Most of the following quips are ! numbered illogically. I did this on purpose, ! just to show that it's possible. It's a pain in the ! neck if you realize you need a new quip in between ! #19 and #20, but the only way to do this is to spend ! a lot of time rearranging your quips. No such problem ! with Gtalk.h. Sorry I had to demonstrate this with a ! lot of illogical code. *shrug* ! Quip #70 701: "Ask Greg about a person . . ."; 702: "Ask Greg about:"; 703: qtype = SubMenu; qqon = true; killq = true; 704: return Qlist (b, 13, 83,82,81,80,79) | Qlist (b-6, 78,77,76,75,74,73) | Qlist (b-12, 72,71); ! Quip #83 831: "Anne Boleyn"; 832: self.qoff(83); "~Isn't she . . . No, wait, she's . . . Oh man. I hate history.~"; 833: qqon = true; ! Quip #82 821: "Charlie Daniels"; 822: self.qoff(82); "~Isn't he a country music singer?~"; 823: qqon = true; ! Quip #81 811: "Ethan Frome"; 812: self.qoff(81); "~I never read that one.~"; 813: qqon = true; ! Quip #80 801: "George Harrison"; 802: self.qoff(80); "~I liked 'Something' and 'While My Guitar Gently Weeps.'~"; 803: qqon = true; ! Quip #79 791: "Ivan the Just"; 792: self.qoff(79); "~'Ivan the Just'? 'Ivan the Just'? He's called Ivan the Great, you fool!~"; 793: qqon = true; ! Quip #78 781: "King Lear"; 782: self.qoff(78); "~Um, yeah. I was supposed to read that in college, but, well, you know.~"; 783: qqon = true; ! Quip #77 771: "Matt Nokes"; 772: self.qoff(77); "~Yeah, he was a baseball player back in the 80s.~"; 773: qqon = true; ! Quip #76 761: "Oliver Platt"; 762: self.qoff(76); "~Yeah, I remember him. He's an actor.~"; 763: qqon = true; ! Quip #75 751: "Queensryche"; 752: self.qoff(75); "~I bought their album Empire, and it rocked!~"; 753: qqon = true; ! Quip #74 741: "Steven Tyler"; 742: self.qoff(74); "~The guy can sing, can't he?~"; 743: qqon = true; ! Quip #73 731: "Urban V"; 732: self.qoff(73); "~I'm not The Catholic Encyclopedia, you know.~"; 733: qqon = true; ! Quip #72 721: "William X"; 722: self.qoff(72); "~William X? I think you made that name up. Sheesh.~"; 723: qqon = true; ! Quip #71 711: "your zookeeper"; 712: self.qoff(71); "~You have a zookeeper? Ha!~"; 713: qqon = true; ! Quip #50 501: "Ask Greg about a place . . ."; 502: "Ask Greg about:"; 503: qtype = SubMenu; qqon = true; killq = true; 504: return Qlist (b, 10, 60,59,58,57,56) | Qlist (b-6, 55,54,53,52,51); ! Quip #60 601: "Aruba"; 602: self.qoff(60); "~Off the coast of Venezuela.~"; 603: qqon = true; ! Quip #59 591: "Bermuda"; 592: self.qoff(59); "~Bermuda, yeah.~ A dreamy look in his eyes. ~Bermuda.~"; 593: qqon = true; ! Quip #58 581: "Cuba"; 582: self.qoff(58); "~Did you hear the one about how the CIA left a banana peel outside Castro's door?~^^ He pauses, musing. ~Um, sorry, I forgot the punchline.~"; 583: qqon = true; ! Quip #57 571: "Dominica"; 572: self.qoff(57); "~That's where all those baseball players are from! Oh wait. Hmm, maybe not.~"; 573: qqon = true; ! Quip #56 561: "Eleuthera"; 562: self.qoff(56); "~An island in the Bahamas, I think.~"; 563: qqon = true; ! Quip #55 551: "Florida"; 552: self.qoff(55); "~Nice beaches.~"; 553: qqon = true; ! Quip #54 541: "Grenada"; 542: self.qoff(54); "~Since that one thing back in the 80s, I've heard nothing about Grenada.~"; 543: qqon = true; ! Quip #53 531: "Havana"; 532: self.qoff(53); "~Everything I know about Havana I learned by watching Godfather II.~"; 533: qqon = true; ! Quip #52 521: "Inagua"; 522: self.qoff(52); "~An island in the Bahamas, I think.~"; 523: qqon = true; ! Quip #51 511: "Jamaica"; 512: self.qoff(51); "~Home of the champion bobsledders.~"; 513: qqon = true; ! Quip #20 201: "Ask Greg about a feature of this conversation system . . ."; 202: "Ask Greg about:"; 203: qtype = SubMenu; qqon = true; killq = true; 204: return Qlist (b, 7, 21,22,23,24,25) | Qlist (b-6, 26,27); ! Quip #21 211: "Conversation menus"; 212: "~There are lots of ways to handle dialogue in interactive fiction, and conversation menus are one good way to do it. Although there is some disagreement about this in the IF community, there are still plenty of people who believe that conversation menus are a good way to go, at least for certain kinds of games.^^ ~If you're playing this demo, chances are you're a game designer who is looking for a way to put conversation menus into your Inform game.^^ ~If so, then you probably know about Phtalkoo.h: David Glasser's library file based on Adam Cadre's phototalk.inf from his game Photopia.^^ ~And you probably also know that this demo demonstrates Gtalk.h, my own library file.~"; 213: qqon = true; 214: return Qlist (b, 2, 31,32); ! Quip #22 221: "Looping menus"; 222: "~In case you don't know what I mean, 'looping' conversation menus are simply ones that repeat without player input in between.~^^ Like so:"; 223: qqon = true; killq = true; 224: return Qlist (b, 1, 40); ! Quip #23 231: "Submenus and ~menu mazes~"; 232: "~I created this library file to be able to handle submenus and complex, lengthy menu-based conversations, including what might be called 'menu mazes.' I wasn't aware of any existing Inform library files to handle this, so I wrote my own.^^ ~I think that submenus, in particular, offer exciting possibilities. Conversation menus are criticized for not allowing enough freedom, but submenus can do something to correct for this. They can increase the range of options to as great an extent as the designer allows. This demo gives you a taste of what I mean.~"; 233: qqon = true; 234: return Qlist (1, 43); ! Quip #24 241: "Better-organized menu options"; 242: "~In my opinion, Gtalk.h allows for more readable code than Phtalkoo.h, because the quip/response pairs are right next to each other, rather than being separated into two different routines. And these quips, or conversation menu options, are interrelated not in a strict hierarchy, but in a much more flexible way.~"; 243: qqon = true; ! Quip #25 251: "Ability to turn on/off/on the ~say nothing~ option"; 252: "~Yep, my system lets you turn on or off the '0 to say nothing' feature.~^^ You can't escape this by pressing 0:"; 253: qqon = true; killq = true; killz = true; 254: return Qlist (b, 1, 44); ! Quip #26 261: "Ability to show/hide ~What would you like to say?~"; 262: "~Yes, for any menu option, you can either show or hide the standard question 'What would you like to say?', perhaps replacing it with something different.~^^ [The space below is intentionally left blank.]^^^"; 263: qqon = true; killq = true; 264: return Qlist (b, 1, 44); ! Quip #27 271: "Learn more about other menu systems."; 272: move note to player; "~Well, I just happen to have something for that.~ He shuffles in his pockets and pulls out a piece of paper, handing it to you. ~Check this out.~"; 273: qqon = true; ! Quip #31 311: "~So, what advantages does Gtalk.h have over Phtalkoo.h?~"; 312: "~Several.~^^Ask about an advantage:"; 313: qqon = true; killq = true; 314: return Qlist (b, 5, 22,23,24,25,26); ! Quip #32 321: "~Hmm, that's very interesting.~"; 322: "Greg nods."; 323: qqon = true; ! Quip #40 401: "~Ah yes, I see what you mean.~"; 402: "~J. Robinson Wheeler's Being Andrew Plotkin was the first IF game I ever played to use such 'looping' menus.^^ ~In fact, I wrote Wheeler asking if he could send me his Phtalkoo.h modifications he used for that game. He was gracious enough to do so. I appreciated that very much, even though I didn't end up using his code.~"; 403: qqon = true; ! Quip #43 431: "~What about menu mazes?~"; 432: "~'Menu mazes' have been denigrated by the IF community, but on the other hand, such 'mazey' conversations have been used in such great games as Gateway 2: Homeworld. Even if you really hate 'mazey' conversation menus, it is clearly an advantage that Gtalk.h allows for the complexity that 'menu mazes' require. You can, in other words, organize your conversation options flexibly (not in a strict hierarchy, as Menus.h, for instance, requires). And you can loop/repeat the conversation as many times as you like.^^ ~This isn't logical, but just to be 'mazey,' I'm going to take you back to the main menu.~"; 433: qqon = true; qtransfer = 1; ! After this quip, supply menu ! options identical to those of ! Quip #1. ! Quip #44 441: "~Ah yes, I see what you mean.~"; 442: ! No reply. This is bad form, but it demonstrates ! that a reply isn't absolutely necessary. 443: qqon = true; } rfalse; ]; !! These token objects verified that I successfully fixed a !! bug where it would say things like "The paintings doesn't !! reply." !Object paintings "paintings" genericplace ! has pluralname scenery, ! with name 'paintings' 'pictures' 'painting' 'picture', ! description "There are paintings here, but they are ! nondescript and uninteresting."; !Object plaque "plaque" genericplace ! has scenery, ! with name 'plaque', ! description "There is a plaque here, but it's totally ! blank."; Include "Grammar"; ! This Unweary verb has been created in order to test the ! consequences of changing the on/off status of quips prior ! to initiating a conversation. Prior to version 2.04, this ! was a problem. Verb 'unweary' * -> Unweary; [ UnwearySub; ! If already unweary, return with the following message. if (Greg.weary == false) "Greg is already unweary. "; ! Otherwise, do the following: Greg.weary = false; Greg.description = "Greg does not at all look weary."; Greg.qoff(5); Greg.qon(6); "Okay, Greg is now unweary. "; ]; ! The remaining grammar stuff may be of interest to ! people using gtalk.h, and you may feel free to copy it ! if you wish. [TalkToSub; if (noun has animate) { "You can't think of anything to say."; } else { !inanimate object if (noun has pluralname) print_ret (The) noun, " don't reply."; else print_ret (The) noun, " doesn't reply."; } ]; [NotTalkSub; "To talk to someone, please type TALK TO PERSON."; ]; Extend only 'speak' replace * creature -> TalkTo * 'to' creature -> TalkTo * 'with' creature -> TalkTo * noun -> TalkTo * 'to' noun -> TalkTo * 'with' noun -> TalkTo; Verb 'talk' 't//' * creature -> TalkTo * 'to' creature -> TalkTo * 'with' creature -> TalkTo * noun -> TalkTo * 'to' noun -> TalkTo * 'with' noun -> TalkTo; ! The following should be a complete list of ! non-TALK verbs to replace, except that you ! may also want to add something like the ! following to each of your NPC objects: ! life [; ! Order: NotTalkSub(); rtrue; ! ]; ! so that "MAN, GO N" is also replaced. Extend 'answer' replace ! = 'say' 'shout' 'speak' * -> NotTalk ! (Except we replaced * topic -> NotTalk; ! 'speak' on its own above.) Extend 'ask' replace * -> NotTalk * topic -> NotTalk; Extend 'tell' replace * -> NotTalk * topic -> NotTalk; Extend 'no' replace * -> NotTalk * topic -> NotTalk; Extend 'yes' replace ! = 'y//' * -> NotTalk * topic -> NotTalk; Extend 'sorry' replace * -> NotTalk * topic -> NotTalk;