#import "lib.ih"

! Death By Monkey
! Written for IntroComp, Feb 2002

LibraryMessage 1 "<bgcolor black><font color=green><clearscreen><br><b>DEATH BY MONKEY</b>
                 <br><i>Interactive primates by Sumyung Guy</i>
                 <br>Release 00 / Serial Number 020219"

LibraryMessage 200 "<br><b>Welcome to ~Death By Monkey~</b>
                   <br>
                   <br>1. See instructions (IMPORTANT - Do this first if you have never played this game before)
                   <br>2. Restore a saved game
                   <br>3. Start a new game<br>"

LibraryMessage 201 "<b>INSTRUCTIONS</b>
                   <br>~Death by Monkey~ is a game which makes use of the IAGE
                   IF engine. It is multiplayer, and you may play simultaneously with friends or
                   by yourself.<br>
                   <br><b>MULTIPLAYER COMMANDS:</b>
                   <br><i>listplayers</i> - Displays a list of everyone currently in the game
                   <br><i>savestate</i> - Saves your position for later. Note that you will need to use
                   the same nickname for future sessions to restore this position. Also note that saved
                   games require a password.
                   <br><i>restorestate</i> - Restores a saved position
                   <br><i>setalias ~newname~</i> - Changes your in-game nickname to ~newname~
                   <br>
                   <br><b>NORMAL COMMANDS:</b>
                   <br>This game understands ~normal~ interactive fiction commands - imperative statements
                   to your player character to perform actions.<br>
                   <br>Compass directions (n,s,e,w,u,d,ne,nw,se,sw) move around the map. In addition, you may
                   ENTER or GET IN things.
                   <br>You may (for example) TAKE, DROP, PUT, REMOVE and EXAMINE items, among many other
                   accepted verbs.
                   <br>In addition, IAGE will happily understand TAKE ALL, TAKE ALL BUT THE SWORD,
                   or even TAKE THE APPLE, THE COIN AND THE SWORD.
                   <br>INVENTORY (or ~i~) tells you what you are carrying,
                   <br>AGAIN (or ~g~) will repeat your last command.
                   <br>LOOK, REDESCRIBE (or ~l~, or ~r~) will redisplay your surroundings.
                   <br>To speak to nearby players and NPCs, use the ~SAY <text>~ command - free, English
                   text is expected.
                   <br>VERBOSE and BRIEF allow you to change whether room descriptions are displayed in
                   their entirity on subsequent visits.
                   <br>SCORE displays your score to you.
                   <br>You may also send a number of commands at once, breaking them with a full-stop (.) or
                   the word ~then~ - eg. ~open mailbox. get leaflet then read it~.
                   <br>The ~it~ pronoun and masculine/feminine pronouns for NPCs are also fully supported.
                   <br><br>Good luck!<waitkey>"

! The initial message on seeing the house
LibraryMessage 202 "<br>Perhaps there is someone there? Maybe they have a phone you could use? You don't
                   really seem to have a lot of options at the moment.
                   <br><br>It looks like you aren't the first here - to the north you notice another car, pulled
                   off the road into the same ditch as yours, although the ditch deepens under their car,
                   leaving them firmly stuck.
                   <br><br>Well - whoever they are, they aren't going anywhere.
                   <br><br>It is throwing it down with rain - you really ought to find some shelter before you
                   catch a chill."

! Wandering off the road message
LibraryMessage 203 "It's 30 miles to the nearest town and absolutely belting it down with rain - you really should
                   find some shelter."

