! Copyright (C) 2021 Jason Self ! ! This file is free software: you may copy, redistribute and/or ! modify it under the terms of the GNU Affero General Public License ! as published by the Free Software Foundation, either version 3 of ! the License, or (at your option) any later version. ! ! This file is distributed in the hope that it will be useful, but ! WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Affero General Public License for more details. ! ! You should have received a copy of the GNU Affero General Public ! License along with this file. If not, see https://gnu.org/licenses/ Global lantern_fuel_left = 20; Constant DEATH_MENTION_UNDO; Constant Story "Snowed In"; Constant Headline "^A work of interactive fiction. ^If you get stuck try typing HELP. ^Ongoing development: https://jxself.org/git/?p=snowed-in.git ^Send bugs and feedback by email to j@@64jxself.org. ^IFID DE9FA2E5-4EC7-4166-9218-E56EFA1DF40F ^Copyright (C) 2021 Jason Self ^You can change and share this game under the terms of the GNU Affero General Public License as published by the Free Software Foundation (FSF), either version 3 of the License, or (at your option) any later version published by the FSF. See the GNU Affero General Public License for more details.^^You should have received a copy of this game's source code along with a copy of the GNU Affero General Public License so that you can know your rights. If not, contact the place you got it from.^^"; Include "parser"; Include "verblib"; Release 0; Serial "210405"; Object mainroom "Main Room" with description "This room is a total wreck - it looks like a major fight happened in here. There's a ripped up sofa and a broken old coffee table in the middle of the room. A flat-screen TV is mounted against the wall, with the screen dangling out. This cabin has three other rooms. There's an office area to the east, and a bedroom to the north. A kitchenette can be found to the west. There's a doorway in the south wall leading outside.", n_to bedroom, e_to office, w_to kitchenette, has light; Object sofa "sofa" mainroom with name 'sofa' 'couch', with description "The sofa is in poor shape. The upholstery is ripped and there are several holes in it.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is too heavy for that."; ], has scenery supporter enterable; Object coffeetable "coffee table" mainroom with name 'coffee' 'table', with description "The old coffee table looks as if it's had quite a bit of use. There are burn marks covering it and the paint is worn off in most places.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is too heavy for that."; ], has scenery supporter enterable; Object lantern "copper lantern" coffeetable with name 'lantern' 'copper' 'lamp', description "This is an exceptionally beautiful lamp. About eleven inches high, with a base of about 5 inches or so in diameter and a large, brass-closed hook at the top. The glass in the lamp has a fresnel type of design, which is used to distribute light widely.", time_left, time_out [; if (lantern has on) { lantern_fuel_left = 0; give lantern ~on; give lantern ~light; StopDaemon(lantern); print_ret "The lantern has run out of fuel and is now off."; } ], before [; SwitchOn: if (lantern_fuel_left > 0) { give lantern light; StartTimer(lantern, lantern_fuel_left); } else { print_ret "The lantern is out of fuel and cannot be turned on."; } SwitchOff: StopTimer(lantern); give lantern ~light; ], daemon [; if (lantern has on) lantern_fuel_left = lantern.time_left; if (lantern has on && lantern_fuel_left <= 5) print_ret "The lantern's fuel runs low."; ], has switchable; Object television "flat-screen TV" mainroom with name 'TV' 'television' 'flat' 'screen' 'flat-screen', with description "The flat-screen TV looks fairly modern but it's been broken in a fight and the screen is dangling out.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is firmly mounted to the wall."; SwitchOn: if (television hasnt visited) { print "Despite the significant damage, the television comes to life in one last valiant attempt to be useful. Your favorite news program is on: U.S. News And Grue Report. The news anchor is giving a warning of Grue sightings in the area of the forest before the television finally dies.^"; give television visited; } else { print "The flat-screen TV is broken and can't be turned on.^"; } return true; ], has scenery switchable; Object lightsocket "light socket" mainroom with name 'socket' 'lightsocket', before [; Take, Pull, Push, PushDir, Turn: print_ret "You don't have the tools to remove a light socket."; Receive: if (noun ~= lightbulb) { print "Put "; print (a) noun; print_ret " into the light socket? Maybe you should come with a warning label because you contain more than a trace amount of nut."; } if (noun == lightbulb && light has on) { give mainroom light; give office light; give kitchenette light; give bedroom light; give eastofcabin light; } ], has scenery container transparent open; Object lightbulb "light bulb" lightsocket with name 'light' 'bulb' 'lightbulb', before [; SwitchOn: if (lightbulb in lightsocket) { give mainroom light; give office light; give kitchenette light; give bedroom light; give eastofcabin light; } else { print_ret "Turn on a lightbulb when it's not in the socket? What a strange idea."; } ], after [; Take, Pull, Push, PushDir, Turn, SwitchOff: give lightbulb ~on; give mainroom ~light; give office ~light; give kitchenette ~light; give bedroom ~light; give eastofcabin ~light; ], has switchable on; Object office "Office" with description "There seems to have been quite a fight in here. The room is a wreck. Holes are in the walls and the windows are broken, letting in the cold air from outside. Chunks of drywall and insulation cover the floor. The desk has a bullet hole through the middle.", w_to mainroom, e_to window, has light; Object desk "solid oak desk" office with name 'solid' 'oak' 'desk', with description "The desk is old and made of solid oak. The right side of it has been smashed and all of the drawers have been removed. A bullet hole goes straight through the middle of the desk.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is too heavy for that."; ], has scenery supporter enterable; Object businesscard "business card" desk with name 'business' 'card', with description "The business card is white and has blacked edges. It bears the name ~Lasting Solutions~, a local data recovery company, in bold letters on the top. The company's website URL is printed in blue at the bottom."; Object salesreceipt "sales receipt" desk with name 'sales' 'receipt', with description "The sales receipt is for $200, dated three years ago. It's printed on old tractor feed printer paper and bears the name ~Lasting Solutions~, a local data recovery company. A handwritten note is scrawled on the bottom: ~Start working on these hard drives soon.~"; Object computer "computer" desk with name 'computer' 'PC', with description "It's a heavy older model that appears to have been seriously damaged in a fight. It's clearly on its last legs but is perhaps still useful.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is too heavy for that."; SwitchOn: if (computer hasnt visited) { print "The computer makes some concerning noises while lights on the front also illuminate. The last file is quickly displayed. ~If anyone else reads this, you're in serious danger. I've been fighting a ferocious grue for the last three days. I'm almost out of supplies and can't last much longer. I'm going to take the last of the supplies and escape through the office window in a last-ditch effort to get away and get back into town. I hope I can make it.~ The computer then makes a sickly sound and finally dies as some smoke comes out of it.^"; give computer visited; } else { print "The display briefly flickers but nothing else happens.^"; } return true; ], has switchable; Object drywall "drywall" office with name 'drywall' 'dry' 'wall', before [; Take, Pull, Push, PushDir, Turn: print_ret "Taking that would achieve little."; ], has scenery; Object insulation "insulation" office with name 'insulation', before [; Take, Pull, Push, PushDir, Turn: print_ret "Taking that would achieve little."; ], has scenery; Object bullethole "bullet hole" desk with name 'bullet' 'hole' 'holes', with description "Looks to have come from something that's capable of doing a lot of damage.", found_in desk bedroom, has scenery; Object window "window" office with name 'window' 'windows', description "The window faces the east side of the cabin. It's broken, letting in the cold air from outside.", short_name [; if (location == office) print "window"; else print "window into the cabin"; return true; ], found_in office eastofcabin, door_dir [; if (location == office) return e_to; else return w_to; ], door_to [; if (location == office) return eastofcabin; else return office; ], before [; Search: print_ret "The window faces the east side of the cabin."; Open, Close: print_ret "The window's broken so it's not clear how you'd do that."; ], has scenery door openable open; Object kitchenette "Kitchenette" with description "The kitchenette is empty. A sink, you think, though it's hard to tell what's a pipe and what's a faucet. A refrigerator, standing open and empty. The door has been ripped off. There's no indication as to where it went. There's no food anywhere in here.", e_to mainroom, has light; Object refrigerator "refrigerator" kitchenette with name 'fridge' 'refrigerator', with description "An old rusty refrigerator, standing open and empty. The door has been ripped off. There's no indication as to where it went.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is too heavy for that."; Open, Close: print_ret (The) self, " door is missing."; ], has scenery enterable container openable open; Object sink "sink" kitchenette with name 'sink' 'pipe' 'faucet', with description "A sink, you think, though it's hard to tell what's a pipe and what's a faucet.", after [; SwitchOn: print_ret "Pipes from in the walls make a groaning sound, almost like pain and despair. No water comes out."; ], has scenery container switchable; Object bedroom "Bedroom" with description "This bedroom is small and cramped, and looks like a major fight happened as the exterior wall has bullet holes. The bed is lying on the floor, torn to shreds. It has no sheets, just a bare mattress.", s_to mainroom, has light; Object bed "bed" bedroom with name 'bed' 'mattress', with description "The mattress is bare and empty.", before [; Take, Pull, Push, PushDir, Turn: print_ret (The) self, " is too heavy for that."; ], has scenery supporter; Object suitcase "suitcase" bedroom with name 'suitcase', with description "The suitcase is made of a light metallic material that you can't quite make out. The color of it is somewhere between silver and grey.", has container open openable; Object snowsuit "snowsuit" suitcase with name 'snowsuit' 'snow' 'suit', with description "The snowsuit is blue, decorated with white and purple designs. On the chest is a large emblem with the letters ~CE~ in purple.", before [; Wear: if (snowshoes in player && snowshoes has worn) { print_ret "The snowsuit can't fit over the snowshoes."; } Remove: if (snowshoes in player && snowshoes has worn) { print_ret "The snowsuit can't be taken off over the snowshoes."; } ], has clothing; Object snowshoes "snowshoes" bedroom with name 'snowshoe' 'snowshoes' 'snow' 'boot' 'boots' 'shoe' 'shoes' 'metal' 'frame', with description "They're light blue in color and have a thick, hard rubber bottom that's attached to a metal frame that keeps you from sinking into the snow. They look to be warm and comfortable.", after [; Wear: print_ret (The) self, " fit perfectly and go up to your knees."; ], daemon [; if (location ~= mainroom && location ~= office && location ~= kitchenette && location ~= bedroom && snowshoes hasnt worn) { deadflag = 3; } ], has pluralname clothing; Object eastofcabin "East Of Cabin" with description [; print "It's dark outside. "; if (lightbulb has on) { print "The light from inside the cabin only penetrates a few feet from the building. "; } else if (lantern in player && lantern has on) { print "The lantern provides the only source of light. "; } if (snowshoes in player && snowshoes has worn) { print "The snowshoes are doing their job by making sure you don't sink into the snow."; } ], w_to window, has light; [ Initialise; Location = mainroom; thedark.description = "It is pitch black. You are likely to be eaten by a grue."; print "You're trapped in a snowstorm while visiting the forest during your vacation to a small rural town. This is the worst snowstorm in more than 40 years. If only you has listened to the news. Well, it's too late for that. The snow has been falling for the past seven hours and shows no signs of stopping anytime soon. You need to get back to your hotel in the town. You finally manage to find an old cabin in the woods and get inside but have no idea where you are. You're not dressed for this weather.^"; StartDaemon(lantern); StartDaemon(snowshoes); ]; [ DeathMessage; if (deadflag == 3) print "You sink into the deep snow and are unable to move. It's only a matter of time until your light source dies and the grue comes. Or until you freeze to death. Or both. I wonder if the grue likes a popsicle."; ]; [ InScope; if (location == thedark && real_location == mainroom) { PlaceInScope(lightsocket); PlaceInScope(lightbulb); } return false; ]; Object grue "grue" thedark with article "the", name 'grue' 'monster', each_turn [; StartDaemon(self); ], turns_active, daemon [; if (location ~= thedark) { self.turns_active = 0; StopDaemon(self); return true; } switch (++(self.turns_active)) { 1: "^You hear horrible gurgling sounds in the dark."; 2: "^You hear the clink of razor-sharp claws nearby."; 3: deadflag = 1; "^Your last memory is of the slavering fangs of the horrible Grue as it claims you for a meal."; } ], has scenery; [ DarkToDark; deadflag = 1; "Oh, no! You have walked into the slavering fangs of a lurking grue!"; ]; [ URL; print "^If you need help try some of the commands from: ^http://pr-if.org/doc/play-if-card/^"; ]; [ XyzzySub; print "Nothing obvious happens.^"; return true; ]; [ HelpSub; URL(); return true; ]; Include "grammar"; Verb 'About' * -> Version; Verb 'Info' * -> Version; Verb 'Help' * -> Help; Verb 'Clue' * -> Help; Verb 'Hint' * -> Help; Verb 'xyzzy' * -> Xyzzy; Verb 'crawl' * 'through' / 'out' / 'via' noun -> Go; Verb 'escape' * 'through' / 'out' / 'via' noun -> Go; Extend 'jump' * 'through' / 'out' / 'via' noun -> Go; Extend 'climb' * 'through' / 'out' / 'via' noun -> Go; Extend 'go' * 'through' / 'out' / 'via' noun -> Go;