! People Don't Talk Like That
! a GxScript demonstration by Brendan Barnwell
!
! Please contact me with questions/comments/etc. at BrenBarn@aol.com
!
! Development log
! Date What the dilly-o
! 2001/04/17 Began!
!
Constant Story "People Don't Talk Like That";
Constant Headline "^a GxScript demonstration by Brendan Barnwell^(Please send questions/comments/etc. to BrenBarn@@64aol.com)^";
Include "Parser";
Include "Entry";
! Entry stuff
Enterer Game;
EnterInitialise -> GameInitialize
with execute [;
location=StartingRoom;
"^^^~This will be nice,~ you think to yourself. ~A relaxing evening with Leonard and Laura.~^";
];
Include "OKBGlulx";
Include "OKBStyle";
Include "OKBLib"; ! Small library that defines Room and Thing classes
Include "Verblib";
Include "Grammar";
Include "GxScript";
Room StartingRoom "An Unremarkable Room"
with name 'unremarkable',
description "This room is thoroughly unremarkable. There's an exit to the south.",
s_to OtherRoom;
! This object is affected by one of Leonard's lines of dialogue
Thing -> Device "strange device"
with name 'device' 'strange',
description [;
if (self hasnt general) "That's one funky-looking device.";
else "Whoa, it's a three-headed monkey.";
];
Room OtherRoom "Another Unremarkable Room"
with name 'unremarkable',
description "Just as unremarkable as the first room (which is back to the north).",
n_to StartingRoom;
! This device affects conversation with the alien
Thing -> LanguageButton "button"
with name 'button',
description "It's a button. Hmmm. . .",
before [;
Push:
if (Alien.node()~=AlienEnglish) {
Alien.choosenode(AlienEnglish); "Hmmm. . .";
}
else {
Alien.choosenode(Alien); "Hrm.";
}
];
Man Leonard "Leonard" StartingRoom
with name 'Leonard' 'Leon' 'Leo' 'Lenny',
description "It's your ol' buddy Leonard.",
color [; return $0000FF; ], ! Colors set to blue on cyan
bgcolor [; return $00FFFF; ],
forget [; ! This forget routine "erases" Leonard's
if (self.lastheard>4) { ! memory if you don't talk to him for 5 turns
self.lastheard=0; ! Be sure to reset lastheard!
self.reset(); self.choosenode(self);
}
];
! A standard line of dialogue
NLine ->-> LeonardLeonard "~Let's talk about you.~"
with content "~Let's talk about you,~ you say to Leonard.^
~Sure,~ says Leonard.";
! This line of dialogue sends the conversation back to the beginning
RLine ->->-> LeonardMemory "~How's your memory these days, Leonard?~"
with
newnode Leonard,
content "~How's your memory these days, Leonard?~ you ask.^
~Not so hot,~ he replies ruefully. ~For example, if you were, to, say, not talk to me for 5 turns, I'd forget this conversation ever happened (hint, hint).~";
! This line says one thing if you've asked Leonard about his hearing, and
! something different if you haven't. Conversation is also redirected
! differently depending on whether you've asked about his hearing.
NLine ->->-> LeonardLame "~You're lame, Leonard.~"
with
content [; print "~You're lame, Leonard~ you say cruelly.^";
if (LeonardHearing.active) "~Shut up,~ Leonard says.";
else "There is no reply.";
],
after [;
if (LeonardHearing.active) rfalse;
else Leonard.choosenode();
];
! This line kills the player if he says it
NLine ->->->-> LeonardNoShutUp "~No, I won't shut up.~"
with content "~No,~ you taunt, ~I won't shut up!~^
~EEEAGH!~ Leonard screams, and attacks you in a frenzy.",
after [; deadflag=1; ];
! This line makes the player win if he says it
NLine ->->->-> LeonardOKShutUp "~OK, I'll shut up.~"
with content "~OK,~ you say. ~I'll shut up.~^
~Yay!~ says Leonard. ~You're my best friend now!~",
after [; deadflag=2; ];
! This line adopts LeonardLame
NLine ->->-> LeonardHearing "~How's your hearing these days, Leonard?~"
with adopting LeonardLame,
content "~How's you hearing these days, Leonard?~ you say. ~Leonard?~";
! This line shares the children of LeonardLame
NLine ->->->-> LeonardHello "~Hello in there!~"
with sharing LeonardLame,
content "~Hello in there!~ you scream into Leonard's ear.^
Leonard jumps in surprise and gives you an angry look. ~Knock it off,~ he says. ~Shut up.~";
! This line sends a message to Laura
NLine ->->->-> LeonardDig "~Dig Leonard -- he's deaf!~"
with content "~Dig Leonard,~ you say, ~he's deaf!~",
after [; Laura.LeonardIsDeaf(); ];
! A normal line of dialogue
NLine ->-> LeonardRoom "~Let's talk about this place you got here, Leonard.~"
with content "~Let's talk about this place you got here, Leonard,~ you suggest.^
~Sure thing,~ says Leonard.";
! This line redirects the conversation back to talking about the room
! Also note that this line is persistent -- it can be chosen more than once
RLine ->->-> LeonardRoomUnremarkable "~This room is pretty unremarkable.~"
with newnode LeonardRoom,
content "~This room is pretty unremarkable,~ you remark.^
~Yeah, I guess.~";
! This line affects another object in the room (the strange device)
! It also redirects conversation back to the beginning
RLine ->->-> LeonardDevice "~That's quite an interesting device you've got there.~"
with newnode Leonard,
content "~That's quite an interesting device you've got there,~ you say.^
~Not only that,~ says Leonard mysteriously, ~I have telepathic control over it. Look at it again.~",
after [;
if (Device hasnt general) give Device general;
else give Device ~general;
];
! This line switches the conversation to another NPC
NLine ->-> LeonardLaura "~How's Laura doing?~"
with content "~How's Laura doing?~ you ask.^
~Talk to her yourself,~ Leonard says.",
after [;
Laura.choosenode();
<>;
];
! This line uses a before property to "intercept" the player's words
NLine ->-> LeonardImportant "~I have something of vital importance to tell you.~"
with before [;
deadflag=1;
"Before you can say anything, a meteor strikes the earth!";
],
content [; "Leonard is struck down."; ];
Woman Laura "Laura" StartingRoom
with name 'Laura',
description "It's your old compadre Laura.",
color [; return $000000; ], ! Set colors to black on gray
bgcolor [; return $CCCCCC; ],
forget [;
! This forget routine causes Laura to break into the conversation if you don't
! talk to her for 5 turns
if (self.lastheard>4 && self in location) {
! This is important! If you don't reset lastheard, this routine will be called repeatedly
self.lastheard=0;
print "~Hey!~ Laura says. ~You were talking to me!~^";
<>;
}
],
LeonardIsDeaf [;
"~Haw haw haw!~ Laura chortles. ~He sure is!~^";
];
! This line redirects conversation back to the beginning, but, unlike the
! RLine in Leonard, it is not persistent
RLine ->-> LauraLaura "~How are you, Laura?~"
with newnode Laura,
content "~How are you, Laura,~ you ask.^
~Fine,~ she snaps.",
after [; self.deactivate(); ]; ! It is important to return false here
NonHuman Alien "bizarre-looking alien" OtherRoom
with name 'alien' 'bizarre' 'looking' 'bizarre-looking' 'form' 'life' 'life-form' 'strange',
description "A strange life form from some other world.",
color [; return $FFFFFF; ], ! Set colors to white on green
bgcolor [; return $00CC00; ];
! No forget routine means "elephant" memory
RLine ->-> AlienPeace "~I come in peace.~"
with newnode Alien,
content "~I come in peace,~ you say cautiously.^
~Bza$%rk *Klo&~ the thing replies.";
! This Holder will become the current node if the player pushes the button
Holder ->-> AlienEnglish;
! This line kills the player if he chooses it
NLine ->->-> AlienInsult "~You suck!~"
with content "~You suck!~ you say, taunting the alien.^
~Oh, yeah?~ he says. Somehow you can understand him -- and apparently, vice versa. He pulls out a ray gun and vaporizes you.",
after [; deadflag=1; ];