! Seeing old guy in lab coat for first time
LibraryMessage 205 "<br>An old man, sporting a white labcoat and thick bottle-bottom glasses enters the room and wanders
                   over to the cage. The monkey sits there, quite placid, while the old man inspects the top
                   of its head.
                   <br>
                   <br>The man wanders over to the machine and starts to press buttons and pull levers.
                   <br>
                   <br>Within seconds, a tight beam of purple light bursts forth from the end of the machine and into
                   the monkey's head.
                   <br>
                   <br>The monkey stands up and starts to roar - its muscles seem to grow, its teeth appear to lengthen
                   and its eyes become quite red.
                   <br>
                   <br>The beam from the machine stops.
                   <br>
                   <br>The monkey grabs hold of two of the cell bars and bends them as if they were made of rubber. The old
                   man pulls a remote control out of his pocket and presses a button. The bent bars of the cage ripple and
                   reform. The monkey attempts to bend them again, but this time is unable to make them move.
                   <br>
                   <br>Satisfied, the old man scribbles a few notes on a piece of paper and leaves the room."

GameCode {
       Name "Death By Monkey"
       MaxItemsCanCarry 10
       MaxWeightCanCarry 10
       MaxSizeCanCarry 10
       StartingLocation drivingcountrylane
       Verbose yes
       ShowAvailableExits no
       AllowPersist yes
       SinglePlayerGame no
       MaxUsers 10
       OverrideSecondaryNouns "66 68 69"
       UsingIAGECombat no
       UsingIAGEMoney no
       WideInventoryDisplay yes
       RealTimeNPCs yes
       PlayersStayDead yes
       NPCsStayDead yes

       Initialise: CodeExtend [

               ' Add verb for starting the car, synonymous with switch
               addverb 11 start

               ' Verb for knocking on doors
               addverb 200 knock
               addverb 200 rap
               addverb 200 bang

       ]

       Start: Override [

               ' Opening message, prompting for instructions,
               ' restoring a saved game or starting a new one
               var stoption = ask message(200).text

               if ( stoption = 1 ) then
                       ' Show instructions, then start a new
                       ' game.
                       message(201).show
                       stoption = 3
               endif

               if ( stoption = 2 ) then
                       ' Do the restore game thing. If it didn't go ok, start
                       ' a new game instead.
                       var pass = ask message(132).text
                       var worked = currentplayer.restorestate 00 pass
                       if ( worked = 0 ) then
                               ' If the restore failed, start a new game anyway
                               stoption = 3
                       endif
               endif

               if ( stoption = 3 ) then
                       ' Show the game version, the library version
                       ' and output the start location to the player
                       ' for option 3
                       game.displayversion
                       call StandardLib.DisplayLibraryVersion

                       ' If we already have a player in the game, immediately send
                       ' this new player to inside the car and miss the intro
                       if ( currentplayer.count = 1 ) then
                               currentplayer.currentlocation = drivingcountrylane.id
                       else
                               currentplayer.currentlocation = inthecar.id
                       endif

                       game.displaycurrentlocation
               endif

               ' default male/female pronouns
               call NPCPronouns.init
       ]

       Score: Override [
               currentplayer.print |"You have scored " & currentplayer.score & " (out of a possible 10) and taken " & currentplayer.turns & " turns."|
       ]

       DisplayBanner: Override [
               ' Display score / turns
               returnvalue = |currentplayer.score & "/" & currentplayer.turns|
       ]

       AfterInput: Override [

               ;help,about,info
               endif

               ' This line calls the standard AfterInput library, which generates
               ' stock responses. You can edit these responses by changing the
               ' messages 1 - 200
               call StandardLib.AfterInput
       ]
}


! ========================================================================================
! Driving down a Country Lane
! ========================================================================================

Location drivingcountrylane "Driving along a Country Lane" {

       Description "It's raining hard and the wipers are having trouble keeping up. Visibility is down to
                    practically zero and the headlights are currently an exercise in futility. Just sticking
                    to the white line in the middle of the road is occupying all your attention."

       OnInput: [

               currentplayer.print "Just sticking to the white line in the middle of the road is occupying all your attention."

               ' If this is the first turn the player has taken, break the car now
               ' and start the game proper.
               if ( currentplayer.turns > 0 ) then
                       currentplayer.currentlocation = inthecar.id
                       currentplayer.print "<br>Something that sounds rather vital to the running of the engine makes a noise it definitely shouldn't, and the car coasts to a halt by the side of the road."
                       game.displaycurrentlocation
                       end
               endif
       ]
}

