#!../bin/jacl constant game_title "Tutorial Game" constant game_author "Stuart Allen" constant game_version 1 constant turns_since_last_sip 5 attribute EXAMINED grammar change $integer >change {+change set status_window = $integer write "Status window set to " $integer .^ } location bedroom : master bedroom west bathroom south nowhere {look print: You are in your bedroom. There is a large, soft bed in the centre of the room while a doorway to the west leads into the bathroom. . write "To the south there is " if door has CLOSED write "closed" else write "open" endif write " door.^" } {movement if compass = south if destination = nowhere write "The bedroom door is closed.^" return true endif endif return false } object bed: bed short a "bed" mass scenery {look_under write "VERB: " verb_function ^ if guide(parent) = limbo write "Hidden under the bed you find this week's " write "television guide.^" set guide(parent) = here points 50 return endif write "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 "It contains a listing of this week's programmes.^" } {give_to_rick : show_to_rick print: ~Cool!~ Rick exclaims as he snatches it from your hands.^^ Satisfied that you have achieved at least one thing today, you decide to go back to bed.^ . points 50 execute "+game_over" } object door : bedroom door short the "bedroom door" has CLOSABLE CLOSED {open_override set bedroom(south) = living_room set living_room(north) = bedroom return false } {close_override set bedroom(south) = nowhere set living_room(north) = nowhere return false } location bathroom : bathroom east bedroom {look print: You are in the bathroom. The only exit from here is back east into the bedroom.^ . } {movement if compass = east : compass = out write "You bang your head as you walk through the " write "doorway.^^" return false endif write "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 quantity 20 {close_override write "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 : examine write "The note reads, ~Welcome to Jamaica and have a nice day.~^" } location living_room: living room short the "living room" north nowhere {look if here has VISITED write "You have returned to the living room.^" else print: You are in the living room. There is a small television perched on a low-lying table in front of a sofa. . write "To the north there is " if door has CLOSED write "closed" else write "open" endif write " door.^" endif } {movement if compass = north if destination = nowhere write "The bedroom door is closed.^" return true endif endif return false } {eachturn : *eachturn_bedroom move door to here } object television: television tv tele short a "television" mass scenery {examine if self has EXAMINED write "It's Rick who is the TV addict, not you.^" return endif write "There is currently a cartoon showing on the " write "television.^" ensure self has EXAMINED } {turn_off print: As you reach over and switch off the television, you get quite a shock to see Rick rapidly growing a coat of hair and foaming at the mouth. The shock of this is only surpassed by that of him sinking his newly-acquired fangs into your throat.^ . execute "+game_over" } {turn_on write "The television is already on." } object rick: son boy teenager rick has ANIMATE short name "Rick" long "Rick is here, watching television.^" mass heavy {examine if @ = 1 print: Rick is staring blankly at the television screen.^ . else print: Rick is still gazing into the television's screen.^ . endif } grammar yack to *present >yack_to {yack_to set MENU_MODAL = true execute "+menu_promptabout {+about write "This is the game from the tutorial section of the JACL Author's Guide." write "See the appendix for the full source to this program.^" } integer OFFSET integer INDEX string status_text "temp" integer status_window 3 {+update_status_window style reverse padstring status_text " " status_width write status_text cursor 0 1 write status_text cursor 0 2 write status_text cursor 1 1 write here{The} setstring status_text "Score: " score " Moves: " total_moves set OFFSET = status_width length INDEX status_text set OFFSET - INDEX set OFFSET - 1 cursor OFFSET 1 write status_text style normal } object north_wall: north north wall has NO_TAB short the "north wall" object south_wall: south southern wall has NO_TAB short the "south wall" object east_wall: east eastern wall has NO_TAB short the "east wall" object west_wall: west western wall has NO_TAB short the "west wall" object ground: ground floor has SURFACE NO_TAB short the "ground" #include "utils.library" #include "menu.library" #include "verbs.library"