/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 54)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(local
deadOver2
dyingScript
oldVol
)
/******************************************************************************/
(instance public rm054 of Rm
	(properties
		picture 55
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

		(switch(gPreviousRoomNumber)
			(default
				(send gEgo:
					posn(238 111)
					loop(1)
				)
			)
		)

	//	SetUpEgo()
	//	(send gEgo:init())
  (egoLie: init() loop(0))
  ProgramControl()
  (doctor: init())
  (aPhone: init())

  //= escape TRUE

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

(instance RoomScript of Script
	(properties)
(method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if(Said('look'))
Print("No time to look around. Just get rid of these ropes and go!!")
        )
(if(Said('cut,use,release/rope,hand,knife/knife,rope'))
Print("Ok. This might work...")
Print("You've managed to free your hands and legs. Now go!")
+= gScore 4
= freeStand TRUE
(egoLie: hide())
ProgramControl()
(send gEgo: init() cycleSpeed(0) moveSpeed(0) posn(224 123) setMotion(MoveTo 242 97))
DrawPic(54)
)
(if(Said('cut,release/rope,hand'))
Print("Yeah. But with what?")
)
(if(Said('use/knife'))
Print("On what?")
)
)

 (method(changeState newState)
 = state newState
 (switch(state)
 (case 0
 = cycles 1
 (aPhone: loop(1) setCycle(Fwd))
 DoSound(sndVOLUME 6)
 (send gTheSoundFX:
prevSignal(0)
stop()
number(20)
loop(-1)
play())
 (aE: init() setMotion(MoveTo 75 1 RoomScript))
     )
 (case 1
 Print("... nah, zhe phone iz ringing!" #title "Prof. Grankenztein:" #icon 778 0 0)
  (doctor: setCycle(Walk) cycleSpeed(1) moveSpeed(1) setMotion(MoveTo 67 108 RoomScript))
       )
 (case 2
 Print("This is your chance to escape. Figure out something, but be quick! The phone call won't last forever." #title"Hurry!")
 Print("Hint: Sharp ideas could help you out." #title"Hint, hint!")
 (doctor: cycleSpeed(1) moveSpeed(1) setMotion(MoveTo 59 84 RoomScript))
        )
 (case 3
 Wait(10)
 (doctor: loop(4))
 (aPhone: loop(0))
  (send gTheSoundFX: stop())
   DoSound(sndVOLUME voll)
 Print("Yez?..." #title "Prof. Grankenztein:" #icon 778 0 0)
 PlayerControl()
 = gTimeSeconds2 0
 = escape TRUE
 )
 (case 4
 (doctor: setCycle(Walk) cycleSpeed(1) moveSpeed(1) setMotion(MoveTo 154 125 RoomScript))

 )
 (case 5
 Print("And now let'z get on wizh our lazer beam tezt. It will ze extremly painful. Huhaa!" #title "Prof. Grankenztein:" #icon 778 0 0)
  (aE: init() setMotion(MoveTo 50 1 RoomScript))
  )
 (case 6
  Print("NOOOOO!!!!" #title "Dr.Jummybummy:" #icon 777 0 18)
   (aE: init() setMotion(MoveTo 65 1 RoomScript))
     )
   (case 7
     (aBeam: loop(0) init() setCycle(End RoomScript))
 (egoLie: loop(1) cycleSpeed(4) setCycle(End RoomScript))
   )
(case 8
(aBeam: loop(1) cel(0) cycleSpeed(4) setCycle(End RoomScript))

 )
 (case 9
 (aBeam: hide())
    = dyingScript ScriptID(DYING_SCRIPT)
  (send dyingScript:
    caller(3)
    register("You were just killed by the laser beam. I hope you saved as I recommended earlier.")
  )
  (send gGame:setScript(dyingScript))

 )
 )
)
 (method(doit)
 (if(==(send gEgo: onControl()) ctlRED)
 (send gRoom: newRoom(58))
 )
 (if(== gTimeSeconds2 12)
= gTimeSeconds2 13
 (if(escape)
(if(not(deadOver2))
 = deadOver TRUE
 ProgramControl()
 (doctor: cycleSpeed(1) moveSpeed(1) setMotion(MoveTo 67 108 RoomScript))
 ))) ))


(instance aBeam of Act
(properties
view 78
x 223
y 128
priority 5
))
(instance egoLie of Act
(properties
view 79
x 220
y 127
priority 4
loop 0
))

(instance doctor of Act
(properties
view 80
x 154
y 125
cel 2
))
(instance aE of Act
(properties
view 300
x 1
y 1
))

(instance aPhone of Act
(properties
view 81
x 58
y 59
)
)
/******************************************************************************/
