/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 29)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(use "menubar")
(local
red2
die
meanwhile2
dying
)
/******************************************************************************/
(instance public rm029 of Rm
	(properties
		picture scriptNumber
		north 0
		east 28
		south 31
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))
        = die Random(1 2)

		(switch(gPreviousRoomNumber)
			(case 28
				(send gEgo:
					posn(315 Yposn)
					loop(1)
				)
			)
   (case INITROOMS_SCRIPT

				(send gEgo:
					posn(85 97)
					loop(1)
				)
			)
      (case 36
				(send gEgo:
					posn(82 97)
					loop(0)
				)
			)
   (case 31
				(send gEgo:
					posn(255 183)
					loop(3)
				)
			)
		)

		SetUpEgo()
		(send gEgo:init())
  
       (if(ropeUsed)
       (aRope: init())

        )
	)
)
/******************************************************************************/
(instance RoomScript3 of Script
(properties)
(method (changeState newState)
(var dyingScript)
  = state newState
  (switch (state)
    (case 0
= cycles 1
      (if(not(meanwhile))
      = meanwhile TRUE
     = meanwhile2 TRUE
      DrawPic(61)
      (aClimb: hide())
      (aRope: hide())
           (send gTheMusic:
			prevSignal(0)
			stop()
			number(48)
			loop(-1)
			play()
		)
  Display("    Meanwhile at the Moon Base," dsCOORD 49 83 dsCOLOUR 1 dsFONT 900)
Display("an important meeting is taking place..." dsCOORD 49 93 dsCOLOUR 1 dsFONT 900)
Display("    Meanwhile at the Moon Base," dsCOORD 48 82 dsCOLOUR 9 dsFONT 900)
Display("an important meeting is taking place..." dsCOORD 48 92 dsCOLOUR 9 dsFONT 900)
        (SL:disable())
		(TheMenuBar:hide())
return
        )
     (send gRoom: newRoom(36))
   )
   )
   )
   )
(instance RoomScript2 of Script
(properties)
(method (changeState newState)
(var dyingScript)
  = state newState
  (switch (state)
    (case 0
= cycles 1

    (send gGame:setSpeed(3))
        (send gEgo: hide())
       = dyingScript ScriptID(DYING_SCRIPT)
  (send dyingScript:
    caller(3)
    register("You just sank into the sand. Be more careful!")
  )
  (send gGame:setScript(dyingScript))

   )
   )
   )
   )
(instance RoomScript of Script
	(properties)
 (method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if( not (send pEvent:claimed) )
(if( (== (send pEvent:type) evKEYBOARD) and (== (send pEvent:message) $3C00) )
ToggleSound()
)(else
(if(meanwhile2)
PlayerControl()
(TheMenuBar:draw())
(SL:enable())
 = meanwhile2 FALSE
(send gRoom: newRoom(38))
return

     )
        )

 (if(Said('take>'))
(if(Said('/rope'))
Print("You don't want that rope anymore.")
)
)
 (if(Said('look>'))
(if(Said('/sky'))
Print("Sky is in very strange colour. Also you can see some clouds in the sky.")
)
(if(Said('/rope'))
(if(ropeUsed)
Print("You tied the rope to the stone and now it's hanging down to the ground.")
return
)
Print("You have it in your inventory. Press TAB to see it.")
)
(if(Said('/cloud'))
Print("These \"clouds\" look more like some dust.")
)
(if(Said('/rock,stone'))
Print("Might come in handy if you decide to climb down the mountain.")
)
(if(Said('/edge'))
Print("You don't see much. Get closer.")
)
(if(Said('/sand,ground'))
Print("This ground looks dangerous. Better be careful.")
)
(if(Said('/mountain'))
Print("Aaah...what a great nature view.")
)
(if(Said('/view,panorama'))
Print("The view looks nice. You wish you had a view like that from your home window.")
)
(if(Said('/[ /* , !* ]'))
Print("You have reached the end of this mountain where you are on. On the edge you can see a rock.")
)
)

(if(Said('go,(get<down),climb,slide/down,rope,mountain') or (if(Said('climb,go,slide,(get<down)') or (if(Said('(get<down),climb,slide,go/down/rope,mountain'))))))
(if(ropeUsed)
(if(==(send gEgo: onControl()) ctlNAVY)
(if(climbed)
Print("Ok")
(send gEgo: hide())
(aClimb: init() cel(0) cycleSpeed(4) setCycle(End RoomScript3))
return
)
Print("Ok") (send gEgo: hide())
(aClimb: init() cel(0) cycleSpeed(4) setCycle(End RoomScript3))
+= gScore 3
= climbed TRUE

return
)
Print("You're not close enough to the rope.")
return
)
Print("First you need to tie the something to something, so it would hold and you can climb down.")
return

)
(if(Said('untie/rope'))
Print("Better not. Then why did you tie it in the first place?")
)
(if(Said('use,lower,tie,connect,set/rope') or (if(Said('use,lower,tie,connect,set/rope/stone,rock'))))
(if(==(send gEgo: onControl()) ctlNAVY)
(if(send gEgo: has(INV_ROPE))
(if(ropeUsed)
Print("It's already done. Now climb down.")
return
)
Print("Ok")
+= gScore 3
= ropeUsed TRUE
(send gEgo: put(INV_ROPE))
(aRope: init()cel(0)cycleSpeed(5)setCycle(End))
return
)
Print("You don't have a rope.")
return
)
Print("You're not close to anyting to tie the rope to.")
return
)
)
)
     (method (changeState newState)
         (var dyingScript)
  = state newState
  (switch (state)
    (case 0
= cycles 1


    )
    (case 1
    (send gGame:setSpeed(3))
        (send gEgo: hide())
       = dyingScript ScriptID(DYING_SCRIPT)
  (send dyingScript:
    caller(3)
    register("You kinda fell down from the cliff. Next time, be more careful.")
  )
  (send gGame:setScript(dyingScript))

   )
   )
   )
 (method(doit)
  (if(==(send gEgo: onControl()) ctlYELLOW)
 (if(not(dying))
 = dying TRUE
 ProgramControl()
 (send gEgo: view(701) cycleSpeed(2) setCycle(End RoomScript2))
 )
 )
   (if(==(send gEgo: onControl()) ctlRED)
   (if(not(red2))
   = red2 TRUE
 (send gGame:setSpeed(0))
 ProgramControl()
 (send gTheSoundFX:
prevSignal(0)
stop()
number(4)
loop(1)
play())
 (send gEgo: moveSpeed(0) posn(Xposn 149) setMotion(MoveTo Xposn 185 RoomScript))
)
)
)
)
(instance aRope of Prop
(properties
view 20
x 61
y 191
cel 3
))
(instance aClimb of Prop
(properties
view 950
x 47
y 191
cel 3
))

/******************************************************************************/
