Constant Story "Nalian"; Constant Headline "^An Interactive Coding Example^ Copyright (c) 1998 by Lucian Smith.^ Type INFO for, uh, information.^"; Release 1; Constant MANUAL_PRONOUNS; Constant DEATH_MENTION_UNDO; Replace NextWord; Replace NextWordStopped; Replace LanguageToInformese; [ LanguageToInformese x; !Change all question, exclamation marks to periods. for (x=2:x<2+buffer->1:x++) { if (buffer->x == '?' or '!') buffer->x = '.'; } ]; Include "Parser"; Include "VerbLib"; !Include ">MyRoutines"; Include ">library/contributions/menus.h"; [ Initialise; ChangePlayer(LanguagePlayer); location = forest; lookmode=2; "^^^^^Life is pretty routine. Examine Code. Read it. Mimic the Code you understand. Ignore the rest. Then one day, someone shows you code to a language puzzle. Can you understand it?^"; ]; !!!!!!!!!!!!!!!!! Some Attributes, Classes, and Routines !!!!!!!!!!!!!!!!! Attribute surface; Attribute burin; Global third; [ChooseObjects obj code; if (code==2) { if (obj == genpic) return 3; else if (obj ofclass Drawing) return 2; else if (obj in Compass) return 1; else return 5; } rfalse; ]; [EmptyInto obj1 obj2 x; !Move everything from obj1 to obj2. x = child(obj1); while (x~=nothing) { move x to obj2; x = child(obj1); } ]; [ NextWord return_singles i j k; if (wn > parse->1) { wn++; rfalse; } i=wn*2-1; wn++; j=parse-->i; if (j==0) { k=wn*4-3; i=buffer->(parse->k); if (i==',') j=comma_word; else if (i=='.') j=THEN1__WD; else if (i==';') j=THEN1__WD; else if (return_singles) j=i; } return j; ]; [ NextWordStopped return_singles; if (wn > parse->1) { wn++; return -1; } return NextWord(return_singles); ]; !NextWord and NextWordStopped needed to be changed in order to return !information to Stranger's parser about punctuation. LanguageToInformese !might have worked on its own, but I didn't use that in the first !release. Object Void "The Void" with description "I like storing unused objects in an inaccessible room. call me a neat-nik, I suppose."; !!!!!The rooms and people!!!!!!!! Object forest "Forest" with description "The trees are lovely here, and the sunlight streams through them, glinting off the leaves. There's a small path to the northeast, and a clearing off to the west.", ne_to StrangeHut, w_to Clearing; Object -> LanguagePlayer with name 'me' 'myself' 'features' 'head' 'arms' 'arm' 'legs' 'leg' 'alter' "i" 'hands' 'hand' 'feet' 'foot' 'finger' 'fingers' 'toe' 'toes', number 0, short_name "yourself", description "You seem to be bred for a cranial capacity which is particularly adapted to learn languages. Since this is an example game, you suspect this to be the case.", has animate proper light; Object -> -> bone "Bone" with name 'bone' 'small' 'porous' 'thin', description [; print "This small bone is about as long as your finger, but much thinner. "; if (self.stained) "One end has been stained dark purple."; else "It's quite porous and light."; ], stained 0, has proper; Object -> -> berries "Berries" with name 'berries' 'berry' 'black' 'blue' 'purple', description "These juicy black berries are in season this time of year, and should be good to eat.", before [; Eat: "You eat a few of the berries. You stain your fingers, but the berries taste delicious."; Push, Attack, Squeeze: move mash to parent(self); move self to Void; "You grind up the berries, making a purple syrupy paste."; Receive: if (noun==bone) { bone.stained = 5; startDaemon(self); "You prick a single berry with Bone. The end of it gets very slightly stained, but not much else happens."; } "You nestle ", (the) noun, " in the Berries. They look good together, but you separate them again for ease of carrying."; ], daemon [; bone.stained--; if (~~bone.stained) { stopDaemon(self); if (IndirectlyContains(location, bone)) "^The last bits of the purple stain soak up into Bone, leaving it uncolored again."; } ], number 0, has proper pluralname; Object -> -> bark "White Bark" with name 'white' 'bark', description [; print "A sheet of bark from the trees by a river. It's approximately square, about two hand spans wide.^"; self.drawdescribe(); rtrue; ], drawdescribe [; switch (self.used) { 0: rfalse; 1: "You have sketched ", (a) self.sketch, " on the Bark. You hope someone else would be able to figure out what it's supposed to be."; 2: "Purple ink stains remain where you have wiped the Bark clean."; } ], invent [; switch(self.used) { 0: rfalse; 1: print "White Bark (with ", (a) self.sketch, ")"; rtrue; 2: print "White Bark (which has been wiped clean)"; rtrue; } ], sketch nothing, add_to_scope [; PlaceInScope (self.sketch); ], before [; Rub, Erase: switch (self.used) { 1: self.used = 2; self.sketch = nothing; "You wipe off Bark, and manage to clean off most of the berry stains."; 0,2: "Bark is about as clean as you're going to get it."; } ], used 0, has proper; Object mash "Purple Paste" Void with name 'purple' 'paste' 'blue' 'black' 'syrup' 'syrupy' 'ink' 'berries' 'remains' 'berry' 'mash', description "A purple mash of berry remains.", before [; Eat: "You eat some of the mash. You stain your fingers in the process, but it tastes pretty good."; Receive: if (noun==bone) { bone.stained = 1; stopDaemon(berries); "You dip the end of Bone into Purple Paste. The porous bone soaks up much of the juice, and it becomes heavily stained."; } "You put ", (the) noun, " in the Paste. It gets some juice on it, but not very much."; PutOn: <>; ], after [; Take: "You scoop up what you can of the berry mash."; ], has proper; Object Clearing "Clearing" with description "This small grassy area is dominated by a stump in the middle of the glade. The only gap in the trees is back to the east.", each_turn [; move stumppic to Draw_Room; self.each_turn = NULL; ], e_to forest, cant_go "You can find no way through the trees in that direction."; Object -> Stump "Stump" with name 'stump' 'middle' 'tree', description "The tree from which this stump came must have been several years old--it's quite big around.", each_turn [; if (self hasnt general) { give self general; move revelationpic to Draw_Room; "^As you enter, a shaft of light breaks through the clouds and bathes the stump in a halo of light. You have a Revelation! You must find the Revelation and bring it back here!"; } else if (revelation in player) { deadflag = 2; "Reverentially, you enter the glade once more and place the Revelation on the stump. Birds sing, bells chime, and a shaft of light illuminates you, but then it starts raining, so you go back home."; } ], has supporter enterable proper; Object StrangeHut with description "You've emerged from the northeast path to another Hut, rather like your own. This one is larger, though, and has woven leaves as a doorway instead of a hide. This Hut is to the north, or you can go back down the path you came from the southwest.", short_name "Stranger's Hut", each_turn [; move strangerpic to Draw_Room; self.each_turn = NULL; ], sw_to Forest, n_to s_hut_door; Object -> s_hut_door with name 'door' 'doorway' 'hut' 'woven' 'weaved' 'leaves', short_name [;return StrangeHut.short_name;], description [; "Woven leaves hang over the entrance to ", (the) StrangeHut, " to the north."; ], before [; Open, Close, Push, Pull: "You don't need to open or close the door-- it's just woven leaves, hanging in the doorway."; ], door_dir n_to, door_to [; "While he is friendly, it is clear you are not going to get past Stranger and his knife."; ], describe [;rtrue;], has door static open; Object -> stranger with name 'stranger' 'friend' 'man', short_name "Stranger", description [; "", (The) self, " is tall, slender, and quite muscular. He wears the black skin of Panther and carries a long knife, making him that much more impressive."; ], describe [; print "^", (The) self, " is here, standing in front of his Hut. He has an easy confidence about him, and watches you with a slight smile."; ], grammar [ x w end recognized errors english; wn=verb_wordnum; while (end==0) { recognized = 0; w = NextWordStopped(1); if (w==-1) { end=1; recognized = 1; } else if (w==0) errors++; else objectloop (x in FL_Room) { if (w==x.name) { x.moveme = 1; recognized = 1; } } ! if (w==#n$, or #n$. or #n$! or #n$? or #n$: or #n$; or ! #n$" or #n$') ! recognized = 1; if (w=='"' or '^' or ':' or or '?' or '!' or ';' or comma_word or THEN1__WD) recognized = 1; if (recognized==0) { english++; } } objectloop (x ofclass Word) { if (x.moveme==1) { move x to Sentence; x.moveme = 0; } } if (errors > 0) action = ##Incomprehensible; else if (english > 0) action = ##Franglais; else action = ##MyParse; return 1; ], orders [; if (self.react_before()) rtrue; switch(action) { ##Incomprehensible: self.gibber(); rtrue; ##Franglais: self.hybrid(); rtrue; ##MyParse: self.nalian(); rtrue; } ], life [i w x errors english recognized; Ask, Tell, Answer: wn=consult_from; for (i=1: i<=consult_words: i++) { recognized = 0; w = NextWord(1); if (w==0) errors++; else objectloop (x in FL_Room) { if (w==x.name) { x.moveme = 1; recognized = 1; } } ! if (w==#n$, or #n$. or #n$! or #n$? or #n$: or #n$; or ! #n$" or #n$') ! recognized = 1; if (w=='"' or '^' or ':' or comma_word or THEN1__WD) recognized = 1; if (recognized==0) { english++; } } objectloop (x ofclass Word) { if (x.moveme==1) { move x to Sentence; x.moveme = 0; } } if (errors > 0) self.gibber(); else if (english > 0) self.hybrid(); else self.nalian(); rtrue; ! Show: <>; ], gibber [; print (The) self, " looks at you, bewildered.^"; EmptyInto (Sentence, FL_Room); ], hybrid [; if (child(Sentence) ~= 0) print (The) self, " concentrates, but cannot seem to figure out the combination of your two languages.^"; else print (The) self, " looks at you intently, but cannot comprehend your language.^"; EmptyInto (Sentence, FL_Room); rtrue; ], nalian [x y z; ! print "Your sentence means:^"; !!!Remove these later. ! objectloop (x in Sentence) ! print (The) x, " "; ! print ".^"; if (n_fakerevelation in Sentence) { EmptyInto(Sentence, FL_Room); "Trying to guess Stranger's word for 'Revelation', you try combining a few random syllables. Amazingly enough, you get them exactly right. Unfortunately, since you've never heard Stranger say it himself, you get the accent all wrong, and Stranger has no clue what you tried to say."; } switch (children(Sentence)) { 0: print (The) self, " looks at you as if you were about to say something."; 1: if (child(Sentence) ofclass MyNoun) switch(child(Sentence)) { n_i: print (The) self, " nods, points at you, and says, ~Sti.~"; n_you: print (The) self, " nods, points at himself, and says, ~Fi.~"; n_revelation: if (self.knows_rev) { self.giveYouRev(); EmptyInto(Sentence, FL_Room); rtrue; } else print "~Kralni ulk a iflo. Isink akne ri lobo,~ he responds."; n_it, n_hut: print (The) self, " gestures grandly at his abode. ~Iflo raki, a?~"; n_weapon: print "~A,~ says Stranger, showing you his knife, ~undi ulk lobo!~ He slashes with the knife at some invisible enemy, as if to emphasize his point."; n_panther: print (The) self, " grins broadly, and pats Panther skin with pride. ~Lobradi ulk lobo. Fi ulk a lobo!~"; } else if (child(Sentence) ofclass MyVerb) switch(child(Sentence)) { v_is: print "~A ulk, y ulk,~ ", (The) self, " says grandly, as if he has just stated something profound."; v_yes: self.answered(1); v_no: self.answered(0); v_give: print "~Undi?~ he asks, furrowing his brow and indicating his knife, ~Undi ulk fo!~"; v_take: print (The) self, " shakes his head. ~Y,~ he says, ~Ri ulk sto.~"; v_leave: print (The) self, " laughs heartily. ~Fi alvenk fo raki? Y!~"; v_threaten: print (The) self, " looks confused. ~Y issulk,~ he suggests, and shrugs."; v_see: print (The) self, " looks all around him, at the forest, at his hut, and then at you again. ~A?~ he asks."; v_understand: print (The) self, " nods encouragingly. ~Iflo,~ he says."; } else switch (child(Sentence)) { a_mine: if (child(player) ~= nothing) print (The) self, " nods, and points to your ", (name) child(player), ". ~Ri ulk sto.~ he tells you."; else print (The) self, " looks at you, then points to the skin wrapped around your waist. ~Ri ulk sto,~ he says."; a_your: print (The) self, " shrugs and shows you his knife. ~Undi ulk fo,~ he says."; a_his: print (The) self, " thinks for a minute, then goes over to his doorway. He grabs the woven leaves, and says, ~Ri?~ He then makes a sweeping gesture, encompassing his entire hut. ~Raki,~ he says. Shaking the leaves again, he says, ~Ri ulk ro.~ He looks at you hopefully."; a_good: print (The) self, " throws his hands in the air and whoops wildly!"; a_bad: print (The) self, " looks dejected, and pretends to cry for a few seconds."; a_strange: print (The) self, " sticks his thumbs in his ears, cocks his head to one side, crosses his eyes, and sticks out his tongue, making babbling noises. ~Sti ulk farro,~ he adds."; a_dangerous: print "With a gleam in his eye, ", (the) self, " draws his knife, crouching, and begins to stalk some invisible enemy. Suddenly, with a shout, he leaps and slashes with his knife. Standing proudly, he tells you, ~Fi ulk lobo.~"; } 2, 3, 4, 5: !Order the sentence Yes/No-Verbs-Nouns-Adjectives if (a_mine in Sentence) move a_mine to Sentence; objectloop(x ofclass MyNoun) { if (x in Sentence) move x to Sentence; } if (n_revelation in Sentence) move n_revelation to Sentence; if (n_it in Sentence) move n_it to Sentence; if (n_you in Sentence) move n_you to Sentence; if (n_i in Sentence) move n_i to Sentence; objectloop(x ofclass MyVerb) { if (x in Sentence) move x to Sentence; } if (v_no in Sentence) move v_no to Sentence; if (v_yes in Sentence) move v_yes to Sentence; if (v_is in Sentence) move v_is to Sentence; x = child(Sentence); y = sibling(x); z = sibling(y); if (x ofclass MyVerb) { if ((x == v_yes) && (y == v_no)) { print "~A? Y?~ ", (the) self, " says, shaking his head. ~Farro.~"; } else if (x==v_yes or v_is) { move x to FL_Room; self.nalian(); rtrue; } else if (x == v_no) { if (y ofclass MyVerb) switch (y) { v_understand: print (The) self, " looks at you in sympathy. ~Sti a ifisink 'ifisink'!~ he adds, encouragingly."; default: print (The) self, " shrugs, then stands perfectly still with his eyes shut for a few moments. ~A?~ he asks."; } else if (y ofclass MyNoun) switch (y) { n_revelation: if (self.knows_rev) { self.giveYouRev(); EmptyInto(Sentence, FL_Room); rtrue; } else print (The) self, " nods. ~Farro,~ he says, ~Fi y arenk kralni.~"; default: print (The) self, " "; switch (random(2)) { 1: print "nods"; 2: print "shakes his head"; } print " absently, not really paying that much attention."; } else !!The player said 'No [adjectives]' { print (The) self, " looks at you, confused. ~Y ", (the) y, ",...?~ he prompts. ~Y ", (the) y, " raki? Y "; if (z ~= nothing) print (the) z; else print (the) y; print "?~ He shakes his head, confused."; } } else if (y ofclass MyVerb) { print "~Fi y ifisink,~ ", (The) self, " says, ~ifisink ", (the) x, ", ifisink ", (the) y, ",... Y ifisink ", (the) x, " ", (the) y, "."; } else if (y ofclass Adjective) { print "~A ", (the) x, ",...?~ ", (The) self, " asks you. ~Raki ", (the) y, "? Undi "; if (z ~= nothing) print (the) z; else print (the) y; print "?"; } else switch (x) { v_give: switch (y) { n_i, n_you: move y to FL_Room; self.nalian(); rtrue; n_panther, n_hut, n_weapon, n_it: print (The) self, " shakes his head. ~Y,~ he says, ~Fo ulk ", (the) x, ".~"; n_revelation: if (self.knows_rev) { self.giveYouRev(); EmptyInto(Sentence, FL_Room); rtrue; } else { self.asked_question = 3; "~Kralni?~", (the) self, " asks, ~Sti ulk akne?~"; } } v_take: switch (y) { n_i: if (n_revelation in Sentence) { move v_take to FL_Room; move v_give to Sentence; self.nalian(); rtrue; } print (The) self, " looks doubtful. ~Sti isink, Fi arenk? Y.~"; n_you: print (The) self, " shakes his head. ~Fi ulk iflo.~"; n_revelation: print (The) self, " looks confused. ~Fi isink fo kralni?~ he asks."; n_hut, n_weapon, n_panther, n_it: print (The) self, " looks confused. ~Fi isink fo ", (the) y, "?~ he asks."; default: !!y is an adjective. print (The) self, " looks expectantly at you. ~Isink ", (the) y, ",...~ he says, as if expecting you to finish the sentence."; } v_leave: switch (y) { n_i: print (The) self, " waves cheerily to you."; n_you: print (The) self, " looks startled. ~Fo raki!~ he says."; n_revelation: print (The) self, " looks at you quizzically. ~Fi y ifisink,~ he says."; n_hut, n_it: print (The) self, " starts, and turns to look at the hut behind him as if he expected it to jump up and run away. When it doesn't, he turns back around and eyes you suspiciously."; n_weapon: print (The) self, " ponders this for a moment, then stands a few feet from his hut and throws his knife at it. It hits flatly, and clatters to the ground. ", (The) self, " shrugs, and picks it back up again."; n_panther: print (The) self, " grins broadly. ~A! Lobradi a alvenk! Fi ulk lobo!~"; default: !y is an adjective print (The) self, " raises an eyebrow. ~Alvenk ", (the) y, "?~ he asks, then offers, ~Fi alvenk?~ ~Sti alvenk?~"; } v_threaten: switch (y) { n_i: print (The) self, " barely manages to suppress a giggle, but manages to look stern. ~A. Sti issulk,~ he says seriously, but the corners of his mouth are twitching."; n_you: print (The) self, " grins broadly, almost wickedly, and brandishes his knife. ~Fi ulk lobo!~ he says."; n_revelation, n_hut, n_it: print (The) self, " looks slightly confused. ~Y ", (the) y, " issulk,~ he informs you."; n_weapon: print (The) self, " nods thoughtfully, and considers his knife. ~Undi a issulk,~ he allows."; n_panther: print (The) self, " looks excited, ~Lobradi issulk, Fi issulk. Lobradi arenk, Fi isink!~ he pats his panther skin with pride."; default: !y is an adjective print (The) self, " shakes his head. ~Y,~ he says. ~Y '", (the) y, "' issulk. Fi issulk, Sti issulk,...~ he shakes his head again. ~Y "; if (z ~= nothing) print (the) z; else print (the) y; print " issulk."; } v_understand: switch (y) { n_i: if (a_bad in Sentence) print (The) self, " smiles encouragingly. ~Y aslo, y aslo,~ he says. ~Fi ifisink sti iflo!~"; else if (a_good in Sentence) { print (The) self, " grins broadly. ~Iflo!~ he says, then launches into a long spiel which you have no hope of beginning to comprehend. When he realizes you aren't following him, he backs down. ~Sti y ifisink "; style underline; print "iflo"; style roman; print " iflo,~ he allows, and chuckles."; } else print (The) self, " smiles. ~Iflo!~ he tells you."; n_you: print (The) self, " considers this, and nods. ~A,~ he agrees, ~Fi ifisink. Fi y ifisink iflo,...~ he shrugs and smiles, ~Fi y ifisink aslo.~"; n_revelation, n_hut, n_weapon, n_panther, n_it: print (The) self, " laughs loudly, ~ifisink ", (the) y, "?~ he asks, incredulously. He shakes his head, ~Y ", (the) y, " ifisink iflo."; default: !y is an adjective print (The) self, " looks confused. ~ifisink ", (the) y, "?~ he asks. ~Sti ifisink ", (the) y, ", ulk iflo,~ he offers."; } v_see: switch (y) { n_i: if (z ~= nothing) { if (z ofclass MyNoun) { if ((z == n_revelation) && (revelation notin location or player)) print (The) self, " looks around. ~Kralni? Fi y arenk kralni,~ he tells you."; else if (z == n_you) print (The) self, " puts on a supercilious grin, and poses for you."; else { print (The) self, " nods, points to "; switch (z) { n_revelation: print "the revelation."; n_hut, n_it: print "his hut"; n_weapon: print "his knife"; n_panther: print "the panther skin he is wearing"; } print ", and smiles. ~Fi a arenk ri,~ he tells you."; } } else if (a_good in Sentence) print (The) self, " nods, and shows you his knife. He holds it out to one side, pointing out in the air away from him. Suddenly, it disappears! ", (The) self, " seems to be as confused as you are, and looks all around for it. Suddenly, he eyes you suspiciously, and approaches you. Before you can back away, he pulls his knife out from your clothing! A twinkle in his eye, he puts it back away again."; else print (The) self, " looks confused. ~Sti arenk,...~ he prompts."; } else print "~Iflo,~ ", (The) self, " says. Suddenly, he makes a feint with his knife towards your face, but then laughs when you flinch. ~Sti a arenk iflo,~ he chuckles."; n_you: print (The) self, " nods, opens his eyes wide, and points to them. ~Iflo,~ he tells you."; n_revelation, n_hut, n_weapon, n_it: print "~Arenk ", (the) y, "?~ ", (The) self, " asks, startled. He shakes his head. ~Y ", (the) y, " arenk,~ he says."; n_panther: print (The) self, " grins, and looks around on his skin. He shows you the place where the panther's head has been cut off. ~Ri y arenk,~ he says, then adds, ~Ri y arenk fi!~ and laughs."; a_strange: print "~Fi arenk farro,~ ", (the) self, " says, pointing at you, ~Sti!~"; default: !y is an adjective if (a_good in Sentence) { move n_i to sentence; move v_see to sentence; self.nalian(); rtrue; } else if (a_dangerous in Sentence) print "~Lobo? Fi ulk lobo! Sti arenk fi? Fi lobo!~, ", (The) self, " proclaims."; else print (The) self, " shakes his head. ~Fi ifisink y,~ he says. ~Arenk ", (the) y, "?~ He shakes his head."; } } } else if (x ofclass MyNoun) { if (y ofclass MyNoun) print (The) self, " blinks, and shakes his head. ~Y ", (the) x, " ulk ", (the) y, ",...~ he says."; else switch (x) { n_i: switch (y) { a_mine: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " raises an eyebrow and spreads his hands. ~A,...~ he says."; a_your, a_his: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " chuckles, and shakes his head. ~Sti y ulk ", (the) y, ",~ he says. He points to the hut. ~Undi. Undi ulk ", (the) y, ".~"; a_good: print (The) self, " crosses his arms and looks at you skeptically, but then laughs. ~A,~ he says, ~Sti ulk iflo.~"; a_bad: print (The) self, " looks concerned. ~Sti ulk akne?~ he asks you."; self.asked_question = 3; a_strange: print (The) self, " nods vigorously. ~A!~ he exclaims, ~Farro farro!~"; a_dangerous: print (The) self, " barely manages to suppress a giggle, but manages to look stern. ~A. Sti issulk,~ he says seriously, but the corners of his mouth are twitching."; } n_you: switch (y) { a_mine: print (The) self, " shakes his head. ~Fi ulk fo,~ he says."; a_your: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " shrugs, and nods in agreement. ~Fi fo, Sti sto, Ri ro,...~ he says."; a_his: print (The) self, " looks at his son and laughs. ~A!~ he exclaims, ~Fi ulk ro!~"; a_good: print (The) self, " bows in acknowledgment. ~Sti a ulk iflo,~ he allows."; a_bad: print (The) self, " looks affronted. ~Fi? Aslo?~ he asks you. He shakes his head and gives you a dirty look."; a_strange: print (The) self, " looks affronted. ~Fi?~ he asks, ~Fi farro? Y!~"; a_dangerous: print (The) self, " bows in acknowledgment. ~A!~ he exclaims, ~A lobo!~"; } n_revelation: if ((revelation in Void) && (self.knows_rev == 1)) { EmptyInto (Sentence, FL_Room); move n_revelation to Sentence; self.nalian(); rtrue; } else switch (y) { a_mine: if (revelation notin Void) { if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " nods. ~Fo kralni ulk sto kralni. Ri isink sto rema,~ he says."; } else print (The) self, " looks at you like he's looking for something you're carrying. Not finding it, he says, ~Kralni y ulk sto. Raki sto,...~ he shrugs."; a_your: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " nods. ~Fo kralni ulk iflo,~ he says."; a_his: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " raises an eyebrow, but shrugs. ~Kralni ulk fo, ro,~ he says, indicating his son."; a_good: print (The) self, " nods firmly. ~A,~ he says, ~A iflo kralni ulk.~"; a_bad: print "~Y!~ ", (The) self, " exclaims. ~Iflo kralni ulk!~"; a_strange: print (The) self, " considers this, and nods. ~Fi y ifisink kralni. Ri ulk farro.~"; a_dangerous: print (The) self, " ponders, but shakes his head. ~Y,~ he says, ~Y lobo. Iflo.~"; } n_hut, n_it: switch (y) { a_mine: switch (z) { nothing: print (The) self, " glances about, like he's looking for something. ~Sto raki?~ he asks. He points to his hut. ~Ri ulk fo raki.~"; default: print (The) self, " listens politely, nodding his head and saying ~A,~ at appropriate places. You get the feeling he's not really listening."; } a_your: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } print (The) self, " nods, and points to the hut behind him. ~A,~ he agrees, ~Ri ulk fo.~"; a_his: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } else print (The) self, " nods amicably, and says, ~A, Raki ulk ro.~"; a_good: print (The) self, " smiles proudly. ~Raki ulk fo!~ he proclaims."; a_bad: print (The) self, " looks offended. ~Y! Raki ulk iflo! Sti arenk? Sti arenk aslo, raki y ulk aslo.~"; a_strange, a_dangerous: print (The) self, " looks at you oddly. ~Raki ", (the) y, "?~ he asks. ~Fi y ifisink.~"; } n_weapon: switch (y) { a_mine: print (The) self, " looks at you warily and says, ~Sti y isink sto undi,~ he says."; a_your: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } print (The) self, " shows you his knife proudly. ~Ri ulk a iflo,~ he states."; a_his: print (The) self, " shakes his head. ~Fo rema y isink undi. A lobo.~"; a_good: print (The) self, " smiles broadly, and, as if to demonstrate, pulls up a corner of his woven door, and slices off the end of a leaf with one clean stroke."; a_bad: print (The) self, " snorts, and says, ~Sti aslo arenk. Undi a iflo ulk.~"; a_strange: print (The) self, " says, ~Sti arenk farro? Fi arenk iflo, lobo undi.~"; a_dangerous: print (The) self, " nods in assent. ~Ri ulk a lobo,~ he says. He points to his panther skin and smiles, as if to emphasize his point."; } n_panther: switch (y) { a_mine: print (The) self, " snorts in derision. ~Sti isink sto lobradi,~ he tells you, ~Ri ulk fo lobradi.~"; a_your: if (z ~= nothing) { move y to FL_room; self.nalian(); rtrue; } print (The) self, " nods, and pats his panther skin. ~Fo,~ he says. ~Fi issulk lobradi. Fi isink undi!~"; a_his: print (The) self, " shakes his head. ~Fi y arenk ri. Fo rema isink ro lobradi.~"; a_good: print (The) self, " chuckles. ~Y,~ he tells you. ~Lobradi lobo, lobradi y iflo.~"; a_bad, a_dangerous: print (The) self, " nods seriously. ~Lobradi a ulk lobo, aslo,~ he says."; a_strange: print "~Farro?~ ", (The) self, " asks in surprise. ~Fi y arenk ri.~"; } } } else !Player only used Adjectives. { print (The) self, " shakes his head. ~Fi ", (the) x, "? Ri ulk ", (the) y, "? Fo rema "; if (z ~= nothing) print (the) z; else print (the) x; print "?~ He shrugs, and spreads his hands."; } default: print (The) self, " seems to follow as you begin your sentence, but is shaking his head by the time you reach the end. ~Fi y ifisink,~ he says."; } EmptyInto (Sentence, FL_Room); ""; ], knows_rev 0, giveYouRev[; if (self.knows_rev == 1) { move revelation to player; etch2.leafgiven = 1; self.knows_rev = 2; "", (The) self, " says, ~A! Kralni! Sto rema ulk akne! Fi ifisink!~ He runs back into his hut, and shortly reappears with a stem from a small plant, which he hands to you with great reverence. ~Sti isink ri sto rema,~ he tells you. ~Ri ulk iflo.~"; } else "", (The) self, " nods. ~Kralni ulk iflo. Ri isink akne,~ he tells you."; ], answered [yesorno; if (yesorno==2) { self.asked_question = 0; "", (The) stranger, " looks at you skeptically, but lets it pass."; } switch (self.asked_question) { 0: self.asked_question = 0; "", (The) self, " looks at you quizzically, and spreads his hands. ~Y ifisink,~ he says."; 1: !He asked "Is that your hut?" self.asked_question = 0; if (yesorno==1) { hutpic.knowsitsyours=1; "", (The) self, " nods approvingly. ~Ri ulk iflo raki.~"; } if (yesorno==0) { hutpic.knowsitsyours=2; "~Iflo,~ ", (The) self, " says, ~Ri ulk aslo raki.~"; } 2: !He asked "Is your son sick?" self.asked_question = 0; if (yesorno == 1) { self.sympathy(); } else { self.knows_rev = 0; "", (The) self, " nods in relief. ~Iflo,~ he says. ~Rema akne ulk aslo.~"; } 3: !He asked "Are you sick?" self.asked_question = 0; if (yesorno == 1) "", (The) self, " looks you over carefully, the breaks into a broad grin. ~Y. Sti y ulk akne!~ he exclaims, and chuckles at you."; else "", (The) self, " sighs in relief. ~Iflo,~ he tells you. ~Akne ulk aslo.~"; 4: !He asked "Is your son at home?" self.asked_question = 0; if (yesorno == 1) "", (The) self, " nods, and says only, ~A.~"; else "", (The) self, " looks confused, but says only, ~A,...~"; } ], sympathy [; self.knows_rev = 1; "", (The) self, " shakes his head in sympathy. ~Aslo,~ he says. ~Akne rema ulk lobo.~"; ], asked_question 0, react_before [; Go: if (noun == sw_obj) { print "Stranger waves to you as you leave."; if (self.knows_rev==1) print " ~Iflo alvenk!~ he calls to you as you go."; if (revelation in player) print " ~Sto kralni ulk y akne sto rema!~ he adds."; print "^"; } rfalse; WaveHands: "Smiling, ", (the) self, " waves back."; Point: switch (noun) { stranger: "~Fi,~ he says, putting his hand on his chest."; LanguagePlayer: "~Sti,~ he says, pointing back at you."; s_son: "~Ri ulk fo rema!~ he says, proudly."; skin: "", (The) self, " smiles broadly. ~Lobradi!~ he exclaims, ~Ri lobo. Fi ulk a lobo!~"; knife: "", (The) self, " holds up his knife proudly. ~Fo undi. Fi issulk lobradi ri.~"; bone: "He looks at it with interest. ~Ri ulk lobo?~ he asks, then seems to answer himself, ~Y, ri y ulk lobo,~ shaking his head. He pats his knife. ~Ri ulk lobo.~"; berries: "~A,~ he says, taking one and popping it in his mouth. ~Iflo,~ he tells you."; mash: "~Sti ulk farro,~ Stranger says, shaking his head."; revelation: "~A. Ri isink sto rema akne. Alvenk, alvenk!~ He points down the path."; bark: switch (bark.sketch) { nothing: "", (The) self, " looks at the bark, then looks at you, then looks at the bark, then looks at you again. ~A,~ he says? He seems confused."; default: bark.sketch.shown(); rtrue; } s_hut_door, in_obj: "~Ri ulk fo raki,~ ", (The) self, " says, proudly."; sw_obj, s_obj: switch (hutpic.knowsitsyours) { 0: stranger.asked_question = 1; "~Sto raki?~ he asks."; 1: "~Sto raki ulk iflo,~ he tells you, nodding."; 2: "", (The) self, " shakes his head sadly. ~Ri ulk aslo raki,~ he confides to you."; } u_obj: "", (The) self, " looks up contemplatively. ~Fi arenk iflo. Ri y fo, y sto.~"; d_obj: "", (The) self, " smiles. ~Ri fo ulk!~ he tells you, and stands proudly in front of his hut."; default: if (noun provides shown) { noun.shown(); rtrue; } if (noun in Compass) "", (The) self, " gestures grandly around him. ~Fo ulk ri!~ he proclaims."; "", (The) self, " shrugs noncommittally, and looks disinterested."; } Show, Give: if (second==self) <>; Yes: print "You nod your head.^^"; self.answered(1); rtrue; No: print "You shake your head.^^"; self.answered(0); rtrue; Shrug: print "You eloquently raise your shoulders and spread your hands in an indication of complete and total ignorance.^^"; self.answered(2); rtrue; Jump: "", (The) self, " smiles as he watches you cavort, and says, ~Farro,...~ to himself."; ], has proper animate male transparent; Object -> -> skin "Panther skin" with name 'panther' 'skin' 'clothes', description [; "", (The) stranger, "'s Panther skin hangs comnertably over his shoulder, down to about his knees."; ], has proper; Object -> -> knife "Knife" with name 'knife' 'crude' 'stone', description "Knife seems to be fashioned with a stone blade and a wooden handle. Although it looks quite dangerous, you couldn't imagine hunting with a hand-held weapon.", has proper; Object InStrangeHut "Inside Hut" with description "I'm not sure if you should be in here.", s_to StrangeHut; Object revelation "Revelation" with name 'revelation' description "This is exactly the object you envisioned at your experience at the stump!"; Class Drawing with name 'drawing' 'picture' 'sketch' 'art' 'copy' 'of', shown [;"Stranger has no interest in this picture, because the implementor forgot to put one in. [BUG]";], before [; Rub, Erase: <>; ]; Object Draw_Room "The Drawing Museum" with description "This room is where the pictures go after you know what they are."; Drawing ->genpic "picture" with name 'shapes' 'stick' 'figure' 'curvy' 'line' 'snake', shown [; "", (The) stranger, " looks at your drawing in wonderment. ~Sti ulk a farro,~ he says, shaking his head."; ], description "Bark in now covered with various geometric shapes, a stick figure or two, and a curvy line which, for some reason, makes you think of the sound a snake makes."; !!The generic picture is here so that the player can't type 'draw !picture' and get the response 'which picture do you mean,....', which !would be a dreadful spoiler. This object works in conjunction with !'ChooseObjects' Drawing -> mepic "picture of yourself" with name 'me' 'myself' 'i', description "A decent likeness, if you do say so yourself.", shown [; "", (The) stranger, " studies the picture intently for a stow minutes. Suddenly, he brightens. ~Ri ulk sti!~ he exclaims."; ]; Drawing -> treepic "picture of the forest" with name 'forest' 'trees', description "A bunch of purple lines adorn the bark, supposedly depicting trees.", shown [; "He looks at it, raises his eyebrows, and shrugs. You shrug back. You never said you were a great artist."; ]; Drawing -> hutpic "picture of your Hut" with name 'hut' 'my' 'abode' 'tragedy', description "The simple drawing of your abode fails to convey the tragedy within.", shown [; if (self.knowsitsyours==0) { stranger.asked_question = 1; "~Sto raki?~ he asks."; } if (self.knowsitsyours==2) { "~Ri ulk aslo raki,~ he confides to you."; } else "~Ste raki ulk iflo,~ he says, after looking at it again."; ], knowsitsyours 0; Object First_Draw_Room "The Drawing Repository" with description "This room is where the pictures start off, before you know about them."; Drawing -> revelationpic "picture of your Revelation" with name 'revelation', description "You have sketched Revelation exactly the way it was revealed to you.", shown [; if (self hasnt general) { move n_fakerevelation to Void; move n_revelation to FL_Room; give self general; } if (stranger.knows_rev == 1) return stranger.giveYouRev(); "~Kralni,~ ", (The) stranger, " declares after looking at your picture. ~Kralni a ulk iflo. Arenk akne.~"; ]; Drawing -> stumppic "picture of Stump" with name 'stump', description "You've attempted to depict Stump, sitting in the middle of the clearing.", shown [; "", (The) stranger, " studies the picture intently, but shakes his head. ~Fi ifisink y,~ he tells you."; ]; Drawing -> strangerpic "picture of Stranger" with name 'man' 'stranger' 'face', description "You've sketched a picture of Stranger's face, with his angular chin and hard, thin lips.", shown [; "", (The) stranger, " studies the drawing carefully, then suddenly brightens. ~Fi!~ he exclaims, ~Ri ulk fi!~ He admires it, and smiles broadly. ~Fi arenk lobo, iflo,~ he says, almost to himself. Reluctantly, he hands it back to you. ~Iflo. A iflo,~ he says, admiringly."; ]; Drawing -> bonepic "picture of Bone" with name 'bone' 'pencil' 'brush' 'paintbrush', description "You've sketched the item you were drawing with. Briefly, you consider depicting Bone as it draws something else, but think better of it.", shown [; "", (The) stranger, " looks at the drawing with a puzzled look on his face, and turns the bark this way and that. Finally, he hands it back. ~Fi y arenk ri,~ he admits."; ]; Class Word with moveme 0 has proper; Class MyNoun class Word; Class MyVerb class Word; Class Adjective class Word; Object FL_Room "Foreign Language Room" with description "This room contains the words of the stranger."; MyVerb -> v_is "ulk" with name 'ulk'; MyVerb -> v_yes "a" with name #n$a; MyVerb -> v_no "y" with name #n$y; MyVerb -> v_give "arenk" with name 'arenk'; MyVerb -> v_take "isink" with name 'isink'; MyVerb -> v_leave "alvenk" with name 'alvenk'; MyVerb -> v_threaten "issulk" with name 'issulk'; MyVerb -> v_understand "ifisink" with name 'ifisink'; MyVerb -> v_see "arenk" with name 'arenk'; Adjective -> a_mine "fo" with name 'fo'; Adjective -> a_your "sto" with name 'sto'; Adjective -> a_his "ro" with name 'ro'; Adjective -> a_good "iflo" with name 'iflo'; Adjective -> a_bad "aslo" with name 'aslo'; Adjective -> a_strange "farro" with name 'farro'; Adjective -> a_dangerous "lobo" with name 'lobo'; MyNoun -> n_i "fi" with name 'fi'; MyNoun -> n_you "sti" with name 'sti'; MyNoun -> n_it "ri" with name 'ri'; MyNoun -> n_hut "raki" with name 'raki'; MyNoun -> n_weapon "undi" with name 'undi'; MyNoun -> n_panther "lobradi" with name 'lobradi'; MyNoun -> n_fakerevelation "kralni" with name 'kralni'; Object -> Sentence; MyNoun n_revelation "kralni" Void with name 'kralni'; Include "Grammar"; Verb "crush" "mash" "crumble" "squish" "grind" * noun ->Squeeze * "up" noun ->Squeeze; Verb 'dip' 'stick' * held 'into'/'in'/'inside' noun ->Insert; Verb "stain" "dye" "color" * noun "with"/"in"/"using" held ->Stain; [StainSub; if (second==mash or berries) <>; "That's not something you can use to ", (address) verb_word, " anything."; ]; Verb "write" * topic "on" noun ->Write reverse * "on" noun ->Write * topic ->Write; [WriteSub; "Writing? What's that?"; ]; [CanDraw; switch(scope_stage) { 1: rfalse; 2: ScopeWithin(Draw_Room); rtrue; 3: "You're not quite sure how to depict that."; } ]; [ThirdNoun x; x=NounDomain(player,location,0); if (x==REPARSE_CODE) return x; if (x==0) return -1; third = x; return 0; ]; [ThirdNounHeld x; x=NounDomain(player,location,1); if (x==REPARSE_CODE) return x; if (x==0) return -1; third = x; return 0; ]; [ThirdNounDraw x; x=NounDomain(Draw_Room,Draw_Room,0); if (x==REPARSE_CODE) return x; if (x==0) return -1; third = x; return 0; ]; Verb "draw" "sketch" "depict" "paint" "portray" * scope=CanDraw "on" surface ->Drawknown * scope=CanDraw "with" burin ->Drawknown * scope=CanDraw "on" noun "with" ThirdNounHeld ->Draw * "on" noun scope=CanDraw "with" ThirdNounHeld ->Draw reverse * "with" held "on" noun ThirdNounDraw ->Draw2 * "on" held "with" held ThirdNounDraw ->Draw2 reverse * scope=CanDraw "with" held "on" ThirdNoun ->Draw3 * "with" held scope=CanDraw "on" ThirdNoun ->Draw3 reverse; [DrawknownSub; third = bone; <>; ]; [DrawSub; if (third~=bone) { print (The) third; if (third has pluralname) print " do"; else print " does"; " not make a very good drawing tool."; } if (~~(bone.stained)) "You scratch ", (the) third, " against ", (the) second, ", but it makes no mark."; if (second ~= bark) "Please don't vandalize ", (the) second, "."; if (bark.used == 1) "You'll have to clean off your old drawing first."; bark.sketch = noun; bark.used = 1; if (AfterRoutines()==1) rtrue; give bark surface; give bone burin; "Carefully, you sketch ", (a) noun, " on ", (the) second, "."; ]; [Draw2Sub buffer; buffer = third; third = noun; noun = buffer; <>; ]; [Draw3Sub buffer; buffer = third; third = second; second = buffer; <>; ]; Extend "clean" * "off" noun ->Rub; Verb "erase" * noun ->Erase * noun "from" noun ->Erase; [EraseSub; <>; ]; Verb "actions." * -> MyParse * -> Incomprehensible * -> Franglais; [MyParseSub; ]; [IncomprehensibleSub; ]; [FranglaisSub; ]; Extend "ask" * creature topic ->Ask; Extend "tell" * creature topic ->Tell; Extend "say" * creature topic ->Answer; Verb "point" "gesture" * 'at'/'towards'/'to' noun ->Point * noun ->Point; [PointSub x; objectloop (x in location) { if ((x has animate) && (x ~= player)) "You attempt to point out ", (the) noun, " to ", (the) x, ", but don't get much of a response."; } print (The) noun, " fail"; if (noun hasnt pluralname) print "s"; " to respond."; ]; [OnBark; switch(scope_stage) { 1: rfalse; 2: if (bark in player) bark.add_to_scope(); rtrue; 3: "You're not holding anything like that."; } ]; [NotHeld x; switch(scope_stage) { 1: rfalse; 2: objectloop (x in location) { if (x == player) PlaceInScope(x); else { PlaceInScope(x); ScopeWithin(x); } } 3: "You don't see anything like that."; } ]; Extend "show" first * scope=OnBark 'to' animate ->Show * animate scope=OnBark ->Show reverse * scope=NotHeld 'to' animate ->Show * animate scope=NotHeld ->Show reverse; Verb "nod" * ->Yes * "head" ->Yes; Verb "shake" * "head" ->No * "my" "head" ->No * held ->Shake; [ShakeSub; "You shake ", (the) noun, ", fascinated by the fact that you can see through it if you move it fast enough."; ]; Verb "shrug" * ->Shrug * "shoulders" ->Shrug * "my" "shoulders" ->Shrug; [ShrugSub; "You eloquently raise your shoulders and spread your hands in an indication of complete and total ignorance."; ]; Verb "help" "hint" "hints" "info" "about" * ->Help; [HelpSub; top.select(); rtrue; ]; Menu top "Notes and Instructions"; Option -> l1 "The Point" with description "This example game was written to illustrate how I coded the 'language puzzle' in my game, 'The Edifice'. I'm releasing it in conjunction with an article in XYZZYnews about the puzzle. To avoid spoilers, I've changed all the vocabulary in this game from that in 'Edifice', but many of the responses are direct translations, so if you go through and compare specific responses, you'll be able to figure out most of the words in 'Edifice'. Of course, by that time, you'll have exerted approximately the same amount of effort it would have taken you to work it out in the first place, but anyway,...^ ^All the code present under Stranger's responses aren't strictly necessary as a coding example, but I thought I'd go ahead and leave it in, ostensibly to show people what they'd need to code if they did it themselves, but probably just to show off.^ ^As an added bonus, this means that the *exact same puzzle* is available in this example--in a different form! So you can experience the puzzle again! Exactly the same! Wow!^"; Option -> l2 "Legal Stuff" with description "This game and code is copyright (c) 1998 by Lucian Smith. Both are completely freeware for any purpose, and redistribution is allowed as long as they remain in their original form. Feel free to copy code into your own game--that's what it's there for, after all--but please do me the courtesy of mentioning me in the credits if you do so. And if you use it extensively in a game you release as shareware, 'feel free' to express your gratitude by sending me a registered copy :-) Thanks! Hope this helps!^^If you have comments, or want to reach me for some other purpose, my e-mail address is: lpsmith@@64rice.edu^";