/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 118)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(local
over
yyy
prevCol
// 1 navy, 2 blue, 3 red, 4 yellow
)
/******************************************************************************/
(instance public rm118 of Rm
	(properties
		picture scriptNumber
		north 0
		east 116
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

		(switch(gPreviousRoomNumber)
			(default
				(send gEgo:
					posn(315 125)
					loop(1)
				)
			)
   (case 116
				(send gEgo:
					posn(315 125)
					loop(1)
				)
			)
     (case 119
				(send gEgo:
					posn(5 125)
					loop(0)
				)
			)
    (case 123
				(send gEgo:
					posn(5 125)
					loop(0)
				)
			)
		)

		SetUpEgo()
		(send gEgo:init())
  = prevCol 0

       (send gTheMusic:
			prevSignal(0)
			stop()
			number(40)
			loop(-1)
			play()
		)
  )

)
/******************************************************************************/
(instance RoomScript of Script
	(properties)

   (method (handleEvent pEvent)
   (super:handleEvent(pEvent))
  (if(Said('look>'))
(if(Said('/door,doorway'))
Print("It leads to another room.")
)
(if(Said('/floor'))
Print("There are 16 large red slabs on the floor. There are Roman numerals on them.")
)
(if(Said('/plates,stone'))
Print("All these slabs have Roman numerals on them.")
)
(if(Said('/numbers,(roman<numbers)'))
Print("The first row from the top: \n2  8  15  0")
Print("The second row from the top: \n9  11  3  13")
Print("The second row from the top: \n5  6  12  7")
Print("The last row from the top: \n10  14  4  16")
Print("There has to be some connection/logic with these numbers. I recomend writing down those numbers to have a better grasp.")
)
(if(Said('/marking,markings'))
Print("The first row from the top: \n2  8  15  0")
Print("The second row from the top: \n9  11  3  13")
Print("The second row from the top: \n5  6  12  7")
Print("The last row from the top: \n10  14  4  16")
Print("There has to be some connection/logic with these numbers. I recomend writing down those numbers to have a better grasp.")
)
(if(Said('/wall'))
Print("There are some scratches on the wall. Not important.")
)
(if(Said('/'))
Print("It seems like you are reaching the end of the maze. There are many large stone slabs on the floor.")
)
)


  )
(method(changeState newState)
  (var dyingScript)
 = state newState
 (switch(state)
 (case 0
 )
 (case 1
    (send gEgo: hide())
   (aHole: setMotion(MoveTo (send gEgo: x) yyy RoomScript))
    )
    (case 2
   ShakeScreen(8 ssFULL_SHAKE)


   (send gEgo: hide())
      = dyingScript ScriptID(DYING_SCRIPT)
  (send dyingScript:
    caller(3)
    register("You're flatter than a flat pancake.")
  )
  (send gGame:setScript(dyingScript))
 )
 )
 )
 (method(doit)
    (if(==(send gEgo: onControl()) ctlGREEN)
    (if(== prevCol 10)
    (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
    return
    )
    (if(bridgeDown)
        (send gRoom: newRoom(123))
        return
        )
          (send gRoom: newRoom(119))
          return
        )
 
    (if(==(send gEgo: onControl()) ctlBLACK)
    = prevCol 0
    )

       (if(==(send gEgo: onControl()) ctlGREY)
        (if(== prevCol 10)
    (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
    return
    )
       
       (if(not(ggg))
       += gScore 2
       (send gEgo: put(INV_EMPTY_BOTTLE))
       = ggg TRUE
         )
       )
   (if(==(send gEgo: onControl()) ctlSILVER)
   (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
   )
   
   
  (if(==(send gEgo: onControl()) ctlNAVY)
  (if(== prevCol 0)
  = prevCol 1
  return
  )
  (if(== prevCol 10)
 (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
   )
   )
     (if(==(send gEgo: onControl()) ctlRED)
  (if(== prevCol 2)
  = prevCol 3
  return
  )
  (if(== prevCol 10)
 (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
   )
   )
     (if(==(send gEgo: onControl()) ctlYELLOW)
  (if(== prevCol 3)
  = prevCol 4
  return
  )
  (if(== prevCol 10)
 (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
   )
   )
    (if(==(send gEgo: onControl()) ctlBLUE)
  (if(== prevCol 1)
  = prevCol 2
  return
  )
  (if(== prevCol 10)
 (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
   )
   )
     (if(==(send gEgo: onControl()) ctlCYAN)
     (if(== prevCol 0)
     (if(not(over))
 (aHole: ignoreControl(ctlWHITE)) ProgramControl()
 = over TRUE
 = yyy (send gEgo: y)
-= yyy 2
 (send gGame: setSpeed(0)) (aHole: init() posn((send gEgo: x) 0) setMotion(MoveTo (send gEgo: x) yyy RoomScript))
   return
   )
     )
     = prevCol 10
     
     )
   )


)
(instance aHole of Act
(properties
view 101
x 1
y 1
))
/******************************************************************************/
