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;
211 has scenery container transparent open;
213 Object lightbulb "light bulb" lightsocket
214 with name 'light' 'bulb' 'lightbulb',
217 if (lightbulb in lightsocket) {
218 if (cabin_has_electricity == 1) {
221 give kitchenette light;
223 give eastofcabin light;
227 "You flip the switch a few times, but nothing
233 "Turn on a lightbulb when it's not in the
234 socket? What a strange idea.";
238 Take, Pull, Push, PushDir, Turn, SwitchOff:
240 give mainroom ~light;
242 give kitchenette ~light;
244 give eastofcabin ~light;
248 Object office "Office"
250 "There seems to have been quite a fight in here. The room
251 is a wreck. Holes are in the walls and the windows are
252 broken, letting in the cold air from outside. Chunks of
253 drywall and insulation cover the floor. The desk has a
254 bullet hole through the middle.",
259 Object desk "solid oak desk" office
260 with name 'solid' 'oak' 'desk',
262 "The desk is old and made of solid oak. The right side of
263 it has been smashed and all of the drawers have been
264 removed. A bullet hole goes straight through the middle of
267 Take, Pull, Push, PushDir, Turn:
268 print_ret (The) self, " is too heavy for that.";
270 has scenery supporter enterable;
272 Object businesscard "business card" desk
273 with name 'business' 'card',
275 "The business card is white and has blacked edges. It
276 bears the name ~Lasting Solutions~, a local data recovery
277 company, in bold letters on the top. The company's
278 website URL is printed in blue at the bottom.";
280 Object salesreceipt "sales receipt" desk
281 with name 'sales' 'receipt',
283 "The sales receipt is for $200, dated three years ago.
284 It's printed on old tractor feed printer paper and bears
285 the name ~Lasting Solutions~, a local data recovery
286 company. A handwritten note is scrawled on the bottom:
287 ~Start working on these hard drives soon.~";
289 Object computer "computer" desk
290 with name 'computer' 'PC',
292 "It's a heavy older model that appears to have been
293 seriously damaged in a fight. It's clearly on its last
294 legs but is perhaps still useful.",
296 Take, Pull, Push, PushDir, Turn:
297 print_ret (The) self, " is too heavy for that.";
299 if (computer hasnt visited) {
301 "The computer makes some concerning noises while
302 lights on the front also illuminate. The last
303 file is quickly displayed. ~If anyone else reads
304 this, you're in serious danger. I've been fighting
305 a ferocious grue for the last three days. I'm
306 almost out of supplies and can't last much
307 longer. I'm going to take the last of the supplies
308 and escape through the office window in a
309 last-ditch effort to get away and get back into
310 town. I hope I can make it.~ The computer then
311 makes a sickly sound and finally dies as some
312 smoke comes out of it.^";
313 give computer visited;
317 "The display briefly flickers but nothing
324 Object drywall "drywall" office
325 with name 'drywall' 'dry' 'wall',
327 Take, Pull, Push, PushDir, Turn:
328 print_ret "Taking that would achieve little.";
332 Object insulation "insulation" office
333 with name 'insulation',
335 Take, Pull, Push, PushDir, Turn:
336 print_ret "Taking that would achieve little.";
340 Object bullethole "bullet hole" desk
341 with name 'bullet' 'hole' 'holes',
343 "Looks to have come from something that's capable of
344 doing a lot of damage.",
345 found_in desk bedroom,
348 Object window "window" office
349 with name 'window' 'windows',
351 "The window faces the east side of the cabin. It's broken,
352 letting in the cold air from outside.",
354 if (location == office)
357 print "window into the cabin";
360 found_in office eastofcabin,
362 if (location == office)
368 if (location == office)
375 print_ret "The window faces the east side of the cabin.";
378 "The window's broken so it's not clear how
381 has scenery door openable open;
383 Object kitchenette "Kitchenette"
385 "The kitchenette is empty. A sink, you think, though it's
386 hard to tell what's a pipe and what's a faucet. A
387 refrigerator, standing open and empty. The door has been
388 ripped off. There's no indication as to where it
389 went. There's no food anywhere in here.",
393 Object refrigerator "refrigerator" kitchenette
394 with name 'fridge' 'refrigerator',
396 "An old rusty refrigerator, standing open and empty. The
397 door has been ripped off. There's no indication as to
400 Take, Pull, Push, PushDir, Turn:
401 print_ret (The) self, " is too heavy for that.";
403 print_ret (The) self, " door is missing.";
405 has scenery enterable container openable open;
407 Object sink "sink" kitchenette
408 with name 'sink' 'pipe' 'faucet',
410 "A sink, you think, though it's hard to tell what's a
411 pipe and what's a faucet.",
415 "Pipes from in the walls make a groaning sound,
416 almost like pain and despair. No water comes out.";
418 has scenery container switchable;
420 Object bedroom "Bedroom"
422 "This bedroom is small and cramped, and looks like a
423 major fight happened as the exterior wall has bullet
424 holes. The bed is lying on the floor, torn to shreds. It
425 has no sheets, just a bare mattress.",
429 Object bed "bed" bedroom
430 with name 'bed' 'mattress',
431 with description "The mattress is bare and empty.",
433 Take, Pull, Push, PushDir, Turn:
434 print_ret (The) self, " is too heavy for that.";
436 has scenery supporter;
438 Object suitcase "suitcase" bedroom
439 with name 'suitcase',
441 "The suitcase is made of a light metallic material that
442 you can't quite make out. The color of it is somewhere
443 between silver and grey.",
444 has container open openable;
446 Object snowsuit "snowsuit" suitcase
447 with name 'snowsuit' 'snow' 'suit',
449 "The snowsuit is blue, decorated with white and purple
450 designs. On the chest is a large emblem with the letters
454 if (snowshoes in player && snowshoes has worn) {
455 print_ret "The snowsuit can't fit over the snowshoes.";
458 if (snowshoes in player && snowshoes has worn) {
459 print_ret "The snowsuit can't be taken off over the snowshoes.";
463 if (location ~= mainroom && location ~= office && location ~=
464 kitchenette && location ~= bedroom && location ~= thedark &&
465 snowsuit hasnt worn) {
466 body_temperature = --body_temperature;
468 if (location == mainroom || location == office || location ==
469 kitchenette || location == bedroom || snowsuit has worn
470 && body_temperature < 20) {
471 body_temperature = ++body_temperature;
473 if (body_temperature == 0) {
476 if (body_temperature <= 5)
478 "You're shivering uncontrollably, and it's hard
479 to move. You feel very exhausted and drowsy. It's
480 all you can do to keep from falling over.";
481 if (body_temperature > 5 && location ~= mainroom && location
482 ~= office && location ~= kitchenette && location ~= bedroom
483 && location ~= thedark && snowsuit hasnt worn) {
484 switch (body_temperature) {
486 "The feeling of cold overwhelms you. Surely the cold will get to
487 you before anything else does. Right?";
489 "You can feel yourself getting colder and colder.";
491 "You can see your own breath freezing in the air, forming little
494 "You shiver in the cold.";
496 "You continue to shiver in the cold.";
498 "Your hands grow numb from the cold.";
500 "You continue shivering in order to keep warm.";
502 "Your shivering grows worse as your body becomes colder by the
505 "Your teeth begin to chatter as you desperately try to warm
508 "Your shivering intensifies as your body begins to freeze over
511 "Your fingers become stiff and you feel sharp pains all over your
514 "The cold has gotten to a point where it is too much for you. You
515 begin to shiver uncontrollably.";
517 "Your eyesight begins to fade and you can't even feel yourself
520 "You can feel your body shutting down from the cold as you slowly
521 begin to lose consciousness.";
527 Object snowshoes "snowshoes" bedroom
528 with name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes'
531 "They're light blue in color and have a thick, hard
532 rubber bottom that's attached to a metal frame that keeps
533 you from sinking into the snow. They look to be warm and
537 print_ret (The) self,
538 " fit perfectly and go up to your
542 if (location ~= mainroom && location ~= office && location ~=
543 kitchenette && location ~= bedroom && location ~= thedark &&
544 snowshoes hasnt worn) {
548 has pluralname clothing;
550 Forest southofcabin "South Of Cabin"
552 print "The wind is howling, and there's snow flying everywhere.";
553 if (snowsuit hasnt worn)
555 " It's really cold and
556 you're not dressed for this weather.";
558 " The snow stings your face and you
559 can barely see three feet in front of you.^";
566 Forest eastofcabin "East Of Cabin"
568 print "It's dark outside. ";
569 if (lightbulb has on) {
571 "The light from inside the cabin only penetrates
572 a few feet from the building. ";
575 if (lantern in player && lantern has on) {
577 "The lantern provides the only source of
580 if (snowshoes in player && snowshoes has worn) {
582 "The snowshoes are doing their job by making sure
583 you don't sink into the snow.^";
590 Forest westofcabin "Westh Of Cabin"
592 "The snow is falling so fast that you can barely see
593 anything. You can't even be sure you're going in the right
600 thedark.description =
601 "It is pitch black. You are likely to be eaten
604 "You're trapped in a snowstorm while visiting the forest
605 during your vacation to a small rural town. This is the worst
606 snowstorm in more than 40 years. If only you has listened to
607 the news. Well, it's too late for that. The snow has been
608 falling for the past seven hours and shows no signs of
609 stopping anytime soon. You need to get back to your hotel in
610 the town. You finally manage to find an old cabin in the
611 woods and get inside but have no idea where you are. You're
612 not dressed for this weather.^";
613 StartDaemon(lantern);
614 StartDaemon(snowshoes);
615 StartDaemon(snowsuit);
621 print "You sink into the deep snow and are unable to move.";
624 "Finally, you succumb to the cold. Your mind goes blank as
625 you slip away into the endless darkness and the deep sleep
629 ! Don't have 'take all' take the lightbulb in the mainroom of the
632 [ ChooseObjects obj code;
638 if (obj == lightbulb)
643 if (location == thedark && real_location == mainroom) {
644 PlaceInScope(lightsocket);
645 PlaceInScope(lightbulb);
650 Object grue "grue" thedark
652 name 'grue' 'monster',
653 grue_active_around_cabin,
654 grue_active_in_the_dark,
656 if (location == thedark) {
657 switch (++(self.grue_active_in_the_dark)) {
659 "^You hear horrible gurgling sounds in the dark.";
661 "^You hear the clink of razor-sharp claws nearby.";
664 "^Your last memory is of the slavering fangs of the
665 horrible Grue as it claims you for a meal.";
668 if (location == mainroom || location == office || location ==
669 kitchenette || location == bedroom) {
670 switch (++(self.grue_active_around_cabin)) {
672 "^You hear the wind howling outside, if it is the wind.";
674 "^You hear horrible gurgling sounds outside.";
676 "^The noise outside gets louder.";
678 "^You hear the sound of shuffling feet outside.";
680 "^You hear something sniffing around the cabin.";
682 "^You hear a deep guttural sound from outside that sends a chill down your spine.";
684 "^You hear something scratching on the cabin walls from outside.";
686 "^You hear something howl outside. It's a chilling, mournful wail that sends a chill down your spine.";
688 "^A thunderous CRACK can be heard coming from outside.";
690 "^There's a sudden crashing sound as something is thrown against the cabin walls.";
692 "^Something begins to beat against the walls of the cabin, as if trying to to break in. It makes a loud, thunderous noise.";
694 "^The wind is howling and the walls are being beaten so hard it feels like the cabin is shaking.";
696 "^Suddenly, there's ominous silence from outside the cabin.";
699 if (location == mainroom || location == office || location ==
700 kitchenette || location == bedroom && self.grue_active_around_cabin
702 print "^The lights flicker and suddenly go out.";
703 cabin_has_electricity = 0;
705 give mainroom ~light;
707 give kitchenette ~light;
709 give eastofcabin ~light;
717 "Oh, no! You have walked into the slavering fangs of a lurking
723 "^If you need help try some of the commands from:
724 ^http://pr-if.org/doc/play-if-card/^";
728 print "Nothing obvious happens.^";
758 * 'through' / 'out' / 'via' noun -> Go;
761 * 'through' / 'out' / 'via' noun -> Go;
764 * 'through' / 'out' / 'via' noun -> Go;
767 * 'through' / 'out' / 'via' noun -> Go;
770 * 'through' / 'out' / 'via' noun -> Go;