/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 67)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(use "menubar")
(local
cut
red
dyingScript
rad
kni
cutting
lie
)
/******************************************************************************/
(instance public rm067 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))
  (aHang: init())
        PlayerControl()
  		(TheMenuBar:draw())
		(SL:enable())
        (send gEgo:posn(1 1))
     (send gEgo:put(INV_CARGO_KEY scriptNumber))
     = gTimeSeconds2 0

	)
)
/******************************************************************************/
(instance HitGround of Script
	(properties)
  (method (changeState newState)
  = state newState
  (switch (state)
    (case 0
   (aRadio: cel(1))
    )
    (case 1
   (aKnife: cel(3))
   Print("Now you don't have anything to cut the rope with.")
    ))
    
    )
    )
(instance RoomScript2 of Script
	(properties)
(method(changeState newState)
 = state newState
 (switch(state)
 (case 0
 = cycles 1
 (send gRoom: newRoom(70))

)
)
)
)
(instance RoomScript of Script
	(properties)
 (method(doit)
 (if(== gTimeSeconds2 3)
  (if(== lie 2)
 += gTimeSeconds2 1
     SetUpEgo()
  )
  )
   (if(== gTimeSeconds2 4)
  (if(== lie 2)
  (if(rad)

 += gTimeSeconds2 1
  (send gEgo: get(INV_RADIO))
  PlayerControl()
  (aRadio: dispose())
  Print("You pick up your radio.")
  )
  )
  )
 (if(== gTimeSeconds2 5)
 (if(not(cutting))
 += gTimeSeconds2 1
 Print("Things start to fall out of your pockets. First goes the radio.")
 (send gEgo: put(INV_RADIO))
 = rad TRUE
 (aRadio: init() setMotion(MoveTo (aRadio: x) 163 HitGround))
 )
 )
  (if(== gTimeSeconds2 12)
   (if(not(cutting))
 += gTimeSeconds2 1
    = kni TRUE
 Print("The knife goes next.")

 (send gEgo: put(INV_KNIFE))
 (aKnife: init() setMotion(MoveTo (aKnife: x) 166 HitGround))
 )
 )
   (if(== gTimeSeconds2 23)
 += gTimeSeconds2 1
     = dyingScript ScriptID(DYING_SCRIPT)
  (send dyingScript:
    caller(3)
    register("You hanged down from the tree for too long, and it killed you.")
  )
  (send gGame:setScript(dyingScript))
 )
  (if(==(send gEgo: onControl())ctlRED)
  (if(not(red))
  = red TRUE
  ProgramControl()
  (send gEgo: cycleSpeed(2) cel(0) view(701) setCycle(End RoomScript2))
  )
 )
 )
   (method (handleEvent pEvent)
   (super:handleEvent(pEvent))
 (if(Said('look>'))
 (if(Said('/tree'))
 Print("This tree has a weird color. Rather boring if you ask me.")
 )
  (if(Said('/parachute'))
 Print("You jumped out of the vessel with that parachute.")
 )
 (if(Said('/leaves,leaf'))
 Print("Looks like autumn is getting near.")
 )
  (if(Said('/rope,ropes'))
  (if(cut)
  Print("You cut the ropes and fell down the tree.")
  return
  )
  (if(cutting)
  Print("You are cutting the ropes at the moment. Nothing to see.")
  return
  )
 Print("These parachute ropes hold you hanging down from the tree. Try to cut them.")
 )
  (if(Said('/sky'))
 Print("Sky is blurry and hard to make out. Probably lazy artist.")
 )
 (if(Said('/sand'))
 Print("Can't see anything special about this sand.")
 )
(if(Said('/'))
(if(cut)
Print("You're down from the tree. The sand looks safe. Go on!")
return
)
Print("Here you are, hanging down from a tree. You better cut your way out of this. And don't think for too long, you already feel sick of hanging upside down.")
        )
        )
   (if(Said('use,cut/rope,knife,parachute,(parachute<rope)'))
   (if(not(kni))
   (if(cut)
   Print("You already did that.")
   return
   )
   = cutting TRUE
   Print("Ok")
   += gScore 2
   (aHang: loop(1) cycleSpeed(2) setCycle(End RoomScript))
   return
   )
   Print("Oh nooo!! You don't have the knife!! You can't get down anymore now!!!")
   )
   )
 (method(changeState newState)
 = state newState
 (switch(state)
 (case 0
 = cycles 1
 )
 (case 1
  (aHang: loop(3) cycleSpeed(4) setCycle(Fwd) moveSpeed(0) yStep(3) setMotion(MoveTo 138 158 RoomScript))
  )
  (case 2
  ShakeScreen(4 ssFULL_SHAKE)
  (aHang: loop(3) cycleSpeed(4) setCycle(Fwd) moveSpeed(0) yStep(3) setMotion(MoveTo 138 158 RoomScript))
  )
  (case 3

  (aHang: hide())
   ProgramControl()
		(send gEgo:init() view(95) loop(4) posn(138 167))
   = lie 2
    = gTimeSeconds2 0

 )
 )
 )
)
(instance aHang of Act
(properties
view 95
x 138
y 91
))

(instance aRadio of Act
(properties
view 779
x 133
y 92
cel 0
))
(instance aKnife of Act
(properties
view 779
x 144
y 92
cel 2
))
/******************************************************************************/