! ========================================================================================
! Inside your Car
! ========================================================================================

Location inthecar "In the Car" {

       Description "The car is practically a bin on wheels, most of the footwells being filled with
                    various bottles and empty bags."

       OnInput: [

               ' out/leave should get out of the car
               #out
                       printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " gets out of the car."|
                       currentplayer.currentlocation = sidebycar.id
                       game.displaycurrentlocation
               endif

       ]
}

       Item carrubbish "a pile of rubbish" {
               StartsIn inthecar
               Nouns "bottles" "bags" "various" "empty" "footwells" "rubbish"
               Description "Yuck! You really ought to tidy the car when you get home."
               has scenery static

               OnAction: [
                       ;get
                               currentplayer.print "Urgh! What would you do with a load of rubbish?"
                               end
                       endif
               ]

       }

       Item insideyourcar "your car" {
               StartsIn inthecar
               Nouns "car" "my" "your"
               has scenery static
               Description "The car is practically a bin on wheels, most of the footwells being filled with
                            various bottles and empty bags."

               OnAction: [

                       ' Get out of the car, exit/leave car
                       #out
                               currentplayer.print "You get out of the car."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " gets out of the car."|
                               currentplayer.currentlocation = sidebycar.id
                               game.displaycurrentlocation
                               end
                       endif

                       ' Start, turn, or switch on
                       ;start,turn,switch
                               currentplayer.print "You try, but you only hear incessant whine of the starter - the engine doesn't catch."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " attempts to start the engine."|
                               end
                       endif
               ]
       }

       Item backseat "the back seat" {
               StartsIn inthecar
               Nouns "back" "seat"
               Size 2
               has scenery static supporter
       }

               Item adjustablespanner "an adjustable spanner" {
                       StartsIn backseat
                       Nouns "adjustable" "spanner" "tool"
                       Description "A handy tool that will fit any kind of nut."
               }

               Item rubberflashlight "a rubber flashlight" {
                       StartsIn backseat
                       Nouns "rubber" "flashlight" "flash" "light" "torch"
                       Description "A large, heavy duty flashlight with a padded rubber exterior."
                       has lightsource
               }


! ========================================================================================
! Side of the Road By Your Car
! ========================================================================================

Location sidebycar "Side of the Road (by your car)" {

       Description "The road continues north and south. Dense undergrowth barrs the way east, while
                    to the northwest, a winding dirt track leads up a steep hill.
                    <br>
                    <br>At the top of the hill is an enormous gothic house, complete with
                    turrets and crenellations. Many of the windows of the house are lit up.
                    <br>
                    <br>Your car is here, parked in a shallow ditch."
       Nouns "road" "ditch" "undergrowth"
       N_to sidebyothercar
       NW_to windingtrack

       OnDisplay: [

               if ( currentplayer.getvalue(seenhouse) = 0 ) then
                       message(202).show
                       currentplayer.setvalue(seenhouse) = 1
                       end
               endif
       ]

       OnInput: [

               ;go
                       #s
                               message(203).show
                               end
                       endif
               endif
       ]

}

       Item distanthouse "the distant house on the hill" {
               StartsIn sidebycar
               Nouns "house" "gothic" "turrets" "crenellations" "windows" "dirt" "track" "hill" "winding"
               Description "The house appears to be more like a castle than a house. It's
                            difficult to make out much detail from here."
               has scenery static
       }

       Item yourcar "your car" {
               StartsIn sidebycar
               Nouns "car" "my" "your"
               has scenery static
               Description "Your t-rusty Ford - unbelievable that it's let you down once more. Still, some secretly
                            believe that Ford is an acroynm for ~Fix or Repair Daily~."

               OnAction: [

                       #enter
                               currentplayer.print "You get into your car."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " gets into the car."|
                               currentplayer.currentlocation = inthecar.id
                               game.displaycurrentlocation
                       endif
               ]
       }


