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




  (case 14
  (if(not(send gEgo: has(INV_HAIRPIN)))
  (aHairpin: init())
  )
   )
  (case 20
(aDoor: init() cel(1) posn(103 155))
  	(send gEgo:
					posn(15 170)
					loop(0)
				)
 )
  (case 21

 (aDoor: init() cel(1) posn(103 155))
  	(send gEgo:
					posn(313 170)
					loop(1)
				)
 )
 (case 22

 (aDoor: init() cel(1) posn(103 155))
  	(send gEgo:
					posn(313 170)
					loop(1)
				)
 )
 (case 23
(aDoor: init() cel(1) posn(103 155))
  	(send gEgo:
					posn(150 180)
					loop(3)
				)

 )
 )
		SetUpEgo()
(send gEgo:init())
  (aDoor: init())
  (aSonny: init())


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

(instance RoomScript of Script
	(properties)
  (method(doit)
     (if(==(send gEgo:onControl()) ctlCYAN)
     (if(not(invited))
Print("Are you coming? We have to go NOW!" #title "Dr.Jummybummy:" #icon 777 0 avatar)
Print("I'm afraid I can't. They promised to hurt my family when I try to escape. But you, go and find The Rebels!"#title"Sonny:" #icon 777 0 3)
Print("I wouldn't want to leave you behind..." #title "Dr.Jummybummy:" #icon 777 0 avatar)
Print("No time to argue! Go!"#title"Sonny:" #icon 777 0 3)
= ye (send gEgo: y)
+= ye 1
(send gEgo: setMotion(MoveTo (send gEgo: x) ye))
= invited TRUE
     )
     )
   (if(==(send gEgo:onControl()) ctlGREEN)
    (send gRoom:newRoom(23))
   return
   )
  (if(==(send gEgo:onControl()) ctlYELLOW)
  (if(lef)
  (send gRoom:newRoom(20))
  return

  )
  (send gEgo: hide())
  Print("After some sneaking, peaking and squeaking you reach some kind of a room.")
  (send gRoom: newRoom(20))
   )

 (if(==(send gEgo:onControl()) ctlBLUE)
  (if(righty)
  (if(deactivated)
  (send gRoom: newRoom(21))
  return
   )
  (send gRoom: newRoom(22))


  return
  )
  (send gEgo: hide())
  Print("After some walking and talking you find yourself in some office...")
  (if(deactivated)
  (send gRoom: newRoom(21))
  return
   )
  (send gRoom: newRoom(22))
    )
   )


(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('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('/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("...like...")
            Print("...Sonny Bonds form 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('/button'))
            Print("It's for openong the cell door.")
            )
            (if(Said('/wall'))
            Print("There are some small carvings on the wall. They don't intrest you. There's 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('/bar,(prison,cell<bar)'))
            Print("These bars seem to be made of unbreakable led-steel.")
            )
            (if(Said('/'))
            Print("There's a man in the cel. Also you can see a cable running on the wall.")
            )
            )
  (if(Said('close/door,gate'))
 (if(odoor)
Print("Then, what was the point of opening it in the first place?")
return
)
Print("It is closed.")
)
 (if(Said('open,push/door,gate'))
 (if(pickedLock)
 //open door here
 (if(odoor)
 Print("It's already opened.")
 return
 )
= odoor TRUE
Print("Ok")
(aDoor: cel(1) posn(103 155))
= ye (send gEgo: y)
+= ye 1
(send gEgo: setMotion(MoveTo (send gEgo: x) ye))
 return
 )
 //if not picked lock
 Print("You just can't open it, because it's locked.")
 )
 (if(Said('use/pin'))
(if(== (send gEgo:onControl()) ctlNAVY)
  (if(pickedLock)
  Print("You already did that.")
  return
  )
 (if(send gEgo:has(INV_HAIRPIN))
 Print("Ok")
 Print("You try to pick the lock with the hairpin you found.")
 Wait(30)
 Print("...You start picking...")
 Wait(30)
 Print("...still picking...")
 Wait(30)
 Print("...almost picked...")
  Wait(22)
 Print("...a bit more..")
 Wait(30)
  Print("...done!")
 += gScore 2
 = pickedLock TRUE
 return
 )
 Print("You don't have anything to pick it with.")
 return
 )
Print("You're not close enough to the door.")
 )
 
 (if(Said('take>'))
 (if(Said('/door,gate,lock'))
 (if(== (send gEgo:onControl()) ctlNAVY)
  (if(pickedLock)
  Print("You already did that.")
  return
  )
 (if(send gEgo:has(INV_HAIRPIN))
 Print("Ok")
 Print("You try to pick the lock with the hairpin you found.")
 Wait(30)
 Print("...You start picking...")
 Wait(30)
 Print("...still picking...")
 Wait(30)
 Print("...almost picked...")
  Wait(22)
 Print("...a bit more..")
 Wait(30)
  Print("...done!")
 += gScore 2
 = pickedLock TRUE
 return
 )
 Print("You don't have anything to pick it with.")
 return
 )
Print("You're not close enough to the door.")
)
 (if(Said('/pin'))
(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('take/hairpin,pin'))
(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('cut,use/power,cable,knife'))
Print("I just did that.")
)
(if(Said('talk/man,sonny'))
(if(invited)
(if(inve2)
Print("You've got to go and find The Rebels.")
return
)
Print("You've got to come!"#title"Dr.Jummybummy" #icon 777 0 avatar)
Print("I told you, I can't. They will hurt my family. I'll rather die."#title"Sonny:" #icon 777 0 3)
Print("I've got to go! Hope to see you again."#title"Dr.Jummybummy" #icon 777 0 avatar)
Print("You will." #title"Sonny:" #icon 777 0 3)
= inve2 TRUE
return
)
Print("You don't have to talk to him anymore.")
)
)

)
(instance aDoor of Act
(properties
view 230
cel 0
x 68
y 152
))
(instance aSonny of Act
(properties
view 36
loop 1
x 227
y 132
))
 (instance aEgoElec of Act
(properties
view 600
cycleSpeed 7
))
(instance aHairpin of Act
(properties
view 688
loop 204
x 167
y 148
))




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