! _Shade_ ! Special source-code edition ! Copyright 2000-2002 Andrew Plotkin ! http://www.eblong.com/zarf/if.html ! This source code is provided for personal, educational use only. ! See README file for details. [ ParseNameRelay wd num; wd = NextWord(); while (WordInProperty(wd, self.self_obj, name)) { num++; wd = NextWord(); } return num; ]; [ DesertCheckUnder obj; if (figure.number == obj) { "You catch a glimpse of two tiny eyes, shining out from beneath ", (the) obj, "."; } "You bend down, and see only sand."; ]; [ DesertGoaled obj; remove obj; if (figure.number == obj) { figure.number = ChooseHome(); if (figure.number) { "^A tiny figure burrows out of the new-fallen sand. You just have time to make out its shape -- human -- before it darts behind you and out of sight."; } else { "^A tiny figure burrows out of the new-fallen sand. It darts one way, then the other; but there is no more shelter."; } } ]; [ ChooseHome ix obj count; count = 0; ix = random(101); while (count < 3) { switch (ix % 3) { 0: obj = desstereo; 1: obj = descomputer; 2: obj = desfuton; } if (obj in Desert) return obj; ix++; count++; } return 0; ]; [ Suffer; if (figure.number) "^[BUG] figure.number nonzero"; figure.weakness++; switch (figure.weakness) { 2: print "^The figure moves more slowly now.^"; 3: print "^The figure slumps to the sand. No -- it's still moving, though on hands and knees.^"; 4: print "^The figure falls. After a few seconds... it still doesn't move.^^The sands quickly cover it.^"; remove figure; player.weakness = 0; player.orders = EndSuffering; } ]; [ EndSuffering; if (action == ##Take && noun == book) { <>; } if (action ~= ##Wait or ##Look or ##Sleep or ##Wake or ##Inv or ##Examine or ##Search) "Nothing to do but wait."; player.weakness++; if (player.weakness < 3 || book.saw_blank == false) { return false; } print "The tiny figure crawls out from under the sands. It's dead.^^"; print "~You win,~ it says. ~Okay, my turn again.~^^"; print ">...^Nothing left to do. Time passes.^^"; print "The sun crawls higher.^"; deadflag = 2; ]; Object Desert "home" with articles "Your" "your" "your", seenonce false, description [; print "The land is nearly barren. Dunes roll away towards the rising sun; a little shade trails behind them, but that will soon be gone. The sky is flat and empty blue.^"; DescribeParagraph(self); rtrue; ], startup [; StartDaemon(figure); StartDaemon(desstereo); ], before [; Go: "You pace around for a while."; Exit: "But the taxi isn't here yet!"; Listen: if (noun == 0) { if (desstereo in self) <>; "You hear nothing. The helicopter is long gone."; } Examine: switch (noun) { d_obj: <>; u_obj: <>; } rfalse; ]; Object -> desertsand "sand" with name 'sand' 'sands' 'dune' 'dunes', article "the", description "It's exactly like all the sand you've ever seen before.", before [; Search: <>; BlowOn: "A few grains of sand tumble away."; Take: "You pick up a pinch of sand. It runs through your fingers."; Push, Pull: "You push the sand around with your foot."; Dig: "You dig for a while."; ], has scenery; Object -> desertshade "shade" with name 'shade' 'shadow', description "The shadows shrink as you watch. The dunes aren't high here, and the sun is rising fast.", before [; Search: <>; Examine: rfalse; Enter: "Even lying flat, you can no longer shield yourself behind the dunes."; default: "They're only shadows."; ], has scenery; Object -> desertsky "sky" with name 'sky', description "The sky is dead blue, crushed by sunlight.", before [; Search: <>; Examine: rfalse; default: "There's nothing you can do to the sky."; ], has scenery; Object -> desertsun "sun" with name 'sun' 'sunlight' 'light', description "Fusing hydrogen. Deathly, inescapable. White, blazing down.", before [; Search: <>; Examine: rfalse; default: "There's nothing you can do to the sun."; ], has scenery; Object -> figure "tiny figure" with name 'tiny' 'figure' 'shape' 'human' 'eyes' 'movement', description [; if (self.number) "You still haven't managed to see it clearly."; print "A tiny human figure"; switch (self.weakness) { 0: print " walks"; 1: print " trudges"; 2: print " staggers"; default: print " crawls"; } " across the sand. It doesn't seem to notice you."; ], nosubdescribe [; return (self.number ~= 0); ], subdescribe [; print "A tiny figure inches across the sand."; rtrue; ], number desfuton, weakness 0, before [; Find: if (self.number) "You're not sure where it went."; "It's right here."; Search: if (self.number) "You're not sure where it is."; "You try to peer into the figure's eyes. They are too remote. They do not see you."; Push, Pull, Turn, Lower: if (self.number) "You're not sure where it is."; print "You push a wave of sand at the figure. It stumbles and slides under -- quickly buried. After a few seconds, grains of sand roll aside, and it pulls itself to the surface.^"; Suffer(); rtrue; Touch: if (self.number) "You're not sure where it is."; print "You kneel and brush your finger over the figure's forehead. It shakes its head, unseeing, and then collapses. You watch in concern, but in a few moments it struggles to its feet again.^"; Suffer(); rtrue; Attack: if (self.number) "You're not sure where it is."; print "You lean down and slap at the tiny figure. The blow does not connect, but it whips up sand; the figure ducks its head and shields its eyes from the showering grit.^"; Suffer(); rtrue; Take, Raise: if (self.number) "You're not sure where it is."; print "You cup your palms around the figure and raise it into the air -- a human shape fallen to its knees in your handful of sand. You gaze down; sunlight seethes in the cauldron of your fingers. The figure slowly slides flat. But the sand is running out of your hands, and the figure falls to the ground, where it slowly pulls itself up again.^"; Suffer(); rtrue; Wave: if (self.number) "You're not sure where it is."; print "You stomp your foot. The sand ripples silently, and the figure trips and falls. Quickly it stands again, and continues.^"; Suffer(); rtrue; BlowOn: if (self.number) "You're not sure where it is."; print "You crouch and blow at the tiny figure. Hot sand flurries up. After several seconds, the figure stumbles out of the cloud of sand, covering its eyes.^"; Suffer(); rtrue; Listen: "You can make out no words."; ], life [; Kiss: if (self.number) "You're not sure where it is."; if (verb_word == 'kiss') { print "You kneel and brush your lips over the figure's forehead. It shakes its head, unseeing, and then collapses. You watch in concern, but in a few moments it struggles to its feet again.^"; } else { print "You wrap your hand gently around the figure for a moment. When you release it, the figure falls prostrate, flushed and dry-looking. Finally it twitches and regains its feet.^"; } Suffer(); rtrue; Give, Show: if (self.number) "You're not sure where it is."; "The figure doesn't seem to see you."; Ask, Tell, Answer, Order: if (self.number) "You're not sure where it is."; print "As you speak, currents of air curl across the sand. The figure clutches its clothing about itself and staggers on, ignoring you.^"; Suffer(); rtrue; ], opentime 0, daemon [ ix; self.opentime++; if (parent(self) == 0) { StopDaemon(self); return; } if (self.number == 0) { if (self.opentime >= random(3)+1) { self.opentime = 0; switch (random(97) % 7) { 0: print "^The figure looks around, shading its eyes, and then sets out in a slightly different direction.^"; 1: print "^The figure seems to be muttering to itself.^"; 2: print "^The figure seems to be chanting to itself.^"; 3: print "^The figure stops, digs for a moment in the sand, and then continues.^"; 4: print "^The figure stops and looks around for a moment, shading its eyes.^"; 5: print "^The figure searches its clothing briefly, and then continues on its way.^"; 6: print "^The figure closes its eyes for a few seconds.^"; } } return; } if (self.opentime == 2 && random(99) < 60) { print "^Something moves beneath ", (the) self.number, ".^"; return; } if (self.opentime >= random(3)+2) { ix = ChooseHome(); if (ix ~= self.number) { self.opentime = 0; self.number = ix; print "^You catch a darting movement past your feet.^"; } } ], has scenery animate neuter; Object -> desfuton "futon" with self_obj futon, parse_name ParseNameRelay, articles "Your" "your" "your", subdescribe "Your futon sits nearby.", description [ ix; print "The futon is definitely on the downhill side of the dunes. The frame is half-buried and a few lines of sand trickle down the sheet-wrinkles, but it's the same old futon in the end.^"; ix = children(self); if ((player notin self && ix > 0) || ix > 1) { print "^Sitting on the futon"; if (player in self) print " next to you"; WriteListFrom(child(self), TERSE_BIT + ENGLISH_BIT + ISARE_BIT + CONCEAL_BIT); print ".^"; } rtrue; ], before [; Enter: print "You sit down, and find yourself seated on bare sand. The futon has disintegrated without a sound or a final word.^"; while (child(self)) { move child(self) to Desert; } DesertGoaled(self); rtrue; LookUnder: DesertCheckUnder(self); rtrue; Pull, Push, Turn: "You can barely move the futon on a solid floor. Against the sand, no hope."; Dig: "Still no loose change."; ], react_before [; Exit: if (player in self) { move player to parent(self); if (keep_silent == 0) { print "You stand up.^"; } rtrue; } ], has supporter enterable transparent scenery; Object -> desstereo "stereo" with self_obj stereo, parse_name ParseNameRelay, subdescribe "The stereo leans against a dune.", description [; print "The stereo is old, dating from the era when matte-black, featureless, and opaque were the watchwords of hipness. Now it sits on a pile of sand and looks lost.... "; self.song(); " is playing."; ], before [; LookUnder: DesertCheckUnder(self); rtrue; SwitchOn: "The stereo is already on."; SwitchOff: print "A garbled news report comes on just as you reach for the switch. ~Death Val... hikers... missing for... still... hope, say...~^^...Old news. You hit the switch: click. The stereo falls silent, turns white, and drops instantly away into sand.^"; DesertGoaled(self); rtrue; Listen: print "The stereo is playing "; self.song(); "."; ], opentime 99, number 0, song [; switch (self.number) { 1: print "~Cool, Clear Water~"; 2: print "~Gotta Stop on the Road for Water~"; 3: print "~Water From Another Time~"; 4: print "~Sun Gets In My Eyes~"; 5: print "~You Listenin' To Me?~"; 6: print "~Ain't Gonna Make It~"; 7: print "~Projection Of Your Fears~"; 8: print "~Take It Out On The Little Guy~"; 9: print "~Rule the Kingdom of the Sun~"; 10: print "~Triumph Alone~"; 11: print "~Alone~"; 12: print "~Shade~"; } ], daemon [; if (parent(self) == 0) { StopDaemon(self); return; } self.opentime++; if (self.opentime >= random(3)+2) { self.number++; self.opentime = 0; if (self.number > 12) self.number = 12; print "^Click. The stereo is playing "; self.song(); print ".^"; } ], has scenery; Object -> descomputer "computer" with self_obj computer, parse_name ParseNameRelay, subdescribe "Your computer squats complacently, the color of the sand.", description [; if (self.number == 0) "The game's opening sits neatly at the top of the screen, followed by a command prompt."; else "The game's closing message blinks at the bottom of the screen."; ], number 0, before [; Search: <>; Play, TypeOn: print "You"; if (random(97) < 50) print " kneel"; else print " crouch"; if (random(103) < 66) print " in the sand"; if (self.number == 0) print " and play through the computer game again."; else print ", restart, and play through once more."; self.number++; switch (self.number) { 2: print " You don't get any farther."; 3: print " A different ending, this time, but it comes to the same thing."; 5: print " You aren't going to get anywhere."; 7: print " Nothing ever changes."; 9: print " You resolve to take charge."; 12: print " You plan to make someone else pay for your mistakes."; 15: print " You intend to switch places."; 19: print " If you win, you win alone."; 24: print " You wish for shade."; 28: self.number = 23; } new_line; rtrue; LookUnder: DesertCheckUnder(self); rtrue; SwitchOn: "The computer is already on."; SwitchOff: print "~The only way to win is not to play,~ flashes the screen. You roll your eyes. The oldest lie; nobody's bought it since ever.^^"; print "You hit the power key; the computer gives a tiny sigh and crumbles away.^"; DesertGoaled(self); rtrue; Open: "This model can't be opened except at the factory."; Smell: "The computer smells of hot silica."; ], has scenery;