! ========================================================================================
! Side of the Road By Other Car
! ========================================================================================
Location sidebyothercar "Side of the Road (by other car)" {

       Description "The car is a beautiful Ferrari, and apart from the fact that it is stuck in the ditch,
                    there doesn't seem to be any damage to it. The road continues north and south."
       S_to sidebycar
       Nouns "road" "ditch"

       OnInput: [

               ;go
                       #n
                               message(203).show
                               end
                       endif
               endif
       ]
}

       Item othercar "the Ferarri Testarossa" {
               StartsIn sidebyothercar
               Nouns "other" "car" "ferarri" "testarossa" "window"
               Description "It is a classic Testarossa - immediately identifiable by its resemblance to an aerodynamic
                            door stop. There doesn't seem to be anyone inside the car."

               has scenery static

               OnAction: [

                       ' Trying to get in it
                       #in
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " attempts to get into the Testarossa, but it's locked."|
                               currentplayer.print "It's locked."
                               end
                       endif
                       ;open
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " attempts to get into the Testarossa, but it's locked."|
                               currentplayer.print "It's locked."
                               end
                       endif

                       ' Breaking a window to get in
                       ;smash,break
                               currentplayer.print "Whatever for? It isn't going anywhere and imagine how you'd feel about someone putting <b>your</b> car windows through while you went off somewhere!"
                               end
                       endif
               ]
       }



! ========================================================================================
! Winding Dirt Track upto House
! ========================================================================================
Location windingtrack "Winding Dirt Track" {

       Description "The track leads up a steep north-westerly hill to the house. Dense trees and bushes flank
                    the track. At the bottom of the hill, to the southeast, you can see your car parked by the
                    side of the road."
       Nouns "trees" "bushes"
       SE_to sidebycar
       NW_to frontporch

       OnDisplay: [

               if ( currentplayer.getvalue(closerhouse) = 0 ) then
                       currentplayer.print "<br>The house suddenly appears to be much bigger than it did from the road, looming ominously above you.</br>"
                       currentplayer.setvalue(closerhouse) = 1
                       end
               endif
       ]

}

       Item distanthouse2 "the distant house on the hill" {
               StartsIn windingtrack
               Nouns "house" "gothic" "turrets" "crenellations" "windows" "dirt" "track" "hill" "winding"
               Description "The house appears to be more like a castle than a house. It's
                            difficult to make out much detail from here."
               has scenery static
       }

       Item yourcar2 "your car" {
               StartsIn windingtrack
               Nouns "car" "my" "your"
               has scenery static
               Description "Your car is at the bottom of the hill, parked in a shallow ditch."

               OnAction: [
                       ;examine
                       else
                               currentplayer.print "You cannot reach your car from here."
                       endif
               ]
       }

       Item smallrock "a small rock" {
               StartsIn windingtrack
               Nouns "small" "rock"
               Initial "A small rock sits by the side of the track."
               Description "There doesn't seem to be anything particularly special about the rock - it's
                            just a small rock."

               OnAction: [

                       ;eat
                               currentplayer.print "Not particularly wise if you want to keep your teeth."
                               end
                       endif

                       ' Throwing the stone
                       ;throw
                               ' If we are in the cellar and the monkey is awake, assume that
                               ' is the target if no second noun given
                               if ( input.noun2 = 0 ) then
                                       if ( currentplayer.currentlocation = cellar.id ) and ( guardmonkey.getuserboolean(isawake) = true ) then
                                               currentplayer.print "(at the guard monkey)"
                                               currentplayer.print "The stone arcs through the air and lands neatly on the monkey's helmet, dropping it to the floor unconscious."
                                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " throws a rock at the monkey, hitting it on the helmet and dropping it to the floor, unconscious."|
                                               guardmonkey.removeuserboolean(isawake)
                                               this.currentlocation = currentplayer.currentlocation
                                               call StandardLib.AddScore 8
                                               end
                                       endif
                               endif

                               ' If they have explicitly named a target, do that too
                               if ( input.noun2 = guardmonkey.nounid ) and ( guardmonkey.getuserboolean(isawake) = true ) then
                                       currentplayer.print "The stone arcs through the air and lands neatly on the monkey's helmet, dropping it to the floor unconscious."
                                       printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " throws a rock at the monkey, hitting it on the helmet and dropping it to the floor, unconscious."|
                                       guardmonkey.removeuserboolean(isawake)
                                       this.currentlocation = currentplayer.currentlocation
                                       call StandardLib.AddScore 8
                                       end
                               endif

                               ' Otherwise, just drop the stone
                               currentplayer.print "Thrown."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " throws a rock."|
                               this.currentlocation = currentplayer.currentlocation
                               end

                       endif

               ]
       }


