1 ! Copyright (C) 2021 Jason Self <j@jxself.org>
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.
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.
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 Constant DEATH_MENTION_UNDO;
19 Constant Story "Snowed In";
21 "^A work of interactive fiction.
22 ^If you get stuck try typing HELP.
23 ^Ongoing development: https://jxself.org/git/?p=snowed-in.git
24 ^Send bugs and feedback by email to j@@64jxself.org.
25 ^IFID DE9FA2E5-4EC7-4166-9218-E56EFA1DF40F
26 ^Copyright (C) 2021 Jason Self <j@@64jxself.org>
27 ^You can change and share this game under the terms of the GNU
28 Affero General Public License as published by the Free Software
29 Foundation (FSF), either version 3 of the License, or (at your
30 option) any later version published by the FSF. See the GNU Affero
31 General Public License for more details.^^You should have received
32 a copy of this game's source code along with a copy of the GNU
33 Affero General Public License so that you can know your rights.
34 If not, contact the place you got it from.^^";
39 Include "src/forest.inf";
41 Object mainroom "Main Room"
43 "This room is a total wreck - it looks like a major fight
44 happened in here. There's a ripped up sofa and a broken
45 old coffee table in the middle of the room. A flat-screen
46 TV is mounted against the wall, with the screen dangling
47 out. This cabin has three other rooms. There's an office
48 area to the east, and a bedroom to the north. A
49 kitchenette can be found to the west. There's a doorway
50 in the south wall leading outside.",
57 Object frontdoor "front door" mainroom
58 with name 'door' 'front',
60 "The wooden door is made of thick oak wood with the shape
61 of a bear claw engraved in it.",
63 if (location == mainroom)
64 print "door to the outside";
66 print "door to the cabin";
69 found_in mainroom southofcabin,
71 if (location == mainroom)
77 if (location == mainroom)
82 has scenery door openable;
84 Object bearclaw "bear claw" mainroom
85 with name 'bear' 'claw',
87 "It's in the shape of a thin, sharp claw with three jagged
88 points at the top of it.",
91 Object sofa "sofa" mainroom
92 with name 'sofa' 'couch',
94 "The sofa is in poor shape. The upholstery is ripped and
95 there are several holes in it.",
97 Take, Pull, Push, PushDir, Turn:
98 print_ret (The) self, " is too heavy for that.";
100 has scenery supporter enterable;
102 Object coffeetable "coffee table" mainroom
103 with name 'coffee' 'table',
105 "The old coffee table looks as if it's had quite a bit of
106 use. There are burn marks covering it and the paint is
107 worn off in most places.",
109 Take, Pull, Push, PushDir, Turn:
110 print_ret (The) self, " is too heavy for that.";
112 has scenery supporter enterable;
114 Object lantern "copper lantern" coffeetable
115 with name 'lantern' 'copper' 'lamp',
117 "This is an exceptionally beautiful lantern. About eleven
118 inches high, with a base of about 5 inches or so in
119 diameter and a large, brass-closed hook at the top. A
120 rainbow of unique colors run through the copper. The
121 glass in the lamp has a fresnel type of design, which is
122 used to distribute light widely.",
125 if (lantern has on) {
126 lantern_fuel_left = 0;
131 "Suddenly, the lantern's flame begins to flicker
132 violently within its glass prison and then
133 extinguishes itself.";
138 if (lantern_fuel_left > 0) {
140 StartTimer(lantern, lantern_fuel_left);
144 "You snap the switch a few times, but nothing
153 lantern_fuel_left = lantern.time_left;
154 if (lantern has on && lantern_fuel_left <= 5)
155 print_ret "The lantern's fuel runs low.";
159 Object television "flat-screen TV" mainroom
160 with name 'TV' 'television' 'flat' 'screen' 'flat-screen',
162 "The flat-screen TV looks fairly modern but it's been
163 broken in a fight and the screen is dangling out.",
165 Take, Pull, Push, PushDir, Turn:
166 print_ret (The) self, " is firmly mounted to the wall.";
168 if (television hasnt visited) {
170 "Despite the significant damage, the television
171 comes to life in one last valiant attempt to be
172 useful. Your favorite news program is on: U.S.
173 News And Grue Report. The news anchor is giving a
174 warning of Grue sightings in the area of the
175 forest before the television finally dies.^";
176 give television visited;
180 "The flat-screen TV is broken and can't be
185 has scenery switchable;
187 Object lightsocket "light socket" mainroom
188 with name 'socket' 'lightsocket',
190 Take, Pull, Push, PushDir, Turn:
192 "You don't have the tools to remove a light
195 if (noun ~= lightbulb) {
199 " into the light socket? Maybe you should come
200 with a warning label because you contain more than
201 a trace amount of nut.";
203 if (noun == lightbulb && light has on) {
206 give kitchenette light;
208 give eastofcabin light;
209 give southofcabin light;
212 has scenery container transparent open;
214 Object lightbulb "light bulb" lightsocket
215 with name 'light' 'bulb' 'lightbulb',
218 if (lightbulb in lightsocket) {
219 if (cabin_has_electricity == 1) {
222 give kitchenette light;
224 give eastofcabin light;
225 give southofcabin light;
229 "You flip the switch a few times, but nothing
235 "Turn on a lightbulb when it's not in the
236 socket? What a strange idea.";
240 Take, Pull, Push, PushDir, Turn, SwitchOff:
242 give mainroom ~light;
244 give kitchenette ~light;
246 give eastofcabin ~light;
247 give southofcabin ~light;
251 Object office "Office"
253 "There seems to have been quite a fight in here. The room
254 is a wreck. Holes are in the walls and the windows are
255 broken, letting in the cold air from outside. Chunks of
256 drywall and insulation cover the floor. The desk has a
257 bullet hole through the middle.",
262 Object desk "solid oak desk" office
263 with name 'solid' 'oak' 'desk',
265 "The desk is old and made of solid oak. The right side of
266 it has been smashed and all of the drawers have been
267 removed. A bullet hole goes straight through the middle of
270 Take, Pull, Push, PushDir, Turn:
271 print_ret (The) self, " is too heavy for that.";
273 has scenery supporter enterable;
275 Object businesscard "business card" desk
276 with name 'business' 'card',
278 "The business card is white and has blacked edges. It
279 bears the name ~Lasting Solutions~, a local data recovery
280 company, in bold letters on the top. The company's
281 website URL is printed in blue at the bottom.";
283 Object salesreceipt "sales receipt" desk
284 with name 'sales' 'receipt',
286 "The sales receipt is for $200, dated three years ago.
287 It's printed on old tractor feed printer paper and bears
288 the name ~Lasting Solutions~, a local data recovery
289 company. A handwritten note is scrawled on the bottom:
290 ~Start working on these hard drives soon.~";
292 Object computer "computer" desk
293 with name 'computer' 'PC',
295 "It's a heavy older model that appears to have been
296 seriously damaged in a fight. It's clearly on its last
297 legs but is perhaps still useful.",
299 Take, Pull, Push, PushDir, Turn:
300 print_ret (The) self, " is too heavy for that.";
302 if (computer hasnt visited) {
304 "The computer makes some concerning noises while
305 lights on the front also illuminate. The last
306 file is quickly displayed. ~If anyone else reads
307 this, you're in serious danger. I've been fighting
308 a ferocious grue for the last three days. I'm
309 almost out of supplies and can't last much
310 longer. I'm going to take the last of the supplies
311 and escape through the office window in a
312 last-ditch effort to get away and get back into
313 town. I hope I can make it.~ The computer then
314 makes a sickly sound and finally dies as some
315 smoke comes out of it.^";
316 give computer visited;
320 "The display briefly flickers but nothing
327 Object drywall "drywall" office
328 with name 'drywall' 'dry' 'wall',
330 Take, Pull, Push, PushDir, Turn:
331 print_ret "Taking that would achieve little.";
335 Object insulation "insulation" office
336 with name 'insulation',
338 Take, Pull, Push, PushDir, Turn:
339 print_ret "Taking that would achieve little.";
343 Object bullethole "bullet hole" desk
344 with name 'bullet' 'hole' 'holes',
346 "Looks to have come from something that's capable of
347 doing a lot of damage.",
348 found_in desk bedroom,
351 Object window "window" office
352 with name 'window' 'windows',
354 "The window faces the east side of the cabin. It's broken,
355 letting in the cold air from outside.",
357 if (location == office)
360 print "window into the cabin";
363 found_in office eastofcabin,
365 if (location == office)
371 if (location == office)
378 print_ret "The window faces the east side of the cabin.";
381 "The window's broken so it's not clear how
384 has scenery door openable open;
386 Object kitchenette "Kitchenette"
388 "The kitchenette is empty. A sink, you think, though it's
389 hard to tell what's a pipe and what's a faucet. A
390 refrigerator, standing open and empty. The door has been
391 ripped off. There's no indication as to where it
392 went. There's no food anywhere in here.",
396 Object refrigerator "refrigerator" kitchenette
397 with name 'fridge' 'refrigerator',
399 "An old rusty refrigerator, standing open and empty. The
400 door has been ripped off. There's no indication as to
403 Take, Pull, Push, PushDir, Turn:
404 print_ret (The) self, " is too heavy for that.";
406 print_ret (The) self, " door is missing.";
408 has scenery enterable container openable open;
410 Object sink "sink" kitchenette
411 with name 'sink' 'pipe' 'faucet',
413 "A sink, you think, though it's hard to tell what's a
414 pipe and what's a faucet.",
418 "Pipes from in the walls make a groaning sound,
419 almost like pain and despair. No water comes out.";
421 has scenery container switchable;
423 Object bedroom "Bedroom"
425 "This bedroom is small and cramped, and looks like a
426 major fight happened as the exterior wall has bullet
427 holes. The bed is lying on the floor, torn to shreds. It
428 has no sheets, just a bare mattress.",
432 Object bed "bed" bedroom
433 with name 'bed' 'mattress',
434 with description "The mattress is bare and empty.",
436 Take, Pull, Push, PushDir, Turn:
437 print_ret (The) self, " is too heavy for that.";
439 has scenery supporter;
441 Object suitcase "suitcase" bedroom
442 with name 'suitcase',
444 "The suitcase is made of a light metallic material that
445 you can't quite make out. The color of it is somewhere
446 between silver and grey.",
447 has container open openable;
449 Object snowsuit "snowsuit" suitcase
450 with name 'snowsuit' 'snow' 'suit',
452 "The snowsuit is blue, decorated with white and purple
453 designs. On the chest is a large emblem with the letters
457 if (snowshoes in player && snowshoes has worn) {
458 print_ret "The snowsuit can't fit over the snowshoes.";
461 if (snowshoes in player && snowshoes has worn) {
462 print_ret "The snowsuit can't be taken off over the snowshoes.";
466 if (location ~= mainroom && location ~= office && location ~=
467 kitchenette && location ~= bedroom && location ~= thedark &&
468 snowsuit hasnt worn) {
469 body_temperature = --body_temperature;
471 if (location == mainroom || location == office || location ==
472 kitchenette || location == bedroom || snowsuit has worn && body_temperature
474 body_temperature = ++body_temperature;
476 if (body_temperature == 0) {
479 if (body_temperature <= 5)
481 "You're shivering uncontrollably, and it's hard
482 to move. You feel very exhausted and drowsy. It's
483 all you can do to keep from falling over.";
484 if (body_temperature > 5 && location ~= mainroom && location
485 ~= office && location ~= kitchenette && location ~= bedroom
486 && location ~= thedark && snowsuit hasnt worn) {
487 switch (body_temperature) {
489 "The feeling of cold overwhelms you. Surely the cold will get to
490 you before anything else does. Right?";
492 "You can feel yourself getting colder and colder.";
494 "You can see your own breath freezing in the air, forming little
497 "You shiver in the cold.";
499 "You continue to shiver in the cold.";
501 "Your hands grow numb from the cold.";
503 "You continue shivering in order to keep warm.";
505 "Your shivering grows worse as your body becomes colder by the
508 "Your teeth begin to chatter as you desperately try to warm
511 "Your shivering intensifies as your body begins to freeze over
514 "Your fingers become stiff and you feel sharp pains all over your
517 "The cold has gotten to a point where it is too much for you. You
518 begin to shiver uncontrollably.";
520 "Your eyesight begins to fade and you can't even feel yourself
523 "You can feel your body shutting down from the cold as you slowly
524 begin to lose consciousness.";
530 Object snowshoes "snowshoes" bedroom
531 with name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes'
534 "They're light blue in color and have a thick, hard
535 rubber bottom that's attached to a metal frame that keeps
536 you from sinking into the snow. They look to be warm and
540 print_ret (The) self,
541 " fit perfectly and go up to your
545 if (location ~= mainroom && location ~= office && location ~=
546 kitchenette && location ~= bedroom && location ~= thedark &&
547 snowshoes hasnt worn) {
551 has pluralname clothing;
553 Forest southofcabin "South Of Cabin"
555 print "The wind is howling, and there's snow flying everywhere.";
556 if (snowsuit hasnt worn)
558 " It's really cold and
559 you're not dressed for this weather.";
560 if (frontdoor has open) {
561 check_for_cabin_lighting();
569 [ check_for_cabin_lighting;
570 if (lightbulb has on) {
572 "The light from inside the cabin only penetrates
573 a few feet from the building. ";
576 if (lantern in player && lantern has on) {
578 "The lantern provides the only source of
581 if (location has light)
583 "The snow stings your face and you can barely see three feet in
585 if (snowshoes in player && snowshoes has worn) {
587 "The snowshoes are doing their job by making sure
588 you don't sink into the snow.^";
592 Forest eastofcabin "East Of Cabin"
594 print "It's dark outside. ";
595 check_for_cabin_lighting();
601 Forest westofcabin "Westh Of Cabin"
603 "The snow is falling so fast that you can barely see
604 anything. You can't even be sure you're going in the right
611 thedark.description =
612 "It is pitch black. You are likely to be eaten
615 "You're trapped in a snowstorm while visiting the forest
616 during your vacation to a small rural town. This is the worst
617 snowstorm in more than 40 years. If only you has listened to
618 the news. Well, it's too late for that. The snow has been
619 falling for the past seven hours and shows no signs of
620 stopping anytime soon. You need to get back to your hotel in
621 the town. You finally manage to find an old cabin in the
622 woods and get inside but have no idea where you are. You're
623 not dressed for this weather.^";
624 StartDaemon(lantern);
625 StartDaemon(snowshoes);
626 StartDaemon(snowsuit);
632 print "You sink into the deep snow and are unable to move.";
635 "Finally, you succumb to the cold. Your mind goes blank as
636 you slip away into the endless darkness and the deep sleep
640 ! Don't have 'take all' take the lightbulb in the mainroom of the
643 [ ChooseObjects obj code;
649 if (obj == lightbulb)
654 if (location == thedark && real_location == mainroom) {
655 PlaceInScope(lightsocket);
656 PlaceInScope(lightbulb);
661 Object grue "grue" thedark
663 name 'grue' 'monster',
664 grue_active_around_cabin,
665 grue_active_in_the_dark,
667 if (location == thedark) {
668 switch (++(self.grue_active_in_the_dark)) {
670 "^You hear horrible gurgling sounds in the dark.";
672 "^You hear the clink of razor-sharp claws nearby.";
675 "^Your last memory is of the slavering fangs of the
676 horrible Grue as it claims you for a meal.";
679 if (location == mainroom || location == office || location ==
680 kitchenette || location == bedroom) {
681 switch (++(self.grue_active_around_cabin)) {
683 "^You hear the wind howling outside, if it is the wind.";
685 "^You hear horrible gurgling sounds outside.";
687 "^The noise outside gets louder.";
689 "^You hear the sound of shuffling feet outside.";
691 "^You hear something sniffing around the cabin.";
693 "^You hear a deep guttural sound from outside that sends a chill down your spine.";
695 "^You hear something scratching on the cabin walls from outside.";
697 "^You hear something howl outside. It's a chilling, mournful wail that sends a chill down your spine.";
699 "^A thunderous CRACK can be heard coming from outside.";
701 "^There's a sudden crashing sound as something is thrown against the cabin walls.";
703 "^Something begins to beat against the walls of the cabin, as if trying to to break in. It makes a loud, thunderous noise.";
705 "^The wind is howling and the walls are being beaten so hard it feels like the cabin is shaking.";
707 "^Suddenly, there's ominous silence from outside the cabin.";
710 if (location == mainroom || location == office || location ==
711 kitchenette || location == bedroom && self.grue_active_around_cabin
713 print "^The lights flicker and suddenly go out.";
714 cabin_has_electricity = 0;
716 give mainroom ~light;
718 give kitchenette ~light;
720 give eastofcabin ~light;
721 give southofcabin ~light;
729 "Oh, no! You have walked into the slavering fangs of a lurking
735 "^If you need help try some of the commands from:
736 ^http://pr-if.org/doc/play-if-card/^";
740 print "Nothing obvious happens.^";
770 * 'through' / 'out' / 'via' noun -> Go;
773 * 'through' / 'out' / 'via' noun -> Go;
776 * 'through' / 'out' / 'via' noun -> Go;
779 * 'through' / 'out' / 'via' noun -> Go;
782 * 'through' / 'out' / 'via' noun -> Go;