/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 14)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(local
son
)
/******************************************************************************/
(instance public rm014 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))
(switch(gPreviousRoomNumber)
        	(case 16

				(send gEgo:
					posn(5 150)
					loop(0)
				)
			)
			(default

       = converse FALSE
       = sonny FALSE
       = powercut FALSE
       = pickedLock FALSE
       = objective 6
   (send gGame:setSpeed(4))
    (send gTheMusic:
			prevSignal(0)
			stop()
			number(5)
			loop(-1)
			play()
		)
				(send gEgo:
					posn(108 133)
					loop(2)
				)
			)
		)



         = games TRUE
		SetUpEgo()
		(send gEgo:init())

  (aDoor: init())
  (aSonny: init())
  (aHairpin: init())
 (send gGame:setSpeed(3))
 (if(>= gPreviousRoomNumber 0)
 Print("Nice! You're in jail. There's some dude sharing the cell with you.") )
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
    (method(doit)
     (var dyingScript)
      (if(send gEgo:has(INV_HAIRPIN))
      (aHairpin: hide())
      )



(if(== (send gEgo:onControl()) ctlNAVY)
(if(powercut)
return
)
(if(not(son))
= ex (send gEgo: x)
= ey (send gEgo: y)
(send gRoom: newRoom(600))
)))
 (method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if(Said('unlock/door'))
Print("!! CLanG CLAnG clinNG CLOng !!")
Print("Looks like it doesn't open.")
)
(if(Said('press/button'))
Print("This button does nothing. At least in this game.")
)
(if(Said('open/door,gate'))
Print("You're too far away from the door.")
)
(if(Said('close/door,gate'))
Print("It's already closed. You have to O P E N it.")
)
(if(Said('use/pin'))
 Print("You're too far away from the door.")
)
(if(Said('take>'))
(if(Said('/lock,door,gate'))
Print("You're too far away from the door.")
)
(if(Said('/cable'))
Print("It's tightly attached to the wall.")
)
(if(Said('/man'))
Print("I don't think he would like that...")
)
(if(Said('/hairpin'))
(if(==(send gEgo:onControl()) ctlSILVER)
(if(send gEgo:has(INV_HAIRPIN))
Print("You already have it in your pockets.")
return
)
Print("You decide to pick up the hairpin.")
(send gEgo: get(INV_HAIRPIN))
+= gScore 2
(aHairpin: hide())
return
 )
Print("You're not close enough to the pin.")
) )
(if(Said('use/knife') or (if(Said('cut/power,cable'))))
(if(== (send gEgo:onControl()) ctlRED)
(if(send gEgo:has(INV_KNIFE))
(if(powercut)
Print("I already did that. Now it's time to move!")
return
)
Print("You decided to cut the power cable...")
= powercut TRUE
Wait(10)
ShakeScreen(2)
Print("And voila...")
 += gScore 2
(send gRoom: newRoom(144))
return
)
Print("You don't have anything to cut it with.")
return
)
Print("Move closer to the cable on the wall.")
)
(if(Said('talk/man,sonny'))
  (if(< (send gEgo:distanceTo(aSonny)) 32)
(if(converse)
Print("I don't have anything else to say.")
return
)
Print("Hi! Could you help me to get out of here?" #title "Dr.Jummybummy:" #icon 777 0 18)
Print("If I can. What you're in for?"#title"Sonny:" #icon 777 0 3)
Print("I was just experimenting with my time travelling machine when I got on this planet. Then some guy arrested me and took me to the Lord Bather. He told me that he wants to destroy my planet." #title "Dr.Jummybummy:" #icon 777 0 18)
Print("Then you must be from Earth. I'm Sonny. I belong to the rebels."#title"Sonny:" #icon 777 0 3)
Print("You know Earth?" #title "Dr.Jummybummy:" #icon 777 0 18)
Print("Sure. Lord Bather has a horrible plan to destroy your planet." #title"Sonny:" #icon 777 0 3)
Print("I have to stop that!" #title "Dr.Jummybummy:" #icon 777 0 18)
Print("Only way to stop that would be to go on to the Moon Base. It's a moon not far from here."#title"Sonny:" #icon 777 0 3)
Print("How can I get there?" #title "Dr.Jummybummy:" #icon 777 0 18)
Print("Here, take this Rebels knife. If you get out, go to the Moon Base planet, and try to find the Rebels."#title"Sonny:" #icon 777 0 3)
(send gEgo:get(10))
Print("If you make it there then maybe they can help you further."#title"Sonny:" #icon 777 0 3)
Print("But first I have to get out of here!" #title "Dr.Jummybummy:" #icon 777 0 18)
Print("I can't help you with that. Good luck! You need it."#title"Sonny:" #icon 777 0 3)
Print("Thank's for everything!" #title "Dr.Jummybummy:" #icon 777 0 18)
Print("Anytime bud!"#title"Sonny:" #icon 777 0 3)

+= gScore 3
= converse TRUE
return
)
Print("You don't want to yell, so get closer.")
)
(if(Said('look>'))
            (if(Said('/floor'))
            (if(send gEgo:has(INV_HAIRPIN))
            Print("It's just a floor.")
            return
            )
            Print("It's just a floor. There seems to be a hairpin on the floor.")
            )
            (if(Said('/lock,keyhole'))
            Print("You can see trough it. So that should make it easily picked.")
            )
            (if(Said('/door,gate'))
            Print("It's the prison gate. The lock seems to be acient.")
            )
            (if(Said('/man,sonny,(sonny<bonds)'))
            Print("Hey...he looks exactly like...")
            Print("...Sonny Bonds from Police Quest 2! What is he doing here?")
            )
            (if(Said('/pin'))
            (if(send gEgo:has(INV_HAIRPIN))
            Print("You have this hairpin in your inventory. Press TAB too see it.")
            return
            )
            Print("It's so small. Pick it up to have a closer look.")
            )
            (if(Said('/bar,(prison,cell<bar)'))
            Print("These bars seem to be made of unbreakable led-steel.")
            )
            (if(Said('/button'))
            Print("It's for opening the cell door.")
            )
            (if(Said('/wall'))
            Print("There are some small carvings on the wall, and also a cable on the wall.")
            )
            (if(Said('/cable'))
            Print("I wonder what this cable is used for. Hmmm...It leads to the gate following the ceiling.")
            )
            (if(Said('/ceiling'))
            Print("Only thing you can see is the cable that runs to the gate.")
            )
            (if(Said('/carving'))
            Print("Eigen was here...23.02.1987...")
            )
            (if(Said('/cell'))
            Print("This is the cell you and another guy are in.")
            )
            (if(Said('/'))
            Print("You're in prison. HELP! Try to get out. There's a man in your cel too. Also you can see a cable attached to the wall.")

        )
        )
        )
)
(instance aDoor of Act
(properties
view 230
cel 0
x 68
y 152
))
(instance aHairpin of Prop
(properties
view 688
loop 204
x 175
y 148
))
(instance aSonny of Prop
(properties
view 36
loop 1
x 227
y 132
))

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