#!../bin/jacl
constant game_title "Tutorial Game"
constant game_author "Stuart Allen"
constant game_version 1
constant ifid "JACL-141"
constant game_publish true
constant turns_since_last_sip 9
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 a "
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
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_prompt<talk_to_rick"
}
{talk_to
execute "+menu_clear_options"
execute "+menu_add_option<Ask Rick about the television.<ask rick about television"
if guide(parent) != limbo
execute "+menu_add_option<Tell Rick you found the TV guide.<tell rick about guide"
endif
if @tell_about_kryten_rick = false
execute "+menu_add_option<Tell Rick your life story.<tell rick about myself"
endif
execute "+menu_add_option<Ask Rick how he is going.<ask rick about rick"
}
{tell_about_guide
print:
~Oh, you found it, great. Give it to me!~ Rick exclaims.^
.
}
{tell_about_kryten
print:
Rick starts to nod off as you tell him all about your early childhood.^
.
}
{ask_about_rick
print:
~My life is all but ruined until you find the TV guide.~^
.
}
{ask_about_television
print:
~It could be bigger,~ Rick says with a sigh.^
.
}
{talk_to
print:
~Uh, yeah, I'll do it in a minute,~ Rick mumbles
without looking up. You have quite a strong
suspicion that he didn't really hear a word
you said.^
.
}
object sofa : sofa
short a "sofa"
has NOT_IMPORTANT
#-----------------------------------------------------------------------------
# GLOBAL FUNCTIONS
#-----------------------------------------------------------------------------
{+eachturn
set rick(turns_since_last_sip) + 1
if rick(turns_since_last_sip) = 5
if here = living_room
write "Rick takes a sip from his drink.^"
endif
set rick(turns_since_last_sip) = 0
endif
}
{+default_ask_about
if noun1 = rick
print:
Rick pokes out his bottom lip then blinks several
times. This, you have figured out over the
years, translates to, ~Not a clue.~^
.
return
endif
return false
}
{+intro
style bold
write "^^" game_title
style normal
write " by " game_author "^^"
print:
Your alarm rings and you climb out of bed.
Monday morning again so soon. Oh well, at least
your house doesn't have a front door so you have
a good excuse for not going to work.^^
.
if here hasnt OUTDOORS
move north_wall to here
move south_wall to here
move east_wall to here
move west_wall to here
endif
set ground(parent) = here
look
}
{+movement
ifall destination != nowhere : destination hasnt OUTDOORS
move north_wall to destination
move south_wall to destination
move east_wall to destination
move west_wall to destination
endif
return false
}
object kryten: myself self me
has ANIMATE
short name "yourself"
quantity 42
parent bedroom
player
{examine
write "As beautiful as ever.^"
execute "+inventory"
}
grammar about >about
{+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
execute "+reverse_window"
style reverse
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
}
parameter TEST kryten(status) 1 4
parameter PASSWORD password
integer INDEX
string password
grammar form >form
{+form
write "STATUS: " kryten(status) ^
write "PASSWORD: " password ^
write "<hr>"
write "<form>"
hidden
set INDEX = 1
repeat
write "<input type=radio name=TEST value=~" INDEX ~
if INDEX = kryten(status)
write " checked"
endif
write ">" INDEX
set INDEX + 1
write "^"
until INDEX = 5
write "<p><input type=~password~ name=~PASSWORD~>^"
write "<input type=~submit~ name=~command~ value=~processform~>"
write "</form>^"
}
grammar processform >processform
{+processform
write "Updating user file to now use ~" password "~.^"
}
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"
Back to Contents