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
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 Object mainroom "Main Room"
42 "This room is a total wreck - it looks like a major fight
43 happened in here. There's a ripped up sofa and a broken
44 old coffee table in the middle of the room. A flat-screen
45 TV is mounted against the wall, with the screen dangling
46 out. This cabin has three other rooms. There's an office
47 area to the east, and a bedroom to the north. A
48 kitchenette can be found to the west. There's a doorway
49 in the south wall leading outside.",
56 Object frontdoor "front door" mainroom
57 with name 'door' 'front',
59 "The wooden door is made of thick oak wood with the shape
60 of a bear claw engraved in it.",
62 if (location == mainroom)
63 print "door to the outside";
65 print "door to the cabin";
68 found_in mainroom southofcabin,
70 if (location == mainroom)
76 if (location == mainroom)
81 has scenery door openable;
83 Object bearclaw "bear claw" mainroom
84 with name 'bear' 'claw',
86 "It's in the shape of a thin, sharp claw with three jagged
87 points at the top of it.",
90 Object sofa "sofa" mainroom
91 with name 'sofa' 'couch',
93 "The sofa is in poor shape. The upholstery is ripped and
94 there are several holes in it.",
96 Take, Pull, Push, PushDir, Turn:
97 print_ret (The) self, " is too heavy for that.";
99 has scenery supporter enterable;
101 Object coffeetable "coffee table" mainroom
102 with name 'coffee' 'table',
104 "The old coffee table looks as if it's had quite a bit of
105 use. There are burn marks covering it and the paint is
106 worn off in most places.",
108 Take, Pull, Push, PushDir, Turn:
109 print_ret (The) self, " is too heavy for that.";
111 has scenery supporter enterable;
113 Object lantern "copper lantern" coffeetable
114 with name 'lantern' 'copper' 'lamp',
116 "This is an exceptionally beautiful lantern. About eleven
117 inches high, with a base of about 5 inches or so in
118 diameter and a large, brass-closed hook at the top. A
119 rainbow of unique colors run through the copper. The
120 glass in the lamp has a fresnel type of design, which is
121 used to distribute light widely.",
124 if (lantern has on) {
125 lantern_fuel_left = 0;
130 "Suddenly, the lantern's flame begins to flicker
131 violently within its glass prison and then
132 extinguishes itself.";
137 if (lantern_fuel_left > 0) {
139 StartTimer(lantern, lantern_fuel_left);
143 "You snap the switch a few times, but nothing
152 lantern_fuel_left = lantern.time_left;
153 if (lantern has on && lantern_fuel_left <= 5)
154 print_ret "The lantern's fuel runs low.";
158 Object television "flat-screen TV" mainroom
159 with name 'TV' 'television' 'flat' 'screen' 'flat-screen',
161 "The flat-screen TV looks fairly modern but it's been
162 broken in a fight and the screen is dangling out.",
164 Take, Pull, Push, PushDir, Turn:
165 print_ret (The) self, " is firmly mounted to the wall.";
167 if (television hasnt visited) {
169 "Despite the significant damage, the television
170 comes to life in one last valiant attempt to be
171 useful. Your favorite news program is on: U.S.
172 News And Grue Report. The news anchor is giving a
173 warning of Grue sightings in the area of the
174 forest before the television finally dies.^";
175 give television visited;
179 "The flat-screen TV is broken and can't be
184 has scenery switchable;
186 Object lightsocket "light socket" mainroom
187 with name 'socket' 'lightsocket',
189 Take, Pull, Push, PushDir, Turn:
191 "You don't have the tools to remove a light
194 if (noun ~= lightbulb) {
198 " into the light socket? Maybe you should come
199 with a warning label because you contain more than
200 a trace amount of nut.";
202 if (noun == lightbulb && light has on) {
205 give kitchenette light;
207 give eastofcabin light;
210 has scenery container transparent open;
212 Object lightbulb "light bulb" lightsocket
213 with name 'light' 'bulb' 'lightbulb',
216 if (lightbulb in lightsocket) {
217 if (cabin_has_electricity == 1) {
220 give kitchenette light;
222 give eastofcabin light;
226 "You flip the switch a few times, but nothing
232 "Turn on a lightbulb when it's not in the
233 socket? What a strange idea.";
237 Take, Pull, Push, PushDir, Turn, SwitchOff:
239 give mainroom ~light;
241 give kitchenette ~light;
243 give eastofcabin ~light;
247 Object office "Office"
249 "There seems to have been quite a fight in here. The room
250 is a wreck. Holes are in the walls and the windows are
251 broken, letting in the cold air from outside. Chunks of
252 drywall and insulation cover the floor. The desk has a
253 bullet hole through the middle.",
258 Object desk "solid oak desk" office
259 with name 'solid' 'oak' 'desk',
261 "The desk is old and made of solid oak. The right side of
262 it has been smashed and all of the drawers have been
263 removed. A bullet hole goes straight through the middle of
266 Take, Pull, Push, PushDir, Turn:
267 print_ret (The) self, " is too heavy for that.";
269 has scenery supporter enterable;
271 Object businesscard "business card" desk
272 with name 'business' 'card',
274 "The business card is white and has blacked edges. It
275 bears the name ~Lasting Solutions~, a local data recovery
276 company, in bold letters on the top. The company's
277 website URL is printed in blue at the bottom.";
279 Object salesreceipt "sales receipt" desk
280 with name 'sales' 'receipt',
282 "The sales receipt is for $200, dated three years ago.
283 It's printed on old tractor feed printer paper and bears
284 the name ~Lasting Solutions~, a local data recovery
285 company. A handwritten note is scrawled on the bottom:
286 ~Start working on these hard drives soon.~";
288 Object computer "computer" desk
289 with name 'computer' 'PC',
291 "It's a heavy older model that appears to have been
292 seriously damaged in a fight. It's clearly on its last
293 legs but is perhaps still useful.",
295 Take, Pull, Push, PushDir, Turn:
296 print_ret (The) self, " is too heavy for that.";
298 if (computer hasnt visited) {
300 "The computer makes some concerning noises while
301 lights on the front also illuminate. The last
302 file is quickly displayed. ~If anyone else reads
303 this, you're in serious danger. I've been fighting
304 a ferocious grue for the last three days. I'm
305 almost out of supplies and can't last much
306 longer. I'm going to take the last of the supplies
307 and escape through the office window in a
308 last-ditch effort to get away and get back into
309 town. I hope I can make it.~ The computer then
310 makes a sickly sound and finally dies as some
311 smoke comes out of it.^";
312 give computer visited;
316 "The display briefly flickers but nothing
323 Object drywall "drywall" office
324 with name 'drywall' 'dry' 'wall',
326 Take, Pull, Push, PushDir, Turn:
327 print_ret "Taking that would achieve little.";
331 Object insulation "insulation" office
332 with name 'insulation',
334 Take, Pull, Push, PushDir, Turn:
335 print_ret "Taking that would achieve little.";
339 Object bullethole "bullet hole" desk
340 with name 'bullet' 'hole' 'holes',
342 "Looks to have come from something that's capable of
343 doing a lot of damage.",
344 found_in desk bedroom,
347 Object window "window" office
348 with name 'window' 'windows',
350 "The window faces the east side of the cabin. It's broken,
351 letting in the cold air from outside.",
353 if (location == office)
356 print "window into the cabin";
359 found_in office eastofcabin,
361 if (location == office)
367 if (location == office)
374 print_ret "The window faces the east side of the cabin.";
377 "The window's broken so it's not clear how
380 has scenery door openable open;
382 Object kitchenette "Kitchenette"
384 "The kitchenette is empty. A sink, you think, though it's
385 hard to tell what's a pipe and what's a faucet. A
386 refrigerator, standing open and empty. The door has been
387 ripped off. There's no indication as to where it
388 went. There's no food anywhere in here.",
392 Object refrigerator "refrigerator" kitchenette
393 with name 'fridge' 'refrigerator',
395 "An old rusty refrigerator, standing open and empty. The
396 door has been ripped off. There's no indication as to
399 Take, Pull, Push, PushDir, Turn:
400 print_ret (The) self, " is too heavy for that.";
402 print_ret (The) self, " door is missing.";
404 has scenery enterable container openable open;
406 Object sink "sink" kitchenette
407 with name 'sink' 'pipe' 'faucet',
409 "A sink, you think, though it's hard to tell what's a
410 pipe and what's a faucet.",
414 "Pipes from in the walls make a groaning sound,
415 almost like pain and despair. No water comes out.";
417 has scenery container switchable;
419 Object bedroom "Bedroom"
421 "This bedroom is small and cramped, and looks like a
422 major fight happened as the exterior wall has bullet
423 holes. The bed is lying on the floor, torn to shreds. It
424 has no sheets, just a bare mattress.",
428 Object bed "bed" bedroom
429 with name 'bed' 'mattress',
430 with description "The mattress is bare and empty.",
432 Take, Pull, Push, PushDir, Turn:
433 print_ret (The) self, " is too heavy for that.";
435 has scenery supporter;
437 Object suitcase "suitcase" bedroom
438 with name 'suitcase',
440 "The suitcase is made of a light metallic material that
441 you can't quite make out. The color of it is somewhere
442 between silver and grey.",
443 has container open openable;
445 Object snowsuit "snowsuit" suitcase
446 with name 'snowsuit' 'snow' 'suit',
448 "The snowsuit is blue, decorated with white and purple
449 designs. On the chest is a large emblem with the letters
453 if (snowshoes in player && snowshoes has worn) {
454 print_ret "The snowsuit can't fit over the snowshoes.";
457 if (snowshoes in player && snowshoes has worn) {
458 print_ret "The snowsuit can't be taken off over the snowshoes.";
462 if (location ~= mainroom && location ~= office && location ~=
463 kitchenette && location ~= bedroom && location ~= thedark &&
464 snowsuit hasnt worn) {
465 body_temperature = --body_temperature;
466 print body_temperature;
468 if (location == mainroom || location == office || location ==
469 kitchenette || location == bedroom || location ~= thedark ||
470 snowsuit has worn && 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 Object 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.^";
565 Object eastofcabin "East Of Cabin"
567 print "It's dark outside. ";
568 if (lightbulb has on) {
570 "The light from inside the cabin only penetrates
571 a few feet from the building. ";
574 if (lantern in player && lantern has on) {
576 "The lantern provides the only source of
579 if (snowshoes in player && snowshoes has worn) {
581 "The snowshoes are doing their job by making sure
582 you don't sink into the snow.^";
591 thedark.description =
592 "It is pitch black. You are likely to be eaten
595 "You're trapped in a snowstorm while visiting the forest
596 during your vacation to a small rural town. This is the worst
597 snowstorm in more than 40 years. If only you has listened to
598 the news. Well, it's too late for that. The snow has been
599 falling for the past seven hours and shows no signs of
600 stopping anytime soon. You need to get back to your hotel in
601 the town. You finally manage to find an old cabin in the
602 woods and get inside but have no idea where you are. You're
603 not dressed for this weather.^";
604 StartDaemon(lantern);
605 StartDaemon(snowshoes);
606 StartDaemon(snowsuit);
612 print "You sink into the deep snow and are unable to move.";
615 "Finally, you succumb to the cold. Your mind goes blank as
616 you slip away into the endless darkness and the deep sleep
620 ! Don't have 'take all' take the lightbulb in the mainroom of the
623 [ ChooseObjects obj code;
629 if (obj == lightbulb)
634 if (location == thedark && real_location == mainroom) {
635 PlaceInScope(lightsocket);
636 PlaceInScope(lightbulb);
641 Object grue "grue" thedark
643 name 'grue' 'monster',
644 grue_active_around_cabin,
645 grue_active_in_the_dark,
647 if (location == thedark) {
648 switch (++(self.grue_active_in_the_dark)) {
650 "^You hear horrible gurgling sounds in the dark.";
652 "^You hear the clink of razor-sharp claws nearby.";
655 "^Your last memory is of the slavering fangs of the
656 horrible Grue as it claims you for a meal.";
659 if (location == mainroom || location == office || location ==
660 kitchenette || location == bedroom) {
661 switch (++(self.grue_active_around_cabin)) {
663 "^You hear the wind howling outside, if it is the wind.";
665 "^You hear horrible gurgling sounds outside.";
667 "^The noise outside gets louder.";
669 "^You hear the sound of shuffling feet outside.";
671 "^You hear a deep guttural sound from outside that sends a chill down your spine.";
673 "^You hear something sniffing around the cabin.";
675 "^You hear something scratching on the cabin walls from outside.";
677 "^You hear something howl outside. It's a chilling, mournful wail that sends a chill down your spine.";
679 "^A thunderous CRACK can be heard coming from outside.";
681 "^There's a sudden crashing sound as something is thrown against the cabin walls.";
683 "^Something begins to beat against the walls of the cabin, as if trying to to break in. It makes a loud, thunderous noise.";
685 "^The wind is howling and the walls are being beaten so hard it feels like the cabin is shaking.";
687 "^Suddenly, there's ominous silence from outside the cabin.";
690 if (location == mainroom || location == office || location ==
691 kitchenette || location == bedroom && self.grue_active_around_cabin
693 print "^The lights flicker and suddenly go out.";
694 cabin_has_electricity = 0;
696 give mainroom ~light;
698 give kitchenette ~light;
700 give eastofcabin ~light;
708 "Oh, no! You have walked into the slavering fangs of a lurking
714 "^If you need help try some of the commands from:
715 ^http://pr-if.org/doc/play-if-card/^";
719 print "Nothing obvious happens.^";
749 * 'through' / 'out' / 'via' noun -> Go;
752 * 'through' / 'out' / 'via' noun -> Go;
755 * 'through' / 'out' / 'via' noun -> Go;
758 * 'through' / 'out' / 'via' noun -> Go;
761 * 'through' / 'out' / 'via' noun -> Go;