! ========================================================================================
! Front Porch
! ========================================================================================
Location frontporch "Front Porch" {
       Nouns "porch" "rain" "overhang"
       Description "The doors of the house are truly mighty oak affairs some 12 feet high. Thankfully, an
                    overhanging porch keeps the rain out.
                    <br>A path leads east around the front of the house and the track leads southeast back
                    towards your car.
                    <br>Attached to the left door is a knocker, and hanging on the right hand side of the door is an old-fashioned
                    bellpull."

       E_to fronthouse
       SE_to windingtrack
}

       Item frontdoors "the front doors" {
               StartsIn frontporch
               Nouns "front" "door" "doors"
               Description "The doors of the house are truly mighty oak affairs some 12 feet high."
               has static scenery

               OnAction: [
                       ;knock
                               currentplayer.print "You grasp the knocker and give it a good hard shove into the door. It takes a few seconds for the booming echo to fade out, but nothing appears to happen."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " grasps the knocker and gives it a good hard shove into the door. It takes a few seconds for the booming echo to fade out, but nothing appears to happen."|
                               end
                       endif
                       ;open
                               currentplayer.print "The doors are locked."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " attempts to open the front doors, but they are locked."|
                               end
                       endif
                       ;close
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " attempts to close the front doors."|
                               currentplayer.print "The doors are already closed."
                               end
                       endif
               ]
       }

       Item knocker "a door knocker" {
               Nouns "door" "knocker"
               StartsIn frontporch
               has static scenery
       }

       Item bellpull "an old-fashioned bellpull" {
               Nouns "old" "fashioned" "old-fashioned" "bell" "pull" "bellpull"
               StartsIn frontporch
               has static scenery

               OnAction: [
                       ;pull
                               currentplayer.print "There is no sound, perhaps it is broken."
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " pulls the bell-pull, but nothing happens."|
                               end
                       endif
               ]
       }


