/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 17)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(use "autoDoor")
(local
navy
cyan
)
/******************************************************************************/
(instance public rm017 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

		(switch(gPreviousRoomNumber)
  (case 19
    (send gEgo:
					posn(10 133)
					loop(0)
				)

			)

  (case 16
   (send gEgo:init())
                (send gTheMusic:
			prevSignal(0)
			stop()
			number(5)
			loop(-1)
			play()
		)
				(send gEgo:
					posn(175 114)
					loop(2)
				)

    )
     (case 25

   (send gEgo:init())

				(send gEgo:
					posn(175 114)
					loop(2)
				)

    )
    (default

   (send gEgo:init())

				(send gEgo:
					posn(175 114)
					loop(2)
				)

    )
    (case 18
    (send gEgo:
					posn(280 114)
					loop(2)
				)

			)
		)

		SetUpEgo()
		(send gEgo:init())
  (liftDoor: init())
  (aDoor: init())
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
      (method (changeState newState)
  = state newState
  (switch (state)
    (case 0
= cycles 1


    )
    (case 1
    (liftDoor: hide())
    )
    )
    )
        (method (handleEvent pEvent)
   (super:handleEvent(pEvent))
     (if(Said('open/automatic<door'))
Print("That's why it's called automatic door, so you wouldn't have to open it yourself. Just walk near to the door.")
)
  (if(Said('use/elevator'))
Print("You have to press the button next to the elevator doors to call up the lift, and then you can use it.")
)
   (if(Said('press,call,use/(call<button),elevator,button'))
   (if(==(send gEgo: onControl()) ctlRED)
   Wait(5)
   (liftDoor: setCycle(End RoomScript))
   return
   )
   Print("You can't reach the button from here.")
   )
      (if(Said('look>'))
            (if(Said('/lift,elevator'))
            Print("This is the main elevator. It goes way up.")
            )
            (if(Said('/door,(automatic<door)'))
            Print("This leads to another room. I seems to be an automatic door.")
            )
            (if(Said('/button,(call<button)'))
            Print("This is the elevator call-button.")
            )
            (if(Said('/doorway'))
            Print("You're not pretty sure where it leads.")
            )
            (if(Said('/wall'))
            Print("Plain coloured stone walls. There's a button on the wall.")
            )
            (if(Said('/floor'))
            Print("Regular rocket base floor. Hard concrete.")
               )
            (if(Said('/ceiling'))
            Print("Regular rocket base ceiling with some black dots on it (Fly poo). Even harder concrete.")
           )
            (if(Said('/'))
            Print("After using the elevator you reached some underground hall. There's a door and a doorway to the left. Also there is an elevator with a small button next to it.")

        )
        )
   
   )
 (method(doit)
   (if(==(send gEgo: onControl()) ctlCYAN)
   (if(not(onCyan))
   Print("After some walking down the corridor you reach some kind of a control room...")
   (send gRoom: newRoom(19))
   = onCyan TRUE
   return
   )
   (send gRoom: newRoom(19))

   )
  (if(==(send gEgo: onControl()) ctlBLACK)
 = navy FALSE
 = cyan FALSE
 )
 (if(==(send gEgo: onControl()) ctlBLUE)
 (if(not(navy))
 = navy TRUE
 (liftDoor: show())
 (liftDoor: loop(1) setCycle(End))
(if(roofOpen)
Print("You drive straight to the club.")
 (send gRoom: newRoom(25))
return
)
 (send gRoom: newRoom(16))
 )

 )
 )
)
(instance liftDoor of Prop
(properties
view 39
x 175
y 110
))
(instance aDoor of AutoDoor
(properties
view 73
x 280
y 111
entranceTo 18
))
/******************************************************************************/
