Implement additional description for North and West of cabin. Fix some overly long...
[snowed-in.git] / src / snowed-in.inf
1 ! Copyright (C) 2021, 2022 Jason Self <j@jxself.org>
2 !
3 ! This file is free software: you may copy, redistribute and/or
4 ! modify it under the terms of the GNU Affero General Public License
5 ! as published by the Free Software Foundation, either version 3 of
6 ! the License, or (at your option) any later version.
7 !
8 ! This file is distributed in the hope that it will be useful, but
9 ! WITHOUT ANY WARRANTY; without even the implied warranty of
10 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ! Affero General Public License for more details.
12 !
13 ! You should have received a copy of the GNU Affero General Public
14 ! License along with this file. If not, see https://gnu.org/licenses/
15 Global lantern_fuel_left = 20;
16 Global body_temperature = 20;
17 Global cabin_has_electricity = 1;
18 Global forest_location = 1;
19 Global snowmobile_location = 0;
20 Constant MAX_SCORE = 7;
21 Constant DEATH_MENTION_UNDO;
22 Constant Story "Snowed In";
23 Constant Headline 
24     "^A work of interactive fiction.
25     ^If you get stuck try typing HELP.
26     ^Ongoing development: https://jxself.org/git/?p=snowed-in.git
27     ^Send bugs and feedback by email to j@@64jxself.org.
28     ^IFID DE9FA2E5-4EC7-4166-9218-E56EFA1DF40F
29     ^Copyright (C) 2021, 2022 Jason Self <j@@64jxself.org>
30     ^You can change and share this game under the terms of the GNU 
31     Affero General Public License as published by the Free Software 
32     Foundation (FSF), either version 3 of the License, or (at your 
33     option) any later version published by the FSF. See the GNU Affero 
34     General Public License for more details.^^You should have received 
35     a copy of this game's source code along with a copy of the GNU 
36     Affero General Public License so that you can know your rights. 
37     If not, contact the place you got it from.^^";
38 Include "parser";
39 Include "verblib";
40 Release 1;
41 Serial "220531";
42
43 Object  mainroom "Main Room"
44   with  description 
45             "This room is a total wreck - it looks like a major fight 
46             happened in here. There's a ripped up sofa and a broken 
47             old coffee table in the middle of the room. A flat-screen 
48             TV is mounted against the wall, with the screen dangling 
49             out. This cabin has three other rooms. There's an office 
50             area to the east, and a bedroom to the north. A 
51             kitchenette can be found to the west. There's a doorway 
52             in the south wall leading outside.",
53         n_to bedroom,
54         s_to frontdoor,
55         e_to office,
56         w_to kitchenette,
57   has   light;
58
59 Object  frontdoor "front door" mainroom
60   with  name 'door' 'front',
61         description 
62             "The wooden door is made of thick oak wood with the shape 
63             of a bear claw engraved in it.",
64         short_name [;
65             if (location == mainroom)
66                 print "door to the outside";
67             else
68                 print "door to the cabin";
69             return true;
70         ],
71         found_in mainroom southofcabin,
72         door_dir [;
73             if (location == mainroom)
74                 return s_to;
75             else
76                 return n_to;
77         ],
78         door_to [;
79             if (location == mainroom)
80                 return southofcabin;
81             else
82                 return mainroom;
83         ],
84   has   scenery door openable;
85
86 Object  bearclaw "bear claw" mainroom
87   with  name 'bear' 'claw',
88   with  description 
89             "It's in the shape of a thin, sharp claw with three jagged 
90             points at the top of it.",
91   has   scenery;
92
93 Object  sofa "sofa" mainroom
94   with  name 'sofa' 'couch',
95   with  description 
96             "The sofa is in poor shape. The upholstery is ripped and 
97             there are several holes in it.",
98         before [;
99           Take, Pull, Push, PushDir, Turn:
100             print_ret (The) self, " is too heavy for that.";
101         ],
102   has   scenery supporter enterable;
103
104 Object  coffeetable "coffee table" mainroom
105   with  name 'coffee' 'table',
106   with  description 
107             "The old coffee table looks as if it's had quite a bit of 
108             use. There are burn marks covering it and the paint is 
109             worn off in most places.",
110         before [;
111           Take, Pull, Push, PushDir, Turn:
112             print_ret (The) self, " is too heavy for that.";
113         ],
114   has   scenery supporter enterable;
115
116 Object  lantern "copper lantern" coffeetable
117   with  name 'lantern' 'copper' 'lamp',
118         description 
119             "This is an exceptionally beautiful lantern, made of 
120             fired copper, and polished until it shines. About eleven 
121             inches high, with a base of about 5 inches or so in 
122             diameter and a large, brass-closed hook at the top. A 
123             rainbow of unique colors run through the copper. The 
124             glass in the lamp has a fresnel type of design, which is 
125             used to distribute light widely.",
126         time_left,
127         time_out [;
128             if (lantern has on) {
129                 lantern_fuel_left = 0;
130                 give lantern ~on;
131                 give lantern ~light;
132                 StopDaemon(lantern);
133                 print_ret 
134                     "Suddenly, the lantern's flame begins to flicker 
135                     violently within its glass prison and then 
136                     extinguishes itself.";
137             }
138         ],
139         before [;
140           SwitchOn:
141             if (lantern_fuel_left > 0) {
142                 give lantern light;
143                 StartTimer(lantern, lantern_fuel_left);
144             }
145             else {
146                 print_ret 
147                     "You snap the switch a few times, but nothing 
148                     happens.";
149             }
150           SwitchOff:
151             StopTimer(lantern);
152             give lantern ~light;
153         ],
154         daemon [;
155             if (lantern has on)
156                 lantern_fuel_left = lantern.time_left;
157             if (lantern has on && lantern_fuel_left <= 5)
158                 print_ret "The lantern's fuel runs low.";
159         ],
160   has   switchable;
161
162 Object  television "flat-screen TV" mainroom
163   with  name 'TV' 'television' 'flat' 'screen' 'flat-screen',
164   with  description 
165             "The flat-screen TV looks fairly modern but it's been 
166             broken in a fight and the screen is dangling out.",
167         before [;
168           Take, Pull, Push, PushDir, Turn:
169             print_ret (The) self, " is firmly mounted to the wall.";
170           SwitchOn:
171             if (television hasnt visited) {
172                 score = score + 1;
173                 print 
174                     "Despite the significant damage, the television 
175                     comes to life in one last valiant attempt to be 
176                     useful. Your favorite news program is on: U.S. 
177                     News And Grue Report. The news anchor is giving a 
178                     warning of grue sightings in the area of the 
179                     forest before the television finally dies.^";
180                 give television visited;
181             }
182             else {
183                 print 
184                     "The flat-screen TV is broken and can't be 
185                     turned on.^";
186             }
187             return true;
188         ],
189   has   scenery switchable;
190
191 Object  lightsocket "light socket" mainroom
192   with  name 'socket' 'lightsocket',
193         before [;
194           Take, Pull, Push, PushDir, Turn:
195             print_ret 
196                 "You don't have the tools to remove a light 
197                 socket.";
198           Receive:
199             if (noun ~= lightbulb) {
200                 print "Put ";
201                 print (a) noun;
202                 print_ret 
203                     " into the light socket? Maybe you should come 
204                     with a warning label because you contain more than 
205                     a trace amount of nut.";
206             }
207             if (noun == lightbulb && lightbulb has on) {
208                 give mainroom light;
209                 give office light;
210                 give kitchenette light;
211                 give bedroom light;
212                 give eastofcabin light;
213                 give southofcabin light;
214             }
215         ],
216   has   scenery container transparent open;
217
218 Object  lightbulb "light bulb" lightsocket
219   with  name 'light' 'bulb' 'lightbulb',
220         before [;
221           SwitchOn:
222             if (lightbulb in lightsocket) {
223                 if (cabin_has_electricity == 1) {
224                     give mainroom light;
225                     give office light;
226                     give kitchenette light;
227                     give bedroom light;
228                     give eastofcabin light;
229                     give southofcabin light;
230                 }
231                 else {
232                     print_ret 
233                         "You flip the switch a few times, but nothing 
234                         happens.";
235                 }
236             }
237             else {
238                 print_ret 
239                     "Turn on a lightbulb when it's not in the 
240                     socket? What a strange idea.";
241             }
242         ],
243         after [;
244           Take, Pull, Push, PushDir, Turn, SwitchOff:
245             give lightbulb ~on;
246             give mainroom ~light;
247             give office ~light;
248             give kitchenette ~light;
249             give bedroom ~light;
250             give eastofcabin ~light;
251             give southofcabin ~light;
252         ],
253   has   switchable on;
254
255 Object  office "Office"
256   with  description 
257             "There seems to have been quite a fight in here. The room 
258             is a wreck. Holes are in the walls and the window is 
259             broken, letting in the cold air from outside. Chunks of 
260             drywall and insulation cover the floor. The desk has a 
261             bullet hole through the middle.",
262         before [;
263           Go:
264             if (noun == e_obj) {
265                 if (snowshoes has worn)
266                     print_ret 
267                         "You can't fit through the window while 
268                         wearing the snow shoes.";
269             }
270             if (eastofcabin hasnt visited) {
271                 score = score + 1;
272                 give office visited;
273             }
274         ],
275         w_to mainroom,
276         e_to window,
277   has   light;
278
279 Object  desk "solid oak desk" office
280   with  name 'solid' 'oak' 'desk',
281   with  description 
282             "The desk is old and made of solid oak. The right side of 
283             it has been smashed and all of the drawers have been 
284             removed. A bullet hole goes straight through the middle of 
285             the desk.",
286         before [;
287           Take, Pull, Push, PushDir, Turn:
288             print_ret (The) self, " is too heavy for that.";
289         ],
290   has   scenery supporter enterable;
291
292 Object  businesscard "business card" desk
293   with  name 'business' 'card',
294   with  description 
295             "The business card is white and has blacked edges. It 
296             bears the name ~Lasting Solutions~, a local data recovery 
297             company, in bold letters on the top. The company's 
298             website URL is printed in blue at the bottom.";
299
300 Object  salesreceipt "sales receipt" desk
301   with  name 'sales' 'receipt',
302   with  description 
303             "The sales receipt is for $200, dated three years ago. 
304             It's printed on old tractor feed printer paper and bears 
305             the name ~Lasting Solutions~, a local data recovery 
306             company. A handwritten note is scrawled on the bottom: 
307             ~Start working on these hard drives soon.~";
308
309 Object  computer "computer" desk
310   with  name 'computer' 'PC',
311   with  description 
312             "It's a heavy older model that appears to have been 
313             seriously damaged in a fight. It's clearly on its last 
314             legs but is perhaps still useful.",
315         before [;
316           Take, Pull, Push, PushDir, Turn:
317             print_ret (The) self, " is too heavy for that.";
318           SwitchOn:
319             if (computer hasnt visited) {
320                 score = score + 1;
321                 print 
322                     "The computer makes some concerning noises while 
323                     lights on the front also illuminate. The last 
324                     file is quickly displayed. ~If anyone else reads 
325                     this, you're in serious danger. I've been fighting 
326                     a ferocious grue for the last three days. I'm 
327                     almost out of supplies and can't last much 
328                     longer. I'm going to take the last of the supplies 
329                     and escape through the office window in a 
330                     last-ditch effort to get away and get back into 
331                     town. I hope I can make it.~ The computer then 
332                     makes a sickly sound and finally dies as some 
333                     smoke comes out of it.^";
334                 give computer visited;
335             }
336             else {
337                 print 
338                     "The display briefly flickers but nothing 
339                     else happens.^";
340             }
341             return true;
342         ],
343   has   switchable;
344
345 Object  drywall "drywall" office
346   with  name 'drywall' 'dry' 'wall',
347         before [;
348           Take, Pull, Push, PushDir, Turn:
349             print_ret "Taking that would achieve little.";
350         ],
351   has   scenery;
352
353 Object  insulation "insulation" office
354   with  name 'insulation',
355         before [;
356           Take, Pull, Push, PushDir, Turn:
357             print_ret "Taking that would achieve little.";
358         ],
359   has   scenery;
360
361 Object  bullethole "bullet hole" desk
362   with  name 'bullet' 'hole' 'holes',
363   with  description 
364             "Looks to have come from something that's capable of 
365             doing a lot of damage.",
366         found_in desk bedroom,
367   has   scenery;
368
369 Object  window "window" office
370   with  name 'window' 'windows',
371         description 
372             "The window faces the east side of the cabin. It's broken, 
373             letting in the cold air from outside.",
374         short_name [;
375             if (location == office)
376                 print "window";
377             else
378                 print "window into the cabin";
379             return true;
380         ],
381         found_in office eastofcabin,
382         door_dir [;
383             if (location == office)
384                 return e_to;
385             else
386                 return w_to;
387         ],
388         door_to [;
389             if (location == office)
390                 return eastofcabin;
391             else
392                 return office;
393         ],
394         before [;
395           Search:
396             print_ret "The window faces the east side of the cabin.";
397           Open, Close:
398             print_ret 
399                 "The window's broken so it's not clear how 
400                 you'd do that.";
401         ],
402   has   scenery door openable open;
403
404 Object  kitchenette "Kitchenette"
405   with  description 
406             "The kitchenette is empty. A sink, you think, though it's 
407             hard to tell what's a pipe and what's a faucet. A 
408             refrigerator, standing open and empty. The door has been 
409             ripped off. There's no indication as to where it 
410             went. There's no food anywhere in here.",
411         e_to mainroom,
412   has   light;
413
414 Object  refrigerator "refrigerator" kitchenette
415   with  name 'fridge' 'refrigerator',
416   with  description 
417             "An old rusty refrigerator, standing open and empty. The 
418             door has been ripped off. There's no indication as to 
419             where it went.",
420         before [;
421           Take, Pull, Push, PushDir, Turn:
422             print_ret (The) self, " is too heavy for that.";
423           Open, Close:
424             print_ret (The) self, " door is missing.";
425         ],
426   has   scenery enterable container openable open;
427
428 Object  sink "sink" kitchenette
429   with  name 'sink' 'pipe' 'faucet',
430   with  description 
431             "A sink, you think, though it's hard to tell what's a 
432             pipe and what's a faucet.",
433         after [;
434           SwitchOn:
435             print_ret 
436                 "Pipes from in the walls make a groaning sound, 
437                 almost like pain and despair. No water comes out.";
438         ],
439   has   scenery container switchable;
440
441 Object  bedroom "Bedroom"
442   with  description 
443             "This bedroom is small and cramped, and looks like a 
444             major fight happened as the exterior wall has bullet 
445             holes. The bed is lying on the floor, torn to shreds. It 
446             has no sheets, just a bare mattress.",
447         s_to mainroom,
448   has   light;
449
450 Object  bed "bed" bedroom
451   with  name 'bed' 'mattress',
452   with  description "The mattress is bare and empty.",
453         before [;
454           Take, Pull, Push, PushDir, Turn:
455             print_ret (The) self, " is too heavy for that.";
456         ],
457   has   scenery supporter;
458
459 Object  suitcase "suitcase" bedroom
460   with  name 'suitcase' 'case',
461   with  description 
462             "The suitcase is made of a light metallic material that 
463             you can't quite make out. The color of it is somewhere 
464             between silver and grey.",
465   has   container open openable;
466
467 Object  snowsuit "snowsuit" suitcase
468   with  name 'snowsuit' 'snow' 'suit',
469   with  description 
470             "The snowsuit is blue, decorated with white and purple 
471             designs. On the chest are the letters ~CE~ in purple.",
472         before [;
473           Examine:
474             if (snowsuit hasnt visited) {
475                 score = score + 1;
476                 give snowsuit visited;
477             }
478           Wear:
479             if (snowshoes in player && snowshoes has worn) {
480                 print_ret 
481                     "The snowsuit can't fit over the 
482                     snowshoes.";
483             }
484           Disrobe, Remove:
485             if (snowshoes in player && snowshoes has worn) {
486                 print_ret 
487                     "The snowsuit can't be taken off over the 
488                     snowshoes.";
489             }
490         ],
491         daemon [;
492             if (location ~= mainroom && location ~= office && location ~=
493             kitchenette && location ~= bedroom && location ~= thedark &&
494             snowsuit hasnt worn) {
495                 body_temperature = --body_temperature;
496             }
497             if (location == mainroom || location == office || location ==
498             kitchenette || location == bedroom || snowsuit has worn && body_temperature
499             < 20) {
500                 body_temperature = ++body_temperature;
501             }
502             if (body_temperature == 0) {
503                 deadflag = 4;
504             }
505             if (body_temperature <= 5)
506                 print_ret 
507                     "You're shivering uncontrollably, and it's hard 
508                     to move. You feel very exhausted and drowsy. It's 
509                     all you can do to keep from falling over.";
510             if (body_temperature > 5 && location ~= mainroom && location
511             ~= office && location ~= kitchenette && location ~= bedroom
512             && location ~= thedark && snowsuit hasnt worn) {
513                 switch (body_temperature) {
514                   19:
515                     "The feeling of cold overwhelms you. Surely the 
516                     cold will get to you before anything else does. 
517                     Right?";
518                   18:
519                     "You can feel yourself getting colder and 
520                     colder.";
521                   17:
522                     "You can see your own breath freezing in the air, 
523                     forming little clouds.";
524                   16:
525                     "You shiver in the cold.";
526                   15:
527                     "You continue to shiver in the cold.";
528                   14:
529                     "Your hands grow numb from the cold.";
530                   13:
531                     "You continue shivering in order to keep warm.";
532                   12:
533                     "Your shivering grows worse as your body becomes 
534                     colder by the minute.";
535                   11:
536                     "Your teeth begin to chatter as you desperately 
537                     try to warm yourself up.";
538                   10:
539                     "Your shivering intensifies as your body begins 
540                     to freeze over from the cold.";
541                   9:
542                     "Your fingers become stiff and you feel sharp 
543                     pains all over your body.";
544                   8:
545                     "The cold has gotten to a point where it is too 
546                     much for you. You begin to shiver 
547                     uncontrollably.";
548                   7:
549                     "Your eyesight begins to fade and you can't even 
550                     feel yourself shivering anymore.";
551                   6:
552                     "You can feel your body shutting down from the 
553                     cold as you slowly begin to lose consciousness.";
554                 }
555             }
556         ],
557   has   clothing;
558
559 Object  snowshoes "snowshoes" bedroom
560   with  name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes'
561         'metal' 'frame',
562   with  description 
563             "They're light blue in color and have a thick, hard 
564             rubber bottom that's attached to a metal frame that keeps 
565             you from sinking into the snow. They look to be warm and 
566             comfortable.",
567         after [;
568           Wear:
569             print_ret (The) self, 
570                 " fit perfectly and go up to your 
571                 knees.";
572         ],
573         daemon [;
574             if (location ~= mainroom && location ~= office && location ~=
575             kitchenette && location ~= bedroom && location ~= thedark &&
576             location ~= eastofcabin && snowshoes hasnt worn) {
577                 deadflag = 3;
578             }
579         ],
580   has   pluralname clothing;
581
582 Object  southofcabin "South Of Cabin"
583   with  description [;
584             print 
585                 "The wind is howling, and there's snow flying 
586                 everywhere. The snow buildup seems to get higher to 
587                 the west. ";
588             if (snowsuit hasnt worn)
589                 print 
590                     "It's really cold and you're not dressed for 
591                     this weather. ";
592             if (frontdoor has open) {
593                 check_for_cabin_lighting();
594             }
595             if (snowshoes has worn && lantern in player && eastofcabin hasnt
596             visited && lantern_fuel_left > 0) {
597                 throw_rock();
598             }
599             print "^";
600         ],
601         n_to frontdoor,
602         s_to forest,
603         e_to eastofcabin,
604         w_to westofcabin,
605   has   light;
606
607 Object  truckspot "Forest"
608   with  description 
609             "The blizzard is still going on. You don't think it's 
610             letting up any time soon. There is a blue and white 
611             pickup truck here. It looks like it got stuck in the snow 
612             and is slowly being covered by it. The windows are iced 
613             up and you can't see inside.",
614         before [;
615           Go:
616             forest_location = forest_location++;
617             PlayerTo(forest, 1);
618         ];
619
620 Object  truck "blue and white pickup truck" truckspot
621   with  name 'pickup' 'truck' 'door' 'doors',
622   with  description 
623             "The blue and white pickup truck looks old and battered. 
624             The paint has chipped and faded. The windows are iced up 
625             and you can't see inside.",
626         before [;
627           Take, Pull, Push, PushDir, Turn:
628             print_ret (The) self, " is too heavy for that.";
629           Search:
630             print_ret 
631                 "The windows are iced up and you can't see 
632                 inside.";
633           Enter, Open, GoIn:
634             print_ret (The) self, " is frozen shut.";
635         ],
636   has   scenery supporter enterable openable;
637
638 Object  backpacklocation "Forest"
639   with  description 
640             "You keep walking and walking. The snowfall is still as 
641             heavy as ever. As you continue trudging through the snow, 
642             you wonder if you're actually moving in the right 
643             direction. You can't see anything through the blizzard. 
644             You wonder if you might be going in circles and end up 
645             wandering around forever, never finding your way out of 
646             this white void. You're unsure of which way to go. The 
647             snowfall is so thick that you can barely see your hand if 
648             you hold it right in front of your face. You have no idea 
649             how far you've come or in what direction.",
650         before [;
651           Go:
652             forest_location = forest_location++;
653             PlayerTo(forest, 1);
654         ];
655
656 Object  backpack "backpack" backpacklocation
657   with  name 'backpack' 'back' 'pack' 'blood',
658   with  description 
659             "The backpack is of medium size, black, with three white 
660             stripes running vertically on the back. The middle stripe 
661             is broken up by a red line running down the center of it 
662             toward the bottom of the backpack. On the side are the 
663             letters ~CE~ in purple. The backpack is covered in blood, 
664             as if the owner met with an untimely demise.",
665         before [;
666           Examine:
667             if (backpack hasnt visited) {
668                 score = score + 1;
669                 give backpack visited;
670             }
671         ],
672   has   clothing container openable;
673
674 Object  flashlight "flashlight" backpack
675   with  name 'flashlight' 'flash' 'light' 'torch',
676         description 
677             "It looks like a cheap red plastic model, about eight 
678             inches long.",
679         before [;
680           SwitchOn:
681             if (flashlight hasnt visited) {
682                 score = score + 1;
683                 give flashlight visited;
684             }
685             give flashlight light;
686           SwitchOff:
687             give lantern ~light;
688         ],
689   has   switchable;
690
691 [ print_forest_description;
692     if (location ~= thedark) {
693         switch (forest_location) {
694           1:
695             print_ret 
696                 "You push on despite the bitter cold and the heavy 
697                 snowfall as you come to a fork. There are two ways to 
698                 go here, one involves a hill to the south. The 
699                 other way is continuing through the woods to the 
700                 north.";
701           2:
702             print_ret 
703                 "The wind is bitterly cold. You plow through the 
704                 snowfall, which is still as heavy as ever. You can 
705                 barely see where you are going, making it hard to 
706                 tell which direction is which. Out of the corner of 
707                 your eye, you spot a tall, shadowy figure lingering 
708                 at the edge of your vision. When you turn to look at 
709                 it directly, however, it disappears. You continue 
710                 walking. The wind is howling louder than ever. The 
711                 endless snowfall makes it difficult to see where 
712                 you're going. You can't tell where the white sky and 
713                 white ground begin and end.";
714           3:
715             PlayerTo(truckspot);
716           4:
717             print_ret 
718                 "You trudge through the snow. The wind is really 
719                 strong and howling like a banshee. You hear a 
720                 horrible howl in the distance or is it the wind? 
721                 Looking around you see nothing in this barren 
722                 landscape but snow. You're not sure what to make of 
723                 it, but you don't want to stick around to find out. 
724                 The whole world is white. You can barely see five 
725                 feet ahead of you. You hope you're going the right 
726                 way. This place is so desolate and barren.";
727           5:
728             print_ret 
729                 "You think you might can see a large figure stepping 
730                 out of the trees and moving in the distance but the 
731                 wind is blowing hard and whipping up massive amounts 
732                 of snow, making it hard to tell for sure. Your breath 
733                 billows out in huge clouds. If it keeps blowing like 
734                 this, you're not sure if you'll ever be able to get 
735                 back. Snow whirls through the air as a gust of wind 
736                 picks up speed. The howling gets louder and more 
737                 intense. There's no left, right, backward or forward. 
738                 There's nothing but endless, unchanging whiteness.";
739           6:
740             PlayerTo(backpacklocation);
741           7:
742             print_ret 
743                 "It feels like you're lost in a maze of snow without 
744                 a map. You keep trudging through the heavy snowfall, 
745                 not knowing if you're even going in any particular 
746                 direction anymore. The wind is really picking up now 
747                 and the snowfall is getting heavier. You have to keep 
748                 going. You can't let the snowstorm get the best of 
749                 you. You can't give up. You must find a way out of 
750                 this frozen wasteland. The snowstorm has made it 
751                 impossible to see anything more than a few feet in 
752                 front of you.";
753           8:
754             print_ret 
755                 "The wind is now a shrieking banshee, freezing and 
756                 relentless, as it throws the snow into your face, 
757                 blinding you. It's hard to walk against the brutal 
758                 winds. You can't see anything, but you must keep 
759                 going. There is no choice. You continue your way 
760                 through the snowy white void, what with the snow 
761                 piling up around you. The wind screams in your ears 
762                 and you can't see anything. Can't go back. Can't go 
763                 forward. You can't even see where you are. You hope 
764                 that, as long as you keep moving, you'll eventually 
765                 find a way out of this frozen wasteland.";
766           9:
767             print_ret 
768                 "The blizzard rages, but you continue to press on. 
769                 There's nothing here but you, the snowfall, and the 
770                 fierce wind howling through this frozen landscape. 
771                 This isn't just a place of cold and ice - it's 
772                 other-worldly. You trudge on and try to keep your 
773                 spirits up and not let the snowstorm get to you. 
774                 Every step is an effort. You wish you had the powers 
775                 of a superhero right now. You can barely see where 
776                 you are going. The wind knocks you down on your hands 
777                 and knees. You get back up, but you're slipping and 
778                 sliding all over the place.";
779           10:
780             print_ret 
781                 "You wander around in the impenetrable white void. 
782                 The wind is howling louder than ever. You try to 
783                 persevere. You don't know if you're going in circles 
784                 or what, but you start to feel that this frozen, 
785                 lifeless landscape is sucking away your very life 
786                 force. You can't see your hand in front of your face. 
787                 You can barely keep moving. Every step you take is 
788                 hard-fought. You just want this awful nightmare to 
789                 end. You begin to feel sleepy but you're in danger 
790                 here. You have to keep moving. Sleep is not an option 
791                 when you're in a place like this.";
792           11:
793             print_ret 
794                 "You try to remember the survival tips you've read 
795                 on the internet, but frankly, you don't remember most 
796                 of them right now. As you walk you try to keep your 
797                 mind occupied with anything other than the storm. 
798                 Nothing makes any sense and you feel like you're 
799                 starting to go in circles. The wind starts starts to 
800                 pick up as it begins howling louder than ever. You're 
801                 determined to live but the blizzard doesn't seem to 
802                 care whether you live or die. It just keeps howling 
803                 and shrieking. It's not getting any easier to move in 
804                 this blizzard.";
805           12:
806             print_ret 
807                 "You keep walking. The snow is drifting and piling 
808                 up around you, making movement almost impossible. You 
809                 look around the barren landscape, but there's nothing 
810                 nearby except snow. It's almost as if you're lost in 
811                 a white, endless void. You start to get disoriented. 
812                 You don't even know if you're walking in a circle or 
813                 not. The situation is looking very grim. Your life 
814                 feels as if it is slowly ebbing away in the 
815                 relentless grip of the snowstorm. It feels like 
816                 you've been wandering for hours, but that's probably 
817                 just your perception of time slipping away.";
818           13:
819             print_ret 
820                 "You can barely see anything, and you stumble 
821                 forward. You could be wandering aimlessly in any 
822                 direction right now and you wouldn't know the 
823                 difference. It's as if you're in a sea of white. 
824                 You're not sure that you're going in the right 
825                 direction but you can't stop now. There has to be 
826                 something here besides endless snow. You know that 
827                 staying here is a death sentence. You have to escape. 
828                 You're cold, tired, miserable, and desperate to get 
829                 out of this mess. You have no idea where you are. You 
830                 keep wandering through endless whiteness. You won't 
831                 give up.";
832           14:
833             deadflag = 2;
834             print_ret 
835                 "You see something in the distance but can't make it 
836                 out. You walk toward it to find out that it's the 
837                 hotel. You collapse in the lobby as the hotel staff 
838                 rush over to you.";
839         }
840     }
841 ];
842
843 Object  forest "Forest"
844   with  description [;
845             print_forest_description();
846         ],
847         before [;
848           Go:
849             if (location == thedark) {
850                 DarkToDark();
851             }
852             if (noun == d_obj || noun == u_obj) {
853                 print_ret "You can't go that way.";
854             }
855             forest_location = forest_location++;
856         ],
857         cant_go print_forest_description;
858
859 [ throw_rock;
860     if (television has visited || computer has visited) {
861         print 
862             "The grue is waiting behind a snowbank in
863             the distance, away from the light. ";
864     }
865     print 
866         "From somewhere off in the dark distance, far away from the 
867         light, a rock is hurled in your direction. It hits the 
868         lantern, breaking it, and putting it out of commission. ";
869     give lantern ~on;
870     give lantern ~light;
871     lantern_fuel_left = 0;
872     StopDaemon(lantern);
873     score = score - 1;
874 ];
875
876 [ check_for_cabin_lighting;
877     if (lightbulb has on) {
878         print 
879             "The light from inside the cabin only penetrates a few 
880             feet from the building. ";
881     }
882     else
883         if (lantern in player && lantern has on) {
884             print 
885                 "The lantern provides the only source of 
886                 light. ";
887         }
888     if (location has light)
889         print 
890             "The snow stings your face and you can barely see three 
891             feet in front of you. ";
892     if (snowshoes in player && snowshoes has worn) {
893         print 
894             "The snowshoes are doing their job by making sure 
895             you don't sink into the snow. ";
896     }
897 ];
898
899 Object  eastofcabin "East Of Cabin"
900   with  description [;
901             print "It's dark outside. ";
902             check_for_cabin_lighting();
903             if (cabin_has_electricity == 1 && lantern in player && lantern_fuel_left
904             > 0) {
905                 throw_rock();
906             }
907             print "^";
908         ],
909         w_to window,
910         s_to southofcabin,
911         cant_go 
912             "The snow buildup is is too great to continue in that 
913             direction.",
914   has   light;
915
916 Object  roof "Roof"
917   with  description [;
918             print 
919                 "You're on the roof of the cabin, although it's hard 
920                 to tell where the snow buildup ends and the roof 
921                 begins. You can make out the trees around the cabin, 
922                 but you can't see very far out into the snowfield 
923                 beyond them.";
924             if (roof hasnt visited)
925                 print 
926                     " You hear a snowmobile approaching in the 
927                     distance. Is it your salvation? The snowmobile 
928                     quickly zooms by in front of the cabin and 
929                     disappears into the forest.";
930             StartDaemon(snowmobile);
931             if (roof has visited)
932                 print 
933                     " There seems to be no movement, no sound, no 
934                     sign of anything.";
935             new_line;
936         ],
937         n_to northofcabin,
938         cant_go "Walking off the edge of a roof seems unwise.";
939
940 Object  northofcabin "North Of Cabin"
941   with  description [;
942             print 
943                 "You're on the north side of the cabin. The wind is 
944                 howling and the snow is coming down; falling too fast 
945                 to see well.";
946             if (northofcabin hasnt visited)
947                 print 
948                     " That might be a tree in the distance or a 
949                     shadowy figure - It's hard to tell in this 
950                     storm.";
951             print_ret 
952                 " The snow buildup here is so great that it's 
953                 almost level with the cabin's roof, which is to the 
954                 south.";
955         ],
956         n_to westofcabin,
957         s_to roof,
958         w_to westofcabin,
959         cant_go "It's too steep to go in that direction safely.",
960         before [;
961           Go:
962             if (noun == s_obj) {
963                 if (roof hasnt visited) {
964                     score = score + 1;
965                     give roof visited;
966                 }
967             }
968         ];
969
970 Object  westofcabin "West Of Cabin"
971   with  description [;
972             print 
973                 "The snow is falling so fast that you can barely see 
974                 anything. You can't even be sure you're going in the 
975                 right direction.";
976             if (westofcabin hasnt visited)
977                 print 
978                     " Then you hear a shuffling noise in the snow. 
979                     There was something there and now it's gone. Or 
980                     was it always there and you just never saw it?";
981             print_ret " The snow buildup gets taller to the north.";
982         ],
983         s_to southofcabin,
984         n_to northofcabin,
985         cant_go 
986             "The snow buildup is is too great to continue in that 
987             direction.";
988
989 [ Initialise;
990     Location = mainroom;
991     thedark.description = 
992         "It is pitch black. You are likely to be eaten 
993         by a grue.";
994     print 
995         "You're trapped in a snowstorm while visiting the forest 
996         during your vacation to a small rural town. This is the worst 
997         snowstorm in more than 40 years. If only you had listened to 
998         the news. Well, it's too late for that. The snow has been 
999         falling for the past seven hours and shows no signs of 
1000         stopping any time soon. You need to get back to your hotel in 
1001         the town. You finally manage to find an old cabin in the 
1002         woods and get inside but have no idea where you are. You're 
1003         not dressed for this weather, and it's getting dark 
1004         outside.^";
1005     StartDaemon(lantern);
1006     StartDaemon(snowshoes);
1007     StartDaemon(snowsuit);
1008     StartDaemon(grue);
1009 ];
1010
1011 [ DeathMessage;
1012     if (deadflag == 3)
1013         print "You sink into the deep snow and are unable to move.";
1014     if (deadflag == 4)
1015         print 
1016             "Finally, you succumb to the cold. Your mind goes blank as 
1017             you slip away into the endless darkness and the deep sleep 
1018             of death.";
1019 ];
1020
1021 ! Don't have 'take all' take the lightbulb in the mainroom of the 
1022 ! cabin
1023
1024 [ ChooseObjects obj code;
1025     if (code < 2) {
1026         if (obj has scenery)
1027             return 2;
1028         rfalse;
1029     }
1030     if (obj == lightbulb)
1031         return 0;
1032 ];
1033
1034 [ InScope;
1035     if (location == thedark && real_location == mainroom) {
1036         PlaceInScope(lightsocket);
1037         PlaceInScope(lightbulb);
1038     }
1039     return false;
1040 ];
1041
1042 Object  snowmobile "snowmobile" thedark
1043   with  name 'snowmobile',
1044         daemon [;
1045             snowmobile_location = random(13);
1046             if (location == forest && forest_location == snowmobile_location)
1047             {
1048                 deadflag = 2;
1049                 print_ret 
1050                     "A snowmobile approaches. The person says they 
1051                     saw your light and came to rescue you.";
1052             }
1053             return true;
1054         ],
1055   has   scenery;
1056
1057 Object  grue "grue" thedark
1058   with  article "the",
1059         name 'grue' 'monster',
1060         grue_active_around_cabin,
1061         grue_active_in_the_dark,
1062         daemon [;
1063             if (location == thedark) {
1064                 switch (++(self.grue_active_in_the_dark)) {
1065                   1:
1066                     "^You hear horrible gurgling sounds in the 
1067                     dark.";
1068                   2:
1069                     "^You hear the clink of razor-sharp claws 
1070                     nearby.";
1071                   3:
1072                     deadflag = 1;
1073                     "^Your last memory is of the slavering fangs of 
1074                     the horrible Grue as it claims you for a meal.";
1075                 }
1076             }
1077             if (location == mainroom || location == office || location ==
1078             kitchenette || location == bedroom) {
1079                 switch (++(self.grue_active_around_cabin)) {
1080                   1:
1081                     "^You hear the wind howling outside, if it is the 
1082                     wind.";
1083                   2:
1084                     "^You hear horrible gurgling sounds outside.";
1085                   3:
1086                     "^The noise outside gets louder.";
1087                   4:
1088                     "^You hear the sound of shuffling feet outside.";
1089                   5:
1090                     "^You hear something sniffing around the cabin.";
1091                   6:
1092                     "^You hear a deep guttural sound from outside 
1093                     that sends a chill down your spine.";
1094                   7:
1095                     "^You hear something scratching on the cabin 
1096                     walls from outside.";
1097                   8:
1098                     "^You hear something howl outside. It's a 
1099                     chilling, mournful wail that sends a chill down 
1100                     your spine.";
1101                   9:
1102                     "^A thunderous CRACK can be heard coming from 
1103                     outside.";
1104                   10:
1105                     "^There's a sudden crashing sound as something is 
1106                     thrown against the cabin walls.";
1107                   11:
1108                     "^Something begins to beat against the walls of 
1109                     the cabin, as if trying to to break in. It makes a 
1110                     loud, thunderous noise.";
1111                   12:
1112                     "^The wind is howling and the walls are being 
1113                     beaten so hard it feels like the cabin is 
1114                     shaking.";
1115                   13:
1116                     "^Suddenly, there's ominous silence from outside 
1117                     the cabin.";
1118                 }
1119             }
1120             if (location == mainroom || location == office || location ==
1121             kitchenette || location == bedroom && self.grue_active_around_cabin
1122             == 15) {
1123                 print "^The lights flicker and suddenly go out.^";
1124                 cabin_has_electricity = 0;
1125                 give lightbulb ~on;
1126                 give mainroom ~light;
1127                 give office ~light;
1128                 give kitchenette ~light;
1129                 give bedroom ~light;
1130                 give eastofcabin ~light;
1131                 give southofcabin ~light;
1132             }
1133             return true;
1134         ],
1135   has   scenery;
1136
1137 [ DarkToDark;
1138     deadflag = 1;
1139     "Oh, no! You have walked into the slavering fangs of a lurking 
1140     grue!";
1141 ];
1142
1143 [ PrintRank;
1144     print ", earning you the rank of ";
1145     if (score == 0)
1146         "Novice.";
1147     if (score == 1)
1148         "Trained.";
1149     if (score == 2)
1150         "Skilled.";
1151     if (score == 3)
1152         "Talented.";
1153     if (score == 4)
1154         "Capable.";
1155     if (score == 5)
1156         "Adept.";
1157     if (score == 6)
1158         "Proficient.";
1159     if (score >= 7)
1160         print "Versed.";
1161 ];
1162
1163 [ URL;
1164     print 
1165         "^If you need help try some of the commands from: 
1166         ^https://pr-if.org/doc/play-if-card/^";
1167 ];
1168
1169 [ XyzzySub;
1170     print "Nothing obvious happens.^";
1171     return true;
1172 ];
1173
1174 [ HelpSub;
1175     URL();
1176     return true;
1177 ];
1178
1179 Include "grammar";
1180
1181 Verb 'About'
1182     * -> Version;
1183
1184 Verb 'Info'
1185     * -> Version;
1186
1187 Verb 'Help'
1188     * -> Help;
1189
1190 Verb 'Clue'
1191     * -> Help;
1192
1193 Verb 'Hint'
1194     * -> Help;
1195
1196 Verb 'xyzzy'
1197     * -> Xyzzy;
1198
1199 Verb 'crawl'
1200     * 'through' / 'out' / 'via' noun -> Go;
1201
1202 Verb 'escape'
1203     * 'through' / 'out' / 'via' noun -> Go;
1204
1205 Extend 'jump'
1206     * 'through' / 'out' / 'via' noun -> Go;
1207
1208 Extend 'climb'
1209     * 'through' / 'out' / 'via' noun -> Go;
1210
1211 Extend 'go'
1212     * 'through' / 'out' / 'via' noun -> Go;