! ========================================================================================
! Front Of House
! ========================================================================================
Location fronthouse "Front of House" {
       Nouns "path"
       Description "A large, lit window dominates this area of the front wall. An iron fence prevents any
                   further movement to the east, and a path leads west back to the front porch."
       W_to frontporch
}

       Item ironfence "an iron fence" {
               StartsIn fronthouse
               Nouns "iron" "fence" "rail" "railing"
               Description "The fence is about 8 feet high and topped with spikes."
               has scenery static
       }

       Item irondoor "a large iron door, set into the floor" {
               StartsIn fronthouse
               Nouns "large" "iron" "door" "doors" "floor"
               StaticMessage "Surprisingly, you just aren't strong enough."
               has static openable

               OnAction: [

                       ;open
                               if ( this.openclosestate = false ) then

                                       ' If the player hasn't looked through the window yet, draw
                                       ' their attention to it

                                       if ( currentplayer.getvalue(seenfrontwindow) = 0 ) then
                                               currentplayer.print "Just as you are about to open the door, you notice some activity through the window..."
                                               end
                                       endif

                                       currentplayer.print "You open the iron door, revealing a flight of steps leading down into pitch darkness."
                                       printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " opens the iron door, revealing a flight of steps leading down into pitch darkness."|
                                       this.openclosestate = true
                                       fronthouse.D = cellar.id
                                       end
                               else
                                       currentplayer.print "It's already open."
                                       end
                               endif
                       endif

                       ;close
                               if ( this.openclosestate = true ) then
                                       this.openclosestate = false
                                       currentplayer.print "Closed."
                                       printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " closes the iron door."|
                                       fronthouse.D = 0
                                       end
                               else
                                       currentplayer.print "It's already closed."
                                       end
                               endif
                       endif
               ]
       }


       Item litwindow "a large, lit window" {
               Nouns "large" "lit" "window" "front" "wall"
               Description "<br>In the centre of the room, a rhesus monkey has been placed inside a large iron cage. A brief
                            inspection of the monkey reveals that half of its skull is missing and you can quite clearly
                            see its brains. It's difficult to tell at this distance, but it looks like a metal plate has
                            been attached to the exposed area of brain.
                            <br>
                            <br>Various bits of furniture have been piled up around the edge of the room to make way for the
                            <i>real</i> star of the show:
                            <br>
                            <br>An enormous, squat machine sits at the far end of the room. Various buttons and dials festoon
                            the large barrel-like centre section, and a robotic arm comes out of the top towards the cage.
                            The arm culminates in a laser-gun style contraption at the end, complete with mysterious
                            circular rings and a small aperture at its apex."
               StartsIn fronthouse
               has scenery static

               OnAction: [

                       ' Examining or looking through the window

                       ;examine
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " looks through the window."|
                               currentplayer.print "(looking through the large, lit window)"
                               call DBM.ShowPoorMonkey
                               end
                       endif
                       ;look
                               #through,in,into
                                       printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " looks through the window."|
                                       call DBM.ShowPoorMonkey
                                       end
                               endif
                       endif
               ]


       }

