/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 59)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(use "rev")
(local
silver
navy
red
blue
dyingScript
oldx
oldy
)
/******************************************************************************/
(instance public rm059 of Rm
	(properties
		picture scriptNumber
		north 0
		east 63
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

		(switch(gPreviousRoomNumber)
			(case 54
				(send gEgo:
					posn(30 139)
					loop(1)
				)
			)
   	(case 976
				(send gEgo:
					posn(23 139)
					loop(0)
				)
			)
    	(case 58
     = red FALSE
        (send gEgo:
					posn(178 108)
					loop(2)

				)
			)

       (case 63
				(send gEgo:
					posn(315 139)
					loop(1)
				)
			)
   )
		SetUpEgo()
		(send gEgo:init())
  (aDoor: init())
   = shoot FALSE
  (send gEgo: ignoreControl(ctlYELLOW))
  (aDoor: ignoreControl(ctlWHITE))

	)
)
/******************************************************************************/

(instance RoomScript2 of Script
	(properties)
 (method(changeState newState)
 = state newState
 (switch(state)
 (case 0

 )

 )
 )
 )
(instance RoomScript of Script
	(properties)

    (method (handleEvent pEvent)
(super:handleEvent(pEvent))
         (if(Said('look>'))
(if(Said('/pipe'))
Print("It doesn't look interesting. So you look at it.")
)
(if(Said('/door'))
Print("The big one is closed. And so is the closet one.")
)
(if(Said('/button,keypad'))
Print("This button has no use for you, so it's not worth looking at.")
)
(if(Said('/floor'))
Print("The cleaner around here has done a nice job.")
)
(if(Said('/'))
Print("You're in a hallway. You just got away from Prof. Grankenztein. Phew!")
        )
        )
  (if(Said('close/door'))
  Print("It's already closed.")
  )
  (if(Said('press/button'))
 Print("This button only works on Prof. Grankenztein's voice command.")

  )
  )

 (method(changeState newState)
 = newState 1
 = state newState
 (switch(state)
 (case 1
 (aDoor: hide())
 (send gEgo: ignoreControl(ctlYELLOW))
 )

 )
 )
 (method(doit)
(if(==(send gEgo: onControl()) ctlBLUE)
(if(not(blue))
 = gTimeSeconds2 0
  = blue TRUE
  ProgramControl()
 )
(if(== gTimeSeconds2 2)
= gTimeSeconds2 3
   PlayerControl()
Print("There's nothing to do in the closet, so you step out.")
   (aDoor: loop(0) setCycle(End RoomScript))
   = oldx (send gEgo: x)
   (send gEgo: ignoreControl(ctlYELLOW) setMotion(MoveTo oldx 107))
 )


   )

  (if(==(send gEgo: onControl()) ctlRED)
  (if(not(red))
  = red TRUE
   (aDoor: show())
 (aDoor: loop(1) setCycle(End RoomScript2))
    )
  )
 (if(==(send gEgo: onControl()) ctlNAVY)
 = red FALSE
 = blue FALSE
 (if(not(navy))
 = navy TRUE
 (aDoor: loop(0) setCycle(End RoomScript))
 )
 )
 (if(==(send gEgo: onControl()) ctlBLACK)
 = silver FALSE
 (if(navy)
 = navy FALSE
  (send gEgo: observeControl(ctlYELLOW))
 (aDoor: show())
 (aDoor: loop(1) setCycle(End RoomScript2))

 )
 )
 (if(==(send gEgo: onControl()) ctlSILVER)
 (if(not(silver))
 = silver TRUE
 Print("You don't have to go back to the lab.")
 )
 )
 )
)
(instance aDoor of Act
(properties
view 82
x 181
y 97
)
)
(instance aDoor2 of Act
(properties
view 84
x 34
y 153
)
)
(instance doctor of Act
(properties
view 80
x 13
y 133
)
)
(instance aGuard of Act
(properties
view 128
x 319
y 109
loop 1
))
/******************************************************************************/
