--- /dev/null
+!% -SD\r
+\r
+!============================================================================\r
+Constant Story "William Tell";\r
+Constant Headline\r
+ "^A simple Inform example\r
+ ^by Roger Firth and Sonja Kesserich.^";\r
+!Release 1; Serial "020428"; ! IBG first edition (public beta)\r
+!Release 2; Serial "020827"; ! IBG second edition\r
+Release 3; Serial "040804"; ! for keeping track of public releases\r
+\r
+Constant MAX_SCORE = 3;\r
+\r
+Include "Parser";\r
+Include "VerbLib";\r
+\r
+!============================================================================\r
+! Object classes\r
+\r
+Class Room\r
+ has light;\r
+\r
+Class Prop\r
+ with before [;\r
+ Examine:\r
+ return false;\r
+ default:\r
+ print_ret "You don't need to worry about ", (the) self, ".";\r
+ ],\r
+ has scenery;\r
+\r
+Class Furniture\r
+ with before [;\r
+ Take,Pull,Push,PushDir:\r
+ print_ret (The) self, " is too heavy for that.";\r
+ ],\r
+ has static supporter;\r
+\r
+Class Arrow\r
+ with name 'arrow' 'arrows//p',\r
+ article "an",\r
+ plural "arrows",\r
+ description "Just like all your other arrows -- sharp and true.",\r
+ before [;\r
+ Drop,Give,ThrowAt:\r
+ print_ret "Your arrows are sharp, and you guard them carefully.";\r
+ ];\r
+\r
+Class NPC\r
+ with life [;\r
+ Answer,Ask,Order,Tell:\r
+ print_ret "Just use T[ALK] [TO ", (the) self, "].";\r
+ ],\r
+ has animate;\r
+\r
+!============================================================================\r
+! The game objects\r
+\r
+Room street "A street in Altdorf"\r
+ with description [;\r
+ print "The narrow street runs north towards the town square.\r
+ Local folk are pouring into the town through the gate to the\r
+ south, shouting greetings, offering produce for sale,\r
+ exchanging news, enquiring with exaggerated disbelief about\r
+ the prices of the goods displayed by merchants whose stalls\r
+ make progress even more difficult.^";\r
+ if (self hasnt visited)\r
+ print "^~Stay close to me, son,~ you say,\r
+ ~or you'll get lost among all these people.~^";\r
+ ],\r
+ n_to below_square,\r
+ s_to\r
+ "The crowd, pressing north towards the square,\r
+ makes that impossible.";\r
+\r
+Prop "south gate" street\r
+ with name 'south' 'southern' 'wooden' 'gate',\r
+ description "The large wooden gate in the town walls is wide open.";\r
+\r
+Prop "assorted stalls"\r
+ with name 'assorted' 'stalls',\r
+ description "Food, clothing, mountain gear; the usual stuff.",\r
+ found_in street below_square,\r
+ has pluralname;\r
+\r
+Prop "produce" !! added\r
+ with name 'goods' 'produce' 'food' 'clothing' 'mountain' 'gear' 'stuff',\r
+ description "Nothing special catches your eye.",\r
+ found_in street below_square,\r
+ has pluralname;\r
+\r
+Prop "merchants"\r
+ with name 'merchant' 'merchants' 'trader' 'traders',\r
+ description\r
+ "A few crooks, but mostly decent traders touting their wares\r
+ with raucous overstatement.",\r
+ found_in street below_square,\r
+ has animate pluralname;\r
+\r
+Prop "local people"\r
+ with name 'people' 'folk' 'local' 'crowd',\r
+ description "Mountain folk, just like yourself.",\r
+ found_in [; return true; ],\r
+ has animate pluralname;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+Room below_square "Further along the street"\r
+ with description\r
+ "People are still pushing and shoving their way from the southern\r
+ gate towards the town square, just a little further north.\r
+ You recognise the owner of a fruit and vegetable stall.",\r
+ n_to south_square,\r
+ s_to street;\r
+\r
+Furniture stall "fruit and vegetable stall" below_square\r
+ with name 'fruit' 'veg' 'vegetable' 'stall' 'table',\r
+ description\r
+ "It's really only a small table, with a big heap of potatoes,\r
+ some carrots and turnips, and a few apples.",\r
+ before [;\r
+ Search:\r
+ <<Examine self>>;\r
+ ],\r
+ has scenery;\r
+\r
+Prop "potatoes" below_square\r
+ with name 'potato' 'potatoes' 'spuds',\r
+ description\r
+ "Must be a particularly early variety... by some 300 years!",\r
+ has pluralname;\r
+\r
+Prop "fruit and vegetables" below_square\r
+ with name 'carrot' 'carrots' 'turnip' 'turnips' 'apples' 'vegetables',\r
+ description "Fine locally grown produce.",\r
+ has pluralname;\r
+\r
+NPC stallholder "Helga" below_square\r
+ with name 'stallholder' 'greengrocer' 'monger' 'shopkeeper' 'merchant'\r
+ 'owner' 'Helga' 'dress' 'scarf' 'headscarf',\r
+ description\r
+ "Helga is a plump, cheerful woman,\r
+ concealed beneath a shapeless dress and a spotted headscarf.",\r
+ initial [;\r
+ print "Helga pauses from sorting potatoes\r
+ to give you a cheery wave.^";\r
+ if (location hasnt visited) {\r
+ move apple to player;\r
+ print "^~Hello, Wilhelm, it's a fine day for trade! Is this\r
+ young Walter? My, how he's grown. Here's an apple for him\r
+ -- tell him to mind that scabby part, but the rest's good\r
+ enough. How's Frau Tell? Give her my best wishes.~^";\r
+ }\r
+ ],\r
+ times_spoken_to 0, ! for counting the conversation topics\r
+ life [;\r
+ Kiss:\r
+ print_ret "~Ooh, you saucy thing!~";\r
+ Talk:\r
+ self.times_spoken_to = self.times_spoken_to + 1;\r
+ switch (self.times_spoken_to) {\r
+ 1: score = score + 1;\r
+ print_ret "You warmly thank Helga for the apple.";\r
+ 2: print_ret "~See you again soon.~";\r
+ default:\r
+ return false;\r
+ }\r
+ ],\r
+ has female proper;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+Room south_square "South side of the square"\r
+ with description\r
+ "The narrow street to the south has opened onto the town square,\r
+ and resumes at the far side of this cobbled meeting place.\r
+ To continue along the street towards your destination --\r
+ Johansson's tannery -- you must walk north across the square,\r
+ in the middle of which you see Gessler's hat set on that\r
+ loathsome pole. If you go on, there's no way you can avoid\r
+ passing it. Imperial soldiers jostle rudely through the throng,\r
+ pushing, kicking and swearing loudly.",\r
+ n_to mid_square,\r
+ s_to below_square;\r
+\r
+Prop "hat on a pole" !! changed\r
+ with name 'hat' 'pole',\r
+ before [;\r
+ default:\r
+ print_ret "You're too far away at the moment.";\r
+ ],\r
+ found_in south_square north_square;\r
+\r
+Prop "Gessler's soldiers"\r
+ with name 'soldier' 'soldiers' 'guard' 'guards', !! added\r
+ description "They're uncouth, violent men, not from around here.",\r
+ before [;\r
+ FireAt:\r
+ print_ret "You're outnumbered many times.";\r
+ Talk:\r
+ print_ret "Such scum are beneath your contempt.";\r
+ ],\r
+ found_in south_square mid_square north_square marketplace,\r
+ has animate pluralname proper;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+Room mid_square "Middle of the square"\r
+ with description\r
+ "There is less of a crush in the middle of the square; most\r
+ people prefer to keep as far away as possible from the pole\r
+ which towers here, topped with that absurd ceremonial hat. A\r
+ group of soldiers stands nearby, watching everyone who passes.",\r
+ n_to north_square,\r
+ s_to south_square,\r
+ warnings_count 0, ! for counting the soldier's warnings\r
+ before [;\r
+ Go:\r
+ if (noun == s_obj) {\r
+ self.warnings_count = 0;\r
+ pole.has_been_saluted = false;\r
+ }\r
+ if (noun == n_obj) {\r
+ if (pole.has_been_saluted == true) {\r
+ print "^~Be sure to have a nice day.~^";\r
+ return false;\r
+ } ! end of (pole has_been_saluted)\r
+ else {\r
+ self.warnings_count = self.warnings_count + 1;\r
+ switch (self.warnings_count) {\r
+ 1: print_ret "A soldier bars your way. ^^\r
+ ~Oi, you, lofty; forgot yer manners, didn't you?\r
+ How's about a nice salute for the vogt's hat?~";\r
+ 2: print_ret "^~I know you, Tell, yer a troublemaker,\r
+ ain't you? Well, we don't want no bovver here,\r
+ so just be a good boy and salute the friggin'\r
+ hat. Do it now: I ain't gonna ask you again...~";\r
+ default:\r
+ print "^~OK, ";\r
+ style underline; print "Herr"; style roman;\r
+ print " Tell, now you're in real trouble. I asked you\r
+ nice, but you was too proud and too stupid. I\r
+ think it's time that the vogt had a little word\r
+ with you.~\r
+ ^^\r
+ And with that the soldiers seize you and Walter\r
+ and, while the sergeant hurries off to fetch\r
+ Gessler, the rest drag you roughly towards the\r
+ old lime tree growing in the marketplace.^";\r
+ move apple to son;\r
+ PlayerTo(marketplace);\r
+ return true;\r
+ } ! end of switch\r
+ } ! end of (pole has_NOT_been_saluted)\r
+ } ! end of (noun == n_obj)\r
+ ];\r
+\r
+Furniture pole "hat on a pole" mid_square !! changed\r
+ with name 'wooden' 'pole' 'pine' 'hat' 'black' 'red' 'brim' 'feathers',\r
+ description\r
+ "The pole, the trunk of a small pine some few inches in diameter,\r
+ stands about nine or ten feet high. Set carefully on top is\r
+ Gessler's ludicrous black and red leather hat, with a widely\r
+ curving brim and a cluster of dyed goose feathers.",\r
+ has_been_saluted false,\r
+ before [;\r
+ FireAt: !! added\r
+ print_ret "Tempting, but you're not looking for trouble.";\r
+ Salute:\r
+ self.has_been_saluted = true;\r
+ print_ret "You salute the hat on the pole. ^^\r
+ ~Why, thank you, sir,~ sneers the soldier.";\r
+ ],\r
+ has scenery;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+Room north_square "North side of the square"\r
+ with description\r
+ "A narrow street leads north from the cobbled square. In its\r
+ centre, a little way south, you catch a last glimpse of the pole\r
+ and hat.",\r
+ n_to [;\r
+ deadflag = 3;\r
+ print_ret "With Walter at your side, you leave the square by the\r
+ north street, heading for Johansson's tannery.";\r
+ ],\r
+ s_to "You hardly feel like going through all that again.";\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+Room marketplace "Marketplace near the square"\r
+ with description\r
+ "Altdorf's marketplace, close by the town square, has been hastily\r
+ cleared of stalls. A troop of soldiers has pushed back the crowd\r
+ to leave a clear space in front of the lime tree, which has been\r
+ growing here for as long as anybody can remember. Usually it\r
+ provides shade for the old men of the town, who gather below to\r
+ gossip, watch the girls, and play cards. Today, though, it\r
+ stands alone... apart, that is, from Walter, who has been lashed\r
+ to the trunk. About forty yards away, you are restrained by two\r
+ of the vogt's men.",\r
+ cant_go "What? And leave your son tied up here?";\r
+\r
+Object tree "lime tree" marketplace\r
+ with name 'lime' 'tree',\r
+ description "It's just a large tree.",\r
+ before [;\r
+ FireAt:\r
+ if (BowOrArrow(second) == true) {\r
+ deadflag = 3;\r
+ print_ret "Your hand shakes a little, and your arrow flies\r
+ high, hitting the trunk a few inches above Walter's\r
+ head.";\r
+ }\r
+ return true;\r
+ ],\r
+ has scenery;\r
+\r
+NPC governor "governor" marketplace\r
+ with name 'governor' 'vogt' 'Hermann' 'Gessler',\r
+ description\r
+ "Short, stout but with a thin, mean face, Gessler relishes the\r
+ power he holds over the local community.",\r
+ initial [;\r
+ print "Gessler is watching from a safe distance,\r
+ a sneer on his face.^";\r
+ if (location hasnt visited)\r
+ print "^~It appears that you need to be taught a lesson,\r
+ fool. Nobody shall pass through the square without paying\r
+ homage to His Imperial Highness Albert; nobody, hear me?\r
+ I could have you beheaded for treason, but I'm going to\r
+ be lenient. If you should be so foolish again, you can\r
+ expect no mercy, but this time, I'll let you go free...\r
+ just as soon as you demonstrate your archery skills by\r
+ hitting this apple from where you stand. That shouldn't\r
+ prove too difficult; here, sergeant, catch. Balance it on\r
+ the little bastard's head.~^";\r
+ ],\r
+ life [;\r
+ Talk:\r
+ print_ret "You cannot bring yourself to speak to him.";\r
+ ],\r
+ before [;\r
+ FireAt:\r
+ if (BowOrArrow(second) == true) {\r
+ deadflag = 3;\r
+ print_ret "Before the startled soldiers can react, you turn\r
+ and fire at Gessler; your arrow pierces his heart,\r
+ and he dies messily. A gasp, and then a cheer,\r
+ goes up from the crowd.";\r
+ }\r
+ return true;\r
+ ],\r
+ has male;\r
+\r
+!============================================================================\r
+! The player's possessions\r
+\r
+Object bow "bow"\r
+ with name 'bow',\r
+ description "Your trusty yew bow, strung with flax.",\r
+ before [;\r
+ Drop,Give,ThrowAt:\r
+ print_ret "You're never without your trusty bow.";\r
+ ]\r
+ has clothing;\r
+\r
+Object quiver "quiver"\r
+ with name 'quiver',\r
+ description\r
+ "Made of goatskin, it usually hangs over your left shoulder.",\r
+ before [;\r
+ Drop,Give,ThrowAt:\r
+ print_ret "But it was a present from Hedwig, your wife.";\r
+ ],\r
+ has container open clothing;\r
+\r
+Arrow "arrow" quiver;\r
+Arrow "arrow" quiver;\r
+Arrow "arrow" quiver;\r
+\r
+NPC son "your son"\r
+ with name 'son' 'your' 'boy' 'lad' 'Walter',\r
+ description [;\r
+ if (location == marketplace)\r
+ print_ret "He stares at you, trying to appear brave and\r
+ remain still. His arms are pulled back and tied behind\r
+ the trunk, and the apple nestles amid his blond hair.";\r
+ else\r
+ print_ret "A quiet, blond lad of eight summers, he's fast\r
+ learning the ways of mountain folk.";\r
+ ],\r
+ life [;\r
+ Give:\r
+ score = score + 1;\r
+ move noun to self;\r
+ print_ret "~Thank you, Papa.~";\r
+ Talk:\r
+ if (location == marketplace)\r
+ print_ret "~Stay calm, my son, and trust in God.~";\r
+ else\r
+ print_ret "You point out a few interesting sights.";\r
+ ],\r
+ before [;\r
+ Examine,Listen,Salute,Talk:\r
+ return false;\r
+ FireAt:\r
+ if (location == marketplace) {\r
+ if (BowOrArrow(second) == true) {\r
+ deadflag = 3;\r
+ print_ret "Oops! Surely you didn't mean to do that?";\r
+ }\r
+ return true;\r
+ }\r
+ else\r
+ return false;\r
+ default:\r
+ if (location == marketplace)\r
+ print_ret "Your guards won't permit it.";\r
+ else\r
+ return false;\r
+ ],\r
+ found_in [; return true; ],\r
+ has male proper scenery transparent;\r
+\r
+Object apple "apple"\r
+ with name 'apple',\r
+ description [;\r
+ if (location == marketplace)\r
+ print_ret "At this distance you can barely see it.";\r
+ else\r
+ print_ret "The apple is blotchy green and brown.";\r
+ ],\r
+ before [;\r
+ Drop:\r
+ print_ret "An apple is worth quite a bit --\r
+ better hang on to it.";\r
+ Eat:\r
+ print_ret "Helga intended it for Walter...";\r
+ FireAt:\r
+ if (location == marketplace) {\r
+ if (BowOrArrow(second) == true) {\r
+ score = score + 1;\r
+ deadflag = 2;\r
+ print_ret "Slowly and steadily, you place an arrow in\r
+ the bow, draw back the string, and take aim with\r
+ more care than ever in your life. Holding your\r
+ breath, unblinking, fearful, you release the\r
+ arrow. It flies across the square towards your\r
+ son, and drives the apple against the trunk of\r
+ the tree. The crowd erupts with joy;\r
+ Gessler looks distinctly disappointed.";\r
+ }\r
+ return true;\r
+ }\r
+ else\r
+ return false;\r
+ ];\r
+\r
+!============================================================================\r
+! Entry point routines\r
+\r
+[ Initialise;\r
+ location = street;\r
+ lookmode = 2; ! like the VERBOSE command\r
+ move bow to player;\r
+ move quiver to player; give quiver worn;\r
+ player.description =\r
+ "You wear the traditional clothing of a Swiss mountaineer.";\r
+ print_ret "^^\r
+ The place: Altdorf, in the Swiss canton of Uri. The year is 1307,\r
+ at which time Switzerland is under rule by the Emperor Albert of\r
+ Habsburg. His local governor -- the vogt -- is the bullying\r
+ Hermann Gessler, who has placed his hat atop a wooden pole in\r
+ the centre of the town square; everybody who passes through the\r
+ square must bow to this hated symbol of imperial might.\r
+ ^^\r
+ You have come from your cottage high in the mountains,\r
+ accompanied by your younger son, to purchase provisions. You are\r
+ a proud and independent man, a hunter and guide, renowned both\r
+ for your skill as an archer and, perhaps unwisely (for his soldiers\r
+ are everywhere), for failing to hide your dislike of the vogt.\r
+ ^^\r
+ It's market-day: the town is packed with people from the\r
+ surrounding villages and settlements.^";\r
+];\r
+\r
+[ DeathMessage; print "You have screwed up a favourite folk story"; ];\r
+\r
+!============================================================================\r
+! Standard and extended grammar\r
+\r
+Include "Grammar";\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+[ TalkSub;\r
+ if (noun == player) print_ret "Nothing you hear surprises you.";\r
+ if (RunLife(noun,##Talk) ~= false) return; ! consult life[; Talk: ]\r
+ print_ret "At the moment, you can't think of anything to say.";\r
+];\r
+\r
+Verb 'talk' 't//' 'converse' 'chat' 'gossip'\r
+ * 'to'/'with' creature -> Talk\r
+ * creature -> Talk;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+[ BowOrArrow o;\r
+ if (o == bow or nothing || o ofclass Arrow) return true;\r
+ print "That's an unlikely weapon, isn't it?^";\r
+ return false;\r
+];\r
+\r
+[ FireAtSub;\r
+ if (noun == nothing)\r
+ print_ret "What, just fire off an arrow at random?";\r
+ if (BowOrArrow(second) == true)\r
+ print_ret "Unthinkable!";\r
+];\r
+\r
+Verb 'fire' 'shoot' 'aim'\r
+ * -> FireAt\r
+ * noun -> FireAt\r
+ * 'at' noun -> FireAt\r
+ * 'at' noun 'with' noun -> FireAt\r
+ * noun 'with' noun -> FireAt\r
+ * noun 'at' noun -> FireAt reverse;\r
+\r
+Extend 'attack' replace\r
+ * noun -> FireAt;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+[ SaluteSub;\r
+ if (noun has animate) print_ret (The) noun, " acknowledges you.";\r
+ print_ret (The) noun, " takes no notice.";\r
+];\r
+\r
+Verb 'bow' 'nod' 'kowtow' 'genuflect'\r
+ * 'at'/'to'/'towards' noun -> Salute;\r
+\r
+Verb 'salute' 'greet' 'acknowledge'\r
+ * noun -> Salute;\r
+\r
+Extend 'give'\r
+ * 'homage' 'to' noun -> Salute;\r
+\r
+Extend 'wave'\r
+ * 'at' noun -> Salute;\r
+\r
+!----------------------------------------------------------------------------\r
+\r
+[ UntieSub; print_ret "You really shouldn't try that."; ];\r
+\r
+Verb 'untie' 'unfasten' 'unfix' 'free' 'release'\r
+ * noun -> Untie;\r
+\r
+!============================================================================\r