/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 69)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(use "menubar")
(local
selectHand
selectKnife
connect
connect2
)
/******************************************************************************/
(instance public rm069 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

        ProgramControl()
        (aHand: init())
        (aRedWire: init())
         (aRedWire2: init())
        (aKnife: init())
        (aBack: init())

         Display(" Selected: None" dsCOORD 140 10 dsCOLOUR 15 dsBACKGROUND clTRANSPARENT)
         (if(wire)
        (aRedWire: loop(1) cel(0))
       )
                (if(wire2)
        (aRedWire2: loop(1) cel(1))
        )
        (if(connected)
        (aMid: init())
        return
        )
        Print("Here you have to get the ship in working condition. Click on the knife button to select the knife as your tool, and on the hand button to select the empty hand.")
        Print("A wire seems to be cut.")
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)

 	(method (handleEvent pEvent)
		(if( not (super:handleEvent(pEvent)) )
		   /*/ (switch( (send pEvent:type) )
				(case evMOUSEBUTTON */
					// Make sure it's the left button


					(if(not (& (send pEvent:modifiers) emRIGHT_BUTTON))
                        (if(> (send pEvent:x) 67 and (if(< (send pEvent:x) 100)))
                    (if(< (send pEvent:y) 22 and (if(> (send pEvent:y) 2)))
                     (send gRoom: newRoom(68))
                    )
                    )
                    (if(> (send pEvent:x) 17 and (if(< (send pEvent:x) 40)))
                    (if(< (send pEvent:y) 22 and (if(> (send pEvent:y) 2)))
                    (aHand: cel(1))
                    (aKnife: cel(0))
                    = selectKnife FALSE
                    = selectHand TRUE
                    DrawPic(69)
                    Display(" Selected: Hand" dsCOORD 140 10 dsCOLOUR 15 dsBACKGROUND clTRANSPARENT)
                    return
                    )
                    )
                     (if(> (send pEvent:x) 37 and (if(< (send pEvent:x) 70)))
                    (if(< (send pEvent:y) 22 and (if(> (send pEvent:y) 2)))
                    (aKnife: cel(1))
                    (aHand: cel(0))
                    = selectKnife TRUE
                    = selectHand FALSE
                    DrawPic(69)
                    Display(" Selected: Knife" dsCOORD 140 10 dsCOLOUR 15 dsBACKGROUND clTRANSPARENT)
                    return
                    )
                    )
                    (if(> (send pEvent:x) 47 and (if(< (send pEvent:x) 104)))
                    (if(< (send pEvent:y) 150 and (if(> (send pEvent:y) 138)))
                    (if(selectKnife)
                    (aRedWire: loop(1) cel(0))
                    = wire TRUE
                    return
                      )
                    (if(connect2)
                    (if(wire)
                    (if(not(connected))
                    = connected TRUE
                    (aMid:  init())
                    += gScore 2
                    return
                    )
                    return
                    )
                    Print("The other wire isn't clean.")
                    return

                    )
                    (if(not(wire))
                    Print("The wire isn't clean.")
                    return
                    )
                   (if(not(connected))
                    Print("Select where you want to connect the wire.")
                    = connect TRUE
                    = connect2 FALSE
                    )
                    )
                    )
                     (if(> (send pEvent:x) 100 and (if(< (send pEvent:x) 130)))
                    (if(< (send pEvent:y) 152 and (if(> (send pEvent:y) 33)))
                    (if(selectKnife)
                    (aRedWire2: loop(1) cel(1))
                    = wire2 TRUE
                    return
                    )
                    (if(connect)
                    (if(wire2)
                    (if(not(connected))
                    = connected TRUE
                    (aMid:  init())
                     += gScore 2
                     Print("You reconnected the wire. Now the vessel should work.")
                    return
                    )
                    return
                    )
                    Print("The other wire isn't clean.")
                    return
                    )

                    (if(not(wire2))
                    Print("The wire isn't clean.")
                    return
                    )
                                       (if(not(connected))
                    Print("Select where you want to connect the wire.")
                    = connect FALSE
                    = connect2 TRUE
                    )
                    )
                    )
                     )
                     )
                     )







)
(instance aHand of Prop
(properties
view 98
x 30
y 22
loop 0
cel 0
))
(instance aKnife of Prop
(properties
view 98
x 60
y 22
loop 1
cel 0
))
(instance aBack of Prop
(properties
view 98
x 90
y 22
loop 2
cel 0
))
(instance aRedWire of Act
(properties
view 99
x 71
y 150
cel 0
))
(instance aRedWire2 of Act
(properties
view 99
cel 1
x 115
y 152
))
(instance aMid of Act
(properties
view 99
loop 2
x 107
y 153
))

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