! ========================================================================================
! Cellar
! ========================================================================================
Location cellar "Cellar" {
       Nouns "cellar" "pillars" "concrete" "steps" "wooden"
       Description "A spacious, well-used cellar. Stone pillars intersect a clean concrete floor at
                    regular intervals. At the north end, the cellar ends in a short flight of wooden steps
                    with a banister, leading up to a metal door.
                    <br>A further flight of steps to the south leads back up to the outside world."
       U_to fronthouse
       S_to fronthouse
}

       Item laundrychute "a laundry chute" {
               StartsIn cellar
               Nouns "laundry" "chute" "steel"
               Initial "A steel laundry chute juts through the west wall."
               Description "It's dark inside the laundry chute, but you can see that it rises at a very sharp angle."
               StaticMessage "That isn't portable."
               has static

               OnAction: [

                       #in
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " tries to climb into the laundry chute, but the angle is too steep and the inside too polished for them to get a grip."|
                               currentplayer.print "You try to climb into the laundry chute, but the angle is too steep and the inside too polished for you to get a grip."
                               end
                       endif

               ]

       }

       Item laundrycart "a laundry cart" {
               StartsIn cellar
               Nouns "laundry" "cart"
               Description "The laundry cart is on castors."
               Size 2
               Initial "Underneath the laundry chute there is a laundry cart."
               StaticMessage "The cart is too heavy to lift."
               has static container transparent enterable

               OnAction: [

                       ;push,pull
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " tries to push the laundry cart, but the wheels have seized up."|
                               currentplayer.print "The wheels appear to be quite rusty and have seized up."
                               end
                       endif

               ]
       }

       Item washing "a pile of dirty washing" {
               Nouns "dirty" "washing" "clothes" "sheets" "pile"
               Description "Various smelly soiled clothes and sheets."
               StartsIn laundrycart

               OnAction: [

                       ;wear,don
                               currentplayer.print "Are you kidding? Who knows where it's been!"
                               end
                       endif

                       ;smell
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " smells the pile of dirty washing."|
                               currentplayer.print "Yeuck! Smells like a cat's box!"
                               end
                       endif

               ]
       }

       Item workbench "a workbench" {
               Nouns "work" "bench" "workbench"
               StartsIn cellar
               Initial "A large workbench dominates the centre of the room."
               StaticMessage "The workbench is fastened to the floor."
               has static supporter sit stand lay
       }

       Item screwdriver "a screwdriver" {
               Nouns "screw" "driver" "screwdriver"
               StartsIn workbench
       }

       Item metaldoor "a metal door" {
               Nouns "metal" "door"
               StartsIn cellar
               StaticMessage "Don't be ridiculous."
               has static scenery

               OnAction: [

                       ' If the monkey is awake and the player is trying to
                       ' do anything but examine the door, give them the warning.

                       ;examine
                       else
                               if ( guardmonkey.getuserboolean(isawake) = true ) then
                                       printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " tries to approach the metal door, but the monkey snarls and strains at its chain, clawing the air ferociously."|
                                       currentplayer.print "As you approach the monkey, it snarls and strains at its chain, clawing the air ferociously."
                                       end
                               endif
                       endif

                       ' Because the previous lines should make sure the monkey is
                       ' asleep to get here, if the player opens the door, they win!
                       ;open
                               currentplayer.print "Opened."
                               currentplayer.print "<br>"
                               call StandardLib.CustomDeath " You have completed this introduction! "
                               end
                       endif
               ]
       }

       Item guardmonkey "the large monkey wearing a helmet" {
               Nouns "large" "monkey" "helmet" "guard" "guarding"
               Initial "Override Me"
               StaticMessage "I don't think the monkey would care for that."
               StartsIn cellar
               HasUDB isawake
               has static

               OnAction: [

                       ;attack,hit,kick,punch,touch,talk,push,pull,kiss
                               if ( this.getuserboolean(isawake) = true ) then
                                       currentplayer.print "Are you kidding? This crazed animal will kill you!"
                                       end
                               endif
                       endif

                       ;attack,hit,kick,punch
                               printallinexcept currentplayer.currentlocation currentplayer.index |currentplayer.name & " gives the unconscious monkey a good kicking."|
                               currentplayer.print "It seems rather unsporting to kick the monkey when it's down, but since you might not get the opportunity again, what the hell? You quickly set about the unconscious monkey and give it a good seeing to!"
                               end
                       endif

                       ;kiss,touch
                               currentplayer.print "Ugh! You are sick!!"
                               end
                       endif

                       ;examine
                               if ( this.getuserboolean(isawake) = true ) then
                                       currentplayer.print "The monkey is huge and extremely angry-looking. It appears to have a helmet bolted to its skull."
                                       end
                               else
                                       currentplayer.print "The monkey is sleeping peacefully, knocked out cold."
                                       end
                               endif
                       endif

                       end

                       proc before_displayinitial
                               ' Override description according to whether monkey is awake or not
                               if ( this.getuserboolean(isawake) = true ) then
                                       returnvalue = "A large monkey wearing a helmet is chained to the banister, guarding the door."
                                       cancelevent
                                       end
                               else
                                       returnvalue = "An unconscious monkey is chained to the banister."
                                       cancelevent
                                       end
                               endif
                       end
               ]
       }




! Death By Monkey specific code bits

Module DBM {

       proc ShowPoorMonkey

               ' Shows the description of the room through the front window
               ' of the house. If the player hasn't seen it before, the monkey
               ' scene is acted out.

               currentplayer.print litwindow.defaultexamine
               if ( currentplayer.getvalue(seenfrontwindow) = 0 ) then
                       message(205).show
                       currentplayer.setvalue(seenfrontwindow) = 1
                       call StandardLib.AddScore 2
                       end
               endif

       end

}