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.^^";
40 Include "src/forest.inf";
42 Object mainroom "Main Room"
44 "This room is a total wreck - it looks like a major fight
45 happened in here. There's a ripped up sofa and a broken
46 old coffee table in the middle of the room. A flat-screen
47 TV is mounted against the wall, with the screen dangling
48 out. This cabin has three other rooms. There's an office
49 area to the east, and a bedroom to the north. A
50 kitchenette can be found to the west. There's a doorway
51 in the south wall leading outside.",
58 Object frontdoor "front door" mainroom
59 with name 'door' 'front',
61 "The wooden door is made of thick oak wood with the shape
62 of a bear claw engraved in it.",
64 if (location == mainroom)
65 print "door to the outside";
67 print "door to the cabin";
70 found_in mainroom southofcabin,
72 if (location == mainroom)
78 if (location == mainroom)
83 has scenery door openable;
85 Object bearclaw "bear claw" mainroom
86 with name 'bear' 'claw',
88 "It's in the shape of a thin, sharp claw with three jagged
89 points at the top of it.",
92 Object sofa "sofa" mainroom
93 with name 'sofa' 'couch',
95 "The sofa is in poor shape. The upholstery is ripped and
96 there are several holes in it.",
98 Take, Pull, Push, PushDir, Turn:
99 print_ret (The) self, " is too heavy for that.";
101 has scenery supporter enterable;
103 Object coffeetable "coffee table" mainroom
104 with name 'coffee' 'table',
106 "The old coffee table looks as if it's had quite a bit of
107 use. There are burn marks covering it and the paint is
108 worn off in most places.",
110 Take, Pull, Push, PushDir, Turn:
111 print_ret (The) self, " is too heavy for that.";
113 has scenery supporter enterable;
115 Object lantern "copper lantern" coffeetable
116 with name 'lantern' 'copper' 'lamp',
118 "This is an exceptionally beautiful lantern. About eleven
119 inches high, with a base of about 5 inches or so in
120 diameter and a large, brass-closed hook at the top. A
121 rainbow of unique colors run through the copper. The
122 glass in the lamp has a fresnel type of design, which is
123 used to distribute light widely.",
126 if (lantern has on) {
127 lantern_fuel_left = 0;
132 "Suddenly, the lantern's flame begins to flicker
133 violently within its glass prison and then
134 extinguishes itself.";
139 if (lantern_fuel_left > 0) {
141 StartTimer(lantern, lantern_fuel_left);
145 "You snap the switch a few times, but nothing
154 lantern_fuel_left = lantern.time_left;
155 if (lantern has on && lantern_fuel_left <= 5)
156 print_ret "The lantern's fuel runs low.";
160 Object television "flat-screen TV" mainroom
161 with name 'TV' 'television' 'flat' 'screen' 'flat-screen',
163 "The flat-screen TV looks fairly modern but it's been
164 broken in a fight and the screen is dangling out.",
166 Take, Pull, Push, PushDir, Turn:
167 print_ret (The) self, " is firmly mounted to the wall.";
169 if (television hasnt visited) {
171 "Despite the significant damage, the television
172 comes to life in one last valiant attempt to be
173 useful. Your favorite news program is on: U.S.
174 News And Grue Report. The news anchor is giving a
175 warning of Grue sightings in the area of the
176 forest before the television finally dies.^";
177 give television visited;
181 "The flat-screen TV is broken and can't be
186 has scenery switchable;
188 Object lightsocket "light socket" mainroom
189 with name 'socket' 'lightsocket',
191 Take, Pull, Push, PushDir, Turn:
193 "You don't have the tools to remove a light
196 if (noun ~= lightbulb) {
200 " into the light socket? Maybe you should come
201 with a warning label because you contain more than
202 a trace amount of nut.";
204 if (noun == lightbulb && light has on) {
207 give kitchenette light;
209 give eastofcabin 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;
228 "You flip the switch a few times, but nothing
234 "Turn on a lightbulb when it's not in the
235 socket? What a strange idea.";
239 Take, Pull, Push, PushDir, Turn, SwitchOff:
241 give mainroom ~light;
243 give kitchenette ~light;
245 give eastofcabin ~light;
249 Object office "Office"
251 "There seems to have been quite a fight in here. The room
252 is a wreck. Holes are in the walls and the windows are
253 broken, letting in the cold air from outside. Chunks of
254 drywall and insulation cover the floor. The desk has a
255 bullet hole through the middle.",
260 Object desk "solid oak desk" office
261 with name 'solid' 'oak' 'desk',
263 "The desk is old and made of solid oak. The right side of
264 it has been smashed and all of the drawers have been
265 removed. A bullet hole goes straight through the middle of
268 Take, Pull, Push, PushDir, Turn:
269 print_ret (The) self, " is too heavy for that.";
271 has scenery supporter enterable;
273 Object businesscard "business card" desk
274 with name 'business' 'card',
276 "The business card is white and has blacked edges. It
277 bears the name ~Lasting Solutions~, a local data recovery
278 company, in bold letters on the top. The company's
279 website URL is printed in blue at the bottom.";
281 Object salesreceipt "sales receipt" desk
282 with name 'sales' 'receipt',
284 "The sales receipt is for $200, dated three years ago.
285 It's printed on old tractor feed printer paper and bears
286 the name ~Lasting Solutions~, a local data recovery
287 company. A handwritten note is scrawled on the bottom:
288 ~Start working on these hard drives soon.~";
290 Object computer "computer" desk
291 with name 'computer' 'PC',
293 "It's a heavy older model that appears to have been
294 seriously damaged in a fight. It's clearly on its last
295 legs but is perhaps still useful.",
297 Take, Pull, Push, PushDir, Turn:
298 print_ret (The) self, " is too heavy for that.";
300 if (computer hasnt visited) {
302 "The computer makes some concerning noises while
303 lights on the front also illuminate. The last
304 file is quickly displayed. ~If anyone else reads
305 this, you're in serious danger. I've been fighting
306 a ferocious grue for the last three days. I'm
307 almost out of supplies and can't last much
308 longer. I'm going to take the last of the supplies
309 and escape through the office window in a
310 last-ditch effort to get away and get back into
311 town. I hope I can make it.~ The computer then
312 makes a sickly sound and finally dies as some
313 smoke comes out of it.^";
314 give computer visited;
318 "The display briefly flickers but nothing
325 Object drywall "drywall" office
326 with name 'drywall' 'dry' 'wall',
328 Take, Pull, Push, PushDir, Turn:
329 print_ret "Taking that would achieve little.";
333 Object insulation "insulation" office
334 with name 'insulation',
336 Take, Pull, Push, PushDir, Turn:
337 print_ret "Taking that would achieve little.";
341 Object bullethole "bullet hole" desk
342 with name 'bullet' 'hole' 'holes',
344 "Looks to have come from something that's capable of
345 doing a lot of damage.",
346 found_in desk bedroom,
349 Object window "window" office
350 with name 'window' 'windows',
352 "The window faces the east side of the cabin. It's broken,
353 letting in the cold air from outside.",
355 if (location == office)
358 print "window into the cabin";
361 found_in office eastofcabin,
363 if (location == office)
369 if (location == office)
376 print_ret "The window faces the east side of the cabin.";
379 "The window's broken so it's not clear how
382 has scenery door openable open;
384 Object kitchenette "Kitchenette"
386 "The kitchenette is empty. A sink, you think, though it's
387 hard to tell what's a pipe and what's a faucet. A
388 refrigerator, standing open and empty. The door has been
389 ripped off. There's no indication as to where it
390 went. There's no food anywhere in here.",
394 Object refrigerator "refrigerator" kitchenette
395 with name 'fridge' 'refrigerator',
397 "An old rusty refrigerator, standing open and empty. The
398 door has been ripped off. There's no indication as to
401 Take, Pull, Push, PushDir, Turn:
402 print_ret (The) self, " is too heavy for that.";
404 print_ret (The) self, " door is missing.";
406 has scenery enterable container openable open;
408 Object sink "sink" kitchenette
409 with name 'sink' 'pipe' 'faucet',
411 "A sink, you think, though it's hard to tell what's a
412 pipe and what's a faucet.",
416 "Pipes from in the walls make a groaning sound,
417 almost like pain and despair. No water comes out.";
419 has scenery container switchable;
421 Object bedroom "Bedroom"
423 "This bedroom is small and cramped, and looks like a
424 major fight happened as the exterior wall has bullet
425 holes. The bed is lying on the floor, torn to shreds. It
426 has no sheets, just a bare mattress.",
430 Object bed "bed" bedroom
431 with name 'bed' 'mattress',
432 with description "The mattress is bare and empty.",
434 Take, Pull, Push, PushDir, Turn:
435 print_ret (The) self, " is too heavy for that.";
437 has scenery supporter;
439 Object suitcase "suitcase" bedroom
440 with name 'suitcase',
442 "The suitcase is made of a light metallic material that
443 you can't quite make out. The color of it is somewhere
444 between silver and grey.",
445 has container open openable;
447 Object snowsuit "snowsuit" suitcase
448 with name 'snowsuit' 'snow' 'suit',
450 "The snowsuit is blue, decorated with white and purple
451 designs. On the chest is a large emblem with the letters
455 if (snowshoes in player && snowshoes has worn) {
456 print_ret "The snowsuit can't fit over the snowshoes.";
459 if (snowshoes in player && snowshoes has worn) {
460 print_ret "The snowsuit can't be taken off over the snowshoes.";
464 if (location ~= mainroom && location ~= office && location ~=
465 kitchenette && location ~= bedroom && location ~= thedark &&
466 snowsuit hasnt worn) {
467 body_temperature = --body_temperature;
469 if (location == mainroom || location == office || location ==
470 kitchenette || location == bedroom || location ~= thedark ||
471 snowsuit has worn && body_temperature < 20) {
472 body_temperature = ++body_temperature;
474 if (body_temperature == 0) {
477 if (body_temperature <= 5)
479 "You're shivering uncontrollably, and it's hard
480 to move. You feel very exhausted and drowsy. It's
481 all you can do to keep from falling over.";
482 if (body_temperature > 5 && location ~= mainroom && location
483 ~= office && location ~= kitchenette && location ~= bedroom
484 && location ~= thedark && snowsuit hasnt worn) {
485 switch (body_temperature) {
487 "The feeling of cold overwhelms you. Surely the cold will get to
488 you before anything else does. Right?";
490 "You can feel yourself getting colder and colder.";
492 "You can see your own breath freezing in the air, forming little
495 "You shiver in the cold.";
497 "You continue to shiver in the cold.";
499 "Your hands grow numb from the cold.";
501 "You continue shivering in order to keep warm.";
503 "Your shivering grows worse as your body becomes colder by the
506 "Your teeth begin to chatter as you desperately try to warm
509 "Your shivering intensifies as your body begins to freeze over
512 "Your fingers become stiff and you feel sharp pains all over your
515 "The cold has gotten to a point where it is too much for you. You
516 begin to shiver uncontrollably.";
518 "Your eyesight begins to fade and you can't even feel yourself
521 "You can feel your body shutting down from the cold as you slowly
522 begin to lose consciousness.";
528 Object snowshoes "snowshoes" bedroom
529 with name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes'
532 "They're light blue in color and have a thick, hard
533 rubber bottom that's attached to a metal frame that keeps
534 you from sinking into the snow. They look to be warm and
538 print_ret (The) self,
539 " fit perfectly and go up to your
543 if (location ~= mainroom && location ~= office && location ~=
544 kitchenette && location ~= bedroom && location ~= thedark &&
545 snowshoes hasnt worn) {
549 has pluralname clothing;
551 Forest southofcabin "South Of Cabin"
553 print "The wind is howling, and there's snow flying everywhere.";
554 if (snowsuit hasnt worn)
556 " It's really cold and
557 you're not dressed for this weather.";
559 " The snow stings your face and you
560 can barely see three feet in front of you.^";
567 Forest eastofcabin "East Of Cabin"
569 print "It's dark outside. ";
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 (snowshoes in player && snowshoes has worn) {
583 "The snowshoes are doing their job by making sure
584 you don't sink into the snow.^";
591 Forest westofcabin "Westh Of Cabin"
593 "The snow is falling so fast that you can barely see
594 anything. You can't even be sure you're going in the right
602 thedark.description =
603 "It is pitch black. You are likely to be eaten
606 "You're trapped in a snowstorm while visiting the forest
607 during your vacation to a small rural town. This is the worst
608 snowstorm in more than 40 years. If only you has listened to
609 the news. Well, it's too late for that. The snow has been
610 falling for the past seven hours and shows no signs of
611 stopping anytime soon. You need to get back to your hotel in
612 the town. You finally manage to find an old cabin in the
613 woods and get inside but have no idea where you are. You're
614 not dressed for this weather.^";
615 StartDaemon(lantern);
616 StartDaemon(snowshoes);
617 StartDaemon(snowsuit);
623 print "You sink into the deep snow and are unable to move.";
626 "Finally, you succumb to the cold. Your mind goes blank as
627 you slip away into the endless darkness and the deep sleep
631 ! Don't have 'take all' take the lightbulb in the mainroom of the
634 [ ChooseObjects obj code;
640 if (obj == lightbulb)
645 if (location == thedark && real_location == mainroom) {
646 PlaceInScope(lightsocket);
647 PlaceInScope(lightbulb);
652 Object grue "grue" thedark
654 name 'grue' 'monster',
655 grue_active_around_cabin,
656 grue_active_in_the_dark,
658 if (location == thedark) {
659 switch (++(self.grue_active_in_the_dark)) {
661 "^You hear horrible gurgling sounds in the dark.";
663 "^You hear the clink of razor-sharp claws nearby.";
666 "^Your last memory is of the slavering fangs of the
667 horrible Grue as it claims you for a meal.";
670 if (location == mainroom || location == office || location ==
671 kitchenette || location == bedroom) {
672 switch (++(self.grue_active_around_cabin)) {
674 "^You hear the wind howling outside, if it is the wind.";
676 "^You hear horrible gurgling sounds outside.";
678 "^The noise outside gets louder.";
680 "^You hear the sound of shuffling feet outside.";
682 "^You hear something sniffing around the cabin.";
684 "^You hear a deep guttural sound from outside that sends a chill down your spine.";
686 "^You hear something scratching on the cabin walls from outside.";
688 "^You hear something howl outside. It's a chilling, mournful wail that sends a chill down your spine.";
690 "^A thunderous CRACK can be heard coming from outside.";
692 "^There's a sudden crashing sound as something is thrown against the cabin walls.";
694 "^Something begins to beat against the walls of the cabin, as if trying to to break in. It makes a loud, thunderous noise.";
696 "^The wind is howling and the walls are being beaten so hard it feels like the cabin is shaking.";
698 "^Suddenly, there's ominous silence from outside the cabin.";
701 if (location == mainroom || location == office || location ==
702 kitchenette || location == bedroom && self.grue_active_around_cabin
704 print "^The lights flicker and suddenly go out.";
705 cabin_has_electricity = 0;
707 give mainroom ~light;
709 give kitchenette ~light;
711 give eastofcabin ~light;
719 "Oh, no! You have walked into the slavering fangs of a lurking
725 "^If you need help try some of the commands from:
726 ^http://pr-if.org/doc/play-if-card/^";
730 print "Nothing obvious happens.^";
760 * 'through' / 'out' / 'via' noun -> Go;
763 * 'through' / 'out' / 'via' noun -> Go;
766 * 'through' / 'out' / 'via' noun -> Go;
769 * 'through' / 'out' / 'via' noun -> Go;
772 * 'through' / 'out' / 'via' noun -> Go;