#!/usr/local/jacl-1.5/bin/jacl
   #                                                            
   # -----------------------------------------------------------
   # Copyright (C) Stuart Allen 1999-2000. All rights resevered.
   # -----------------------------------------------------------
   
   prefix	TUTORIAL-
   
   location bedroom : master bedroom
    west		bathroom
    south		living_room
   
   {look
   write "<P>You are in your bedroom. There is a large, soft bed "
   write "in the centre of the room while a doorway to the "
   write "west leads into the bathroom.^"
   }
   
   object bed: bed
     short		a "bed"
     mass		scenery
   
   {look_under
   if guide(parent) = limbo
      write "<P>Hidden under the bed you find this week's "
      write "television guide.^"
      set guide(parent) = here
      points 50
      break
   endif
   write "<P>You don't find anything else.^"
   }
   
   object guide: television tv tele guide
     short		a "television guide"
     long		"The television guide is here."
     parent		limbo
     mass		5
   
   {examine : read
   write "<P>It contains a listing of this week's programmes.^"
   }
   
   {give_to_rick : show_to_rick
   write "<P>~Cool!~ Rick exclaims as he snatches it from your "
   write "hands.^"
   write "<P>Satisfied that you have achieved at least one thing "
   write "today, you decide to go back to bed.^"
   points 50
   execute +game_over
   }
   
   location bathroom : bathroom
    east		bedroom
   
   {look
   write "<P>You are in the bathroom. The only exit from here "
   write "is back east into the bedroom.^"
   }
   
   {movement
   if COMPASS = EAST : COMPASS = OUT
      write "<P>You bang your head as you walk through the "
      write "doorway.^^"
      break false
   endif
   write "<P>The only exit from here is to the east.^"
   }
   
   object box: small wooden box
     has		CONTAINER CLOSABLE CLOSED
     short		a "small wooden box"
     long		"There is a small wooden box here."
     mass		25
     capacity		20
   
   {close_override
   write "<P>The lid creaks as you push it closed.^"
   ensure box has CLOSED
   }
   
   object note: orange note
     short		an "orange note"
     long		"An orange note rests on the ground."
     parent 		box
     mass		5
   
   {read
   write "<P>Welcome to Jamaica and have a nice day.^"
   }
   
   location living_room: living room
     short		the "living room"
     north		bedroom
   
   {look
   if here has VISITED
      write "<P>You have returned to the living room.^"
   else
      write "<P>You are in the living room. There is a small "
      write "television perched on a low-lying table in front "
      write "of a sofa.^"
   endif
   }
   
   {eachturn
   set rick(status) + 1
   if rick(status) = 5
      write "<P>Rick takes a sip from his drink.^"
      set rick(status) = 0
   endif
   }
   
   object television: television tv tele
     short		a "television"
     mass		scenery
   
   {examine
   write "<P>There is currently a cartoon showing on the "
   write "television.^"
   }
   
   {turn_off
   write "<P>As you reach over and switch off the television, "
   write "you get quite a shock to see Rick rapidly growing "
   write "a coat of hair and foaming at the mouth. The shock "
   write "of this is only surpassed by that of him sinking "
   write "his newly acquired fangs into your throat.^"
   execute +game_over
   }
   
   object rick: son boy teenager rick
     has		ANIMATE
     short		name "Rick"
     long		"Rick is here, watching television."
     mass		heavy
   
   {examine
   write "<P>Rick is staring blankly at the television screen.^"
   }
   
   {talk_to
   write "<P>~Uh, yeah, I'll do it in a minute,~ Rick mumbles "
   write "with out looking up. You have quite a strong "
   write "suspicion that he didn't really hear a word "
   write "you said.^"
   }
   
   ;-----------------
   ; Global functions
   ;-----------------
   
   {+header
   write "Content-type: text/html^^"
   write "<HTML><HEAD>
   write "<TITLE>Tutorial Game</TITLE>"
   write "</HEAD><BODY>"
   write "<FORM NAME=~GameForm~ METHOD=get ACTION=~" url "~>"
   }
   
   {+footer
   write "<HR>"
   write "<CENTER>"
   prompt
   execute "+score"
   write "</CENTER>"
   write "</FORM>"
   write "</BODY></HTML>"
   }
   
   {+default_ask_about
   if noun1 = rick
      write "<P>Rick blinks several times then pokes out his "
      write "bottom lip. This, you have figured out over the "
      write "years, translates to, ~Not a clue.~^"
      break
   endif
   break false
   }
   
   {+intro
   set GAME_VERSION = 1
   centre "<H1>TUTORIAL GAME</H1>"
   centre "by I.F. Author"
   write "<P>Your alarm rings and you climb out of bed. "
   write "Monday morning again so soon. Oh well, at least "
   write "your house doesn't have a front door so you have "
   write "a good excuse for not going to work.^^"
   if here hasnt OUTDOORS
     set north_wall(parent) = here
     set south_wall(parent) = here
     set east_wall(parent) = here
     set west_wall(parent) = here
   endif
   set ground(parent) = here
   look
   }
   
   object kryten: myself self me
    has		ANIMATE
    short		name "yourself"
    capacity		42
    parent		bedroom
    player
   
   {examine
   write "<P>As beautiful as ever.^^"
   execute "+inventory"
   }
   
   grammar about >about
   
   {+about
   write "This is the game from the tutorial "
   write "section of the JACL Author's Guide. See the "
   write "appendix for the full source to this program.^"
   }