REM ********************** 1: Initialise stores, etc. *************************
REM **** Player has no light source
LET Store%(0)=0
LET Store%(20)=0
REM **** Weight limit and weight carried
LET Store%(1)=100
LET Store%(2)=0
REM **** Player start location
LET Store%(3)=2
REM ********************** 2: Describe location *******************************
:movement_loop
CLS
:look_loop
LOOK
REM ********************** 3: Conditions 1 ************************************
REM **** is player in desert?
IF Store%(3)=1 THEN GOTO game_won
REM **** is player in trap?
IF Store%(3)>=29 THEN GOTO game_over
REM **** comment on hole in 9
IF Store%(3)=9 AND North%(9)=0 THEN PRINT " There is a small hole in the floor near the base of the North wall."
REM **** has player taken diamond from room 13 to room 9?
IF Store%(3)=9 AND Location%(3)=0 THEN
PRINT " You can feel warmth coming from the diamond you carry. Looking down at it, you can see that it is beginning to glow. A mist forms in the air around you, and you begin to find yourself struggling more and more for each breath."''
PRINT "As the moment of death approaches you hear a deep voice in your head, saying 'You have removed the Chameleon Crystal from the Death Chamber of Atstulis. You must be punished with death...."''
PRINT " The diamond is ripped from your clutch and flies into the chamber to the North, just as you lose consciousness..."''
GOTO game_over
END IF
REM **** If player has moved North to 16, roof must collapse South
IF Store%(3)=16 AND North%(11)=16 THEN
PRINT " The roof of the passage to the South collapses, blocking your exit in that direction."
LET North%(11)=0
LET South%(16)=0
END IF
REM **** If player has passed through secret door from 15 to 10, door must close
IF Store%(3)=10 AND East%(15)=10 THEN
PRINT " The secret door through which you have just come closes with such force that the whole pyramid shakes. There is no longer an exit West."
LET East%(15)=0
LET West%(10)=0
END IF
REM **** If player at 21/25 secret door at 24 closes (if open)
IF (Store%(3)=21 OR Store%(3)=25) AND North%(24)=27 THEN
PRINT " The secret door in the section of passage you have just left closes, causing the whole pyramid to shudder."
LET North%(24)=0
LET South%(27)=0
END IF
REM **** If player at 21/17 secret door at 28 closes (if open)
IF (Store%(3)=21 OR Store%(3)=17) AND West%(28)=26 THEN
PRINT " The secret door in the section of passage you have just left closes, causing the whole pyramid to shudder."
LET West%(28)=0
LET East%(26)=0
END IF
REM **** start a new line after location descriptions
PRINT '
REM ********************** 4: Player input ************************************
:dummyloop
:input_loop
INPUT
IF FNSaid("QUIT") THEN
QUIT
GOTO input_loop
END IF
REM **** increment counter. when this reaches 8, players eyes will be adjusted
REM to the dark if he/she can't see.
LET Store%(20)=Store%(20)+1
REM ********************** 5: Conditions 2 ************************************
REM **** check if player's eyes adjusted to the dark.
IF Store%(20)=8 AND Store%(0)=0 THEN
PRINT '"Your eyes begin to adjust to the darkness. In the gloom you can see only shadows at first, but they soon become solid shapes."''"You are now able to see!!"'
LET Store%(0)=1
END IF
REM **** commands that Trellis can deal with 100% automatically
IF FNSaid("EAST") OR FNSaid("WEST") OR FNSaid("UP") THEN GOTO process_command
IF FNSaid("DOWN") OR FNSaid("INV") THEN GOTO process_command
REM **** at 7, walk North through waterfall
IF Store%(3)=7 AND FNSaid("NORTH") THEN
PRINT "You walk into the waterfall and find that there is no wall beyond it. You pass through into another passage."'
LET Store%(3)=9
GOTO look_loop
END IF
IF FNSaid("NORTH") THEN GOTO process_command
REM **** at 9, walk South through waterfall
IF Store%(3)=9 AND FNSaid("SOUTH") THEN
PRINT "You walk into the waterfall and find that there is no wall beyond it. You pass through into another passage."'
LET Store%(3)=7
GOTO look_loop
END IF
IF FNSaid("SOUTH") THEN GOTO process_command
REM **** player asks for help
IF FNSaid("HELP") THEN GOTO help
REM **** if player says look, jump to look_loop (makes mentioning hole in room
REM 9 occur after player walks through waterfall.)
IF FNSaid("LOOK") THEN GOTO look_loop
REM **** player says wait - do nothing
IF FNSaid("WAIT") THEN
PRINT "You wait. Nothing happens."'
GOTO input_loop
END IF
REM **** at 9, player examines hole
IF FNSaid("EXAMINE") AND FNSaid("HOLE") AND Store%(3)=9 THEN
IF North%(9)=0 THEN PRINT "The hole is about two inches in diameter. "
IF Location%(5)=0 THEN PRINT "It is just the right size for the ruby."
IF North%(9)=13 THEN PRINT "The ruby has been placed in the hole."
PRINT '
GOTO input_loop
END IF
REM **** at 2, put orb on pedestal to open exit door
IF (FNSaid("DROP") OR FNSaid("PUT")) AND FNSaid("ORB") AND FNSaid("PEDESTAL") THEN
IF Store%(3)<>2 OR Location%(2)<>0 THEN GOTO you_cant
DROP ORB
LET South%(2)=1
LET North%(1)=2
PRINT "The heavy stone door to the South opens. From beyond, you can see a clear blue sky. The Sun is beating down on the yellow sands of the desert."'
LET Room$(2)="You are in a passage. It is light here, due to the sunlight shining in through the door to the South, beyond which lies the desert."
GOTO input_loop
END IF
REM **** at 2, take orb from pedestal to close exit door
IF FNSaid("GET") AND FNSaid("ORB") AND Location%(2)=2 AND Store%(3)=1 THEN
GET ORB
IF South%(2)=0 THEN GOTO input_loop
PRINT "The stone door to the South closes very quickly and with such force that the walls and floor around you shake. The sudden change from light to dark leaves you unable to see."'
LET Room$(2)="You are in a passage. It is very dark, but your eyes are suitably adjusted for you to see. The walls are a rough cut stone, and the passage is high and wide."
LET Store%(20)=0
LET Store%(0)=0
LET South%(2)=0
LET North%(1)=0
GOTO input_loop
END IF
REM **** at 9, put ruby in hole to open door
IF (FNSaid("DROP") OR FNSaid("PUT")) AND FNSaid("RUBY") AND FNSaid("HOLE") THEN
IF Store%(3)<>9 AND Location%(5)<>0 THEN GOTO you_cant
DROP RUBY
LET North%(9)=13
LET South%(13)=9
PRINT "You hear the sound of stone scraping against stone, as a stone door swings open to the North."'
GOTO input_loop
END IF
REM **** at 9, get ruby from hole to close door
IF FNSaid("GET") AND FNSaid("RUBY") AND Location%(5)=9 AND Store%(3)=9 THEN
GET RUBY
LET North%(9)=0
LET South%(13)=0
PRINT "You hear the sound of stone scraping against stone, as a stone door swings closed to the North."'
GOTO input_loop
END IF
REM **** Dip sword in wrong pool (at 27) - lose sword
IF Store%(3)=27 AND FNSaid("DIP") AND FNSaid("SWORD") AND FNSaid("WATER") THEN
IF Location%(8)<>0 THEN GOTO you_cant
PRINT "Okay."'
PRINT "The sword gets wet. When you lift it out of the pool, the sword starts to melt. Dripping into the pool, the sword turns to water. Soon, nothing remains of it."'
LET Location%(8)=-1
GOTO input_loop
END IF
REM **** Dip sword in right pool (at 26) - enchant sword
IF Store%(3)=26 AND FNSaid("DIP") AND FNSaid("SWORD") AND FNSaid("WATER") THEN
IF Location%(8)<>0 THEN GOTO you_cant
PRINT "Okay."'
IF List$(8)="an enchanted sword" THEN GOTO input_loop
PRINT "The sword gets wet. When you lift it out of the pool, you realise it seems to weigh much less than before. The hilt seems to change shape to suit your hand, and something in your head tells you that it is now enchanted."'
LET List$(8)="an enchanted sword"
LET Examine$(8)="Though big, the sword is very light. The jewel studded hilt is just the right size and shape to fit comfortably in your hand. Something in your mind tells you that the sword is enchanted."
GOTO input_loop
END IF
REM **** Drink water at 7,9,26,27 - all water in Pyramid is poisonous
IF FNSaid("DRINK") AND FNSaid("WATER") THEN
IF Store%(3)<>9 AND Store%(3)<>13 AND Store%(3)<>26 AND Store%(3)<>27 THEN GOTO you_cant
PRINT "Okay."'"The water tastes cool and fresh."'"Suddenly, you find yourself without breath. You collapse to the floor, choking, and soon lose consciousness...."'(
GOTO game_over
END IF
REM **** Take ruby at 14
IF FNSaid("GET") AND FNSaid("RUBY") AND Store%(3)=14 AND Location%(5)=14 THEN
IF Location%(6)=-1 THEN GOTO process_command
PRINT "As you go to take the ruby, the ghoul lets out an ear splitting wail. The air around the ruby freezes, and you have to pull your hand back sharply."'
GOTO input_loop
END IF
REM **** Fight ghoul at 14 (go to routine in section 10 to win or lose)
IF FNSaid("FIGHT") AND FNSaid("GHOUL") AND Store%(3)=Location%(6) THEN
IF Location%(8)=0 AND List$(8)="an enchanted sword" THEN GOTO win_fight
GOTO lose_fight
END IF
REM **** Read text at 10
IF (FNSaid("READ") OR FNSaid("EXAMINE")) AND FNSaid("TEXT") AND Store%(3)=10 THEN
PRINT "The marks on the wall appear to have been put there by someone else who was once trapped in the Pyramid. It says:"
PRINT " 'To all who follow me. I know now how to escape from this tomb but, alas, it is too late for me for I am weak and dying. The waterfall is a door. To the North, beyond it is the Burial Chamber of Atstulis."
PRINT " In the chamber is an Orb. Take this, and place it on the pedestal in the entrance passage and you will be free. The chamber itself is locked. You will need the key to open it, a ruby."
PRINT " That, however, is protected by an evil ghoul. You need an enchanted weapon to destroy it. If you have a weapon, dip it in the holy pool to enchant it. I wish you the luck that wasn't with me.'"'
GOTO input_loop
END IF
REM **** Take staff at 15 to open door to 10
IF FNSaid("TAKE") AND FNSaid("STAFF") AND Store%(3)=15 AND East%(15)=0 THEN
PRINT "You are unable to take the staff, but in trying you trigger a mechanism that opens a secret door leading East."'
LET East%(15)=10
LET West%(10)=15
GOTO input_loop
END IF
REM **** Take staff at 15 to close door to 10
IF FNSaid("TAKE") AND FNSaid("STAFF") AND Store%(3)=15 AND East%(15)=10 THEN
PRINT "You are unable to take the staff, but in trying you trigger a mechanism that closes the door leading East."'
LET East%(15)=0
LET West%(10)=0
GOTO input_loop
END IF
REM **** Stand on slab at 28 to open door to 26
IF FNSaid("STAND") AND FNSaid("SLAB") AND Store%(3)=28 AND West%(28)=0 THEN
PRINT "You hear a loud scraping noise, like stone moving against stone, and a heavy stone door opens to reveal another exit."'
LET West%(28)=26
LET East%(26)=28
GOTO input_loop
END IF
REM **** Stand on slab at 24 to open door to 27
IF FNSaid("STAND") AND FNSaid("SLAB") AND Store%(3)=24 AND North%(24)=0 THEN
PRINT "You hear a loud scraping noise, like stone moving against stone, and a heavy stone door opens to reveal another exit."'
LET North%(24)=27
LET South%(27)=24
GOTO input_loop
END IF
REM ********************** 6: Act on player input *****************************
:process_command
COMMAND
REM ********************** 7: Loop ********************************************
IF Moved% THEN GOTO movement_loop
GOTO input_loop
REM ********************** 8: End game ****************************************
:game_won
PRINT '''"Congratulations."'''
GOTO end_game
:game_over
PRINT '''"Hard luck."'''
:end_game
RESTART
REM ********************** 9: Routines ****************************************
REM **** player fights ghoul and wins
:win_fight
PRINT '"You attack the ghoul with your sword. Normally, this would be a fruitless effort, since the ghoul does not physically exist in this world, and the sword would just slice through the air as if there were nothing there."
PRINT " However, because the sword is enchanted you are somehow able to strike the spirit again and again, weakening it more and more with each blow. Eventually the ghoul vanishes with a shriek. You have defeated it."'
LET Location%(6)=-1
GOTO input_loop
REM **** player fights ghoul and loses
:lose_fight
IF Location%(8)=0 THEN
PRINT '"You attack the ghoul with your sword. This turns out to be a fruitless effort as the ghoul does not physically exist in this world, and the sword is just cutting through the air with nothing to land home on."
ELSE
PRINT '"You attack the ghoul with your fists. This turns out to be a fruitless effort as the ghoul does not physically exist in this world, and you are just punching the air."
END IF
PRINT " The ghoul is angered by your attack, and opens it's arms. You feel a sudden, freezing cold wind which makes you shudder. The wind doesn't stop, and you can see your hands turning blue as you shiver uncontrollably."
PRINT '"You fall to your knees as the wind becomes stronger and colder, and then onto your side. The last thing you remember before you black out is an evil laugh that seems to be coming from inside your head..."
GOTO game_over
REM **** help routine
:help
REM **** tell player to wait for eyes to adjust to dark, if need be.
IF Store%(0)=0 THEN
PRINT '"Obviously, you will need to be able to see. I therefore suggest that you wait for your eyes to adjust to the dark."'
GOTO input_loop
END IF
REM **** Check for other words with help command, ie player wants specific help.
REM The player can only have help with something seen or carried.
REM **** Help with Pedestal
IF FNSaid("PEDESTAL") AND Store%(3)=2 THEN
PRINT "The pedestal should have an orb on it."'
GOTO input_loop
END IF
REM **** Help with Orb
IF FNSaid("ORB") AND (Location%(2)=Store%(3) OR Location%(2)=0) THEN
PRINT "The orb must be placed on a pedestal."'
GOTO input_loop
END IF
REM **** Help with diamond
IF FNSaid("DIAMOND") AND (Location%(3)=Store%(3) OR Location%(3)=0) THEN
PRINT "The diamond must remain in the burial chamber of Atstulis."'
GOTO input_loop
END IF
REM **** Help with Ruby
IF FNSaid("RUBY") AND (Location%(5)=Store%(3) OR Location%(5)=0) THEN
PRINT "The ruby must is the key to the burial chamber of Atstulis."'
GOTO input_loop
END IF
REM **** Help with ghoul
IF FNSaid("GHOUL") AND Location%(6)=Store%(3) THEN
PRINT "The ghoul must be killed with an enchanted weapon."'
GOTO input_loop
END IF
REM **** Help with statue
IF FNSaid("STATUE") AND Store%(3)=15 AND East%(15)=0 THEN
PRINT "The staff is the key to a secret door."'
GOTO input_loop
END IF
REM **** Help with sword
IF FNSaid("SWORD") AND (Location%(8)=Store%(3) OR Location%(8)=0) AND List$(8)="a sword" THEN
PRINT "The sword must be dipped in holy water."'
GOTO input_loop
END IF
REM **** Help with hole
IF FNSaid("HOLE") AND Store%(3)=9 THEN
PRINT "The hole was made for a ruby. It is a keyhole."'
GOTO input_loop
END IF
REM **** Help with water
IF FNSaid("WATER") THEN
IF Store%(3)=7 OR Store%(3)=9 THEN PRINT "The artificial waterfall is a doorway."'
IF Store%(3)=26 THEN PRINT "The water in the pool is holy water."'
IF Store%(3)=27 THEN PRINT "The water in the pool is unholy water."'
IF Store%(3)=7 OR Store%(3)=9 OR Store%(3)=26 OR Store%(3)=27 THEN GOTO input_loop
END IF
REM **** help with slabs (slabs not entered by player - location checked instead)
IF Store%(3)=24 OR Store%(3)=28 THEN
PRINT "The slab is a key to a secret door. It is opened with weight."'
GOTO input_loop
END IF
REM **** tell player there are clues within the game. Display location number
REM to aid mapping.
PRINT '"There is a major clue somewhere in the game. It tells you most of what you need to know, the rest you must work out for yourself. What I can do is help you to map the pyramid by telling you that you are in location "[Store%(3)]'
GOTO input_loop
REM **** player entered command that cant be carried out.