(version 2)
(include "sci.sh")
(exports
    0 Room421
)
(use "Main")
(use "Class_255_0")
(use "Chase")
(use "Avoid")
(use "Sound")
(use "Cycle")
(use "Game")
(use "Feature")
(use "Obj")
(script 421)


(local
    local0
    local1
    thePulley1
    local3
    local4
    newView
    newView_2
    newSound
    local8
    local9

)
(instance deathSound of Sound
    (properties)
)
(instance elevator of Act
    (properties)
)
(instance elevTop of Prop
    (properties)
)
(instance elevBottom of Prop
    (properties)
)
(instance cable1 of Prop
    (properties)
)
(instance cable2 of View
    (properties)
)
(instance gear of Prop
    (properties)
)
(instance pulley1 of Act
    (properties)
)
(instance pulley2 of Act
    (properties)
)
(instance public Room421 of Rm
    (properties
        picture 421
        vanishingY -400
    )

    (method (init)
        (super:init())
        = local8 500
        = local4 1
        Load(128 94)
        Load(128 777)
        Load(128 119)
        Load(128 108)
        Load(128 106)
        Load(128 120)
        Load(132 91)
        Load(132 92)
        (send gEgo:init())
        (if (== global117 421)
            = local0 5
            = gNewAct (View:new())
            (send gNewAct:
                view(120)
                setLoop(4)
                setCel(6)
                setPri(0)
                posn(160 127)
                init()
                stopUpd()
            )
        )
        (if (proc0_13(16 421))
            = gNewView (View:new())
            (send gNewView:
                view(120)
                loop(5)
                cel(0)
                posn(157 124)
                setPri(1)
                init()
                stopUpd()
            )
        )
        (gear:
            view(120)
            loop(0)
            posn(158 65)
            ignoreActors()
            setCycle(Fwd)
            setScript(gearActions)
            init()
        )
        (send gLongSong:
            number(85)
            loop(-1)
            play()
        )
        (pulley1:
            view(120)
            setLoop(1)
            setCel(1)
            ignoreActors()
            illegalBits(0)
            ignoreHorizon()
            posn(77 -23)
            setPri(0)
            init()
            stopUpd()
        )
        (pulley2:
            view(120)
            setLoop(1)
            illegalBits(0)
            ignoreHorizon()
            ignoreActors()
            setCel(1)
            posn(108 0)
            setPri(15)
            init()
            stopUpd()
        )
        (send gEgo:
            view(83)
            loop(2)
            cel(2)
            posn(56 202)
            setPri(8)
            setLoop(2)
            setCel(2)
            ignoreActors()
            illegalBits(0)
            init()
        )
        (cable1:
            view(83)
            loop(3)
            cel(9)
            ignoreActors()
            posn(56 83)
            setPri(7)
            cycleSpeed(5)
            init()
            stopUpd()
        )
        (cable2:
            view(83)
            loop(3)
            cel(0)
            ignoreActors()
            posn(56 71)
            setPri(7)
            init()
            stopUpd()
        )
        (send global2:setScript(raise))
    )


    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return 
        )
        (if ((& (send gEgo:onControl(0)) $0004) and not global155)
            = global104 7
            (if ((send global5:contains(gNewAct)) and (< local0 5))
                (send gNewAct:setMotion(0))
            )
            (pulley1:setScript(smash))
        )
        (if ((((& (send gEgo:onControl(0)) $1000) and (== global104 2)) and (== local1 0)) and (<= (bringOnFester:state) 0))
            (pulley1:setScript(fall))
        )
        (if (== global104 1)
            (send gEgo:setPri(8))
        )(else
            (if ((== global104 2) and (send gEgo:inRect(0 135 91 163)))
                (send gEgo:setPri(14))
            )(else
                (if (((== global104 2) and (send gEgo:inRect(266 140 303 147))) and not global155)
                    = global104 3
                    (send gEgo:
                        setPri(10)
                        ignoreControl(16384)
                        observeControl(8192)
                    )
                )(else
                    (if (((== global104 3) and (send gEgo:inRect(268 148 308 154))) and not global155)
                        = global104 2
                        (send gEgo:
                            setPri(-1)
                            observeControl(16384)
                            ignoreControl(8192)
                        )
                    )(else
                        (if (((== global104 3) and not global155) and (send gEgo:inRect(239 52 270 57)))
                            = global104 4
                            (send gEgo:
                                setPri(-1)
                                observeControl(16384)
                                ignoreControl(8192)
                            )
                            (if (((== global110 1) or (== global110 2)) and (== local0 0))
                                (self:setScript(termComesUp))
                            )
                        )(else
                            (if (((== global104 4) and (send gEgo:inRect(239 57 272 64))) and not global155)
                                = global104 3
                                (send gEgo:
                                    setPri(10)
                                    ignoreControl(16384)
                                    observeControl(8192)
                                )
                            )(else
                                (if (== global104 3)
                                    (send gEgo:setPri(10))
                                )(else
                                    (if (((== global104 4) and (send gEgo:inRect(0 62 252 76))) and not global155)
                                        (send gEgo:setPri(14))
                                    )(else
                                        (if (((== global104 4) and (& (send gEgo:onControl(0)) $0200)) and not global155)
                                            (send gEgo:setPri(9))
                                        )(else
                                            (if (not global155)
                                                (send gEgo:setPri(-1))
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
        (if ((== local0 4) and (send gNewAct:inRect(0 62 237 76)))
            (send gNewAct:setPri(14))
        )(else
            (if ((== local0 2) and (send gNewAct:inRect(0 136 91 163)))
                (send gNewAct:setPri(14))
            )(else
                (if (((<> global110 3) and (== local0 4)) and (send gNewAct:setPri(-1)))
                )(else
                    (if (== local0 3)
                        (send gNewAct:setPri(10))
                    )(else
                        (if ((== local0 4) and (& (send gNewAct:onControl(0)) $0200))
                            (send gNewAct:setPri(9))
                        )(else
                            (if (== local0 4)
                                (send gNewAct:setPri(-1))
                            )
                        )
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 1
        )
        (if (== (send pEvent:type) 128)
            (if (Said('look,converse/blatz'))
                (if (== (send global2:script) bringOnFester)
                    (if (== local1 1)
                        proc255_0(421 0)
                    )(else
                        (if (== local1 2)
                            proc255_0(421 1)
                        )(else
                            proc255_0(421 2)
                        )
                    )
                )(else
                    proc255_0(421 2)
                )
            )(else
                (if (Said('look>'))
                    (if ((Said('/area') or Said('/around')) or Said('[<around][/!*]'))
                        proc255_0(421 3)
                    )(else
                        (if (Said('/stair'))
                            proc255_0(421 4)
                        )(else
                            (if (Said('/pedestal'))
                                proc255_0(421 5)
                            )(else
                                (if (Said('<down'))
                                    proc255_0(421 6)
                                )(else
                                    (if (Said('<up') or Said('/ceiling'))
                                        proc255_0(421 7)
                                    )(else
                                        (if (Said('/android'))
                                            (if (== local0 0)
                                                proc255_0(421 8)
                                            )(else
                                                (if (== local0 1)
                                                    proc255_0(421 9)
                                                )(else
                                                    (if (((>= local0 2) and (<> local0 5)) and (<> local0 6))
                                                        proc255_0(421 10)
                                                    )(else
                                                        (if (== local0 5)
                                                            (if ((== global104 2) and (<= (send gEgo:distanceTo(gNewAct)) 30))
                                                                proc255_0(Format(@global402 421 11 
                                                                        (if (proc0_13(16 421))
                                                                            "Looking closely, you notice that the terminator's invisibility belt has survived relatively intact."
                                                                        )(else
                                                                            ""
                                                                        )
))
                                                            )(else
                                                                proc255_0(421 12)
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )(else
                                            (if (Said('/debris') and (== local0 5))
                                                (if ((== global104 2) and (<= (send gEgo:distanceTo(gNewAct)) 30))
                                                    proc255_0(Format(@global402 421 11 
                                                            (if (proc0_13(16 421))
                                                                "Looking closely, you notice that the terminator's invisibility belt has survived relatively intact."
                                                            )(else
                                                                ""
                                                            )
))
                                                )(else
                                                    proc255_0(421 12)
                                                )
                                            )(else
                                                (if (Said('/engine,device,equipment'))
                                                    proc255_0(421 13)
                                                )(else
                                                    (if (Said('/cog'))
                                                        proc255_0(421 14)
                                                    )(else
                                                        (if (Said('/rope,scout,pulley,jar'))
                                                            proc255_0(421 15)
                                                        )(else
                                                            (if (Said('/banister'))
                                                                proc255_0(421 16)
                                                            )(else
                                                                (if (Said('/overhang'))
                                                                    proc255_0(421 17)
                                                                )(else
                                                                    (if (Said('/pit'))
                                                                        proc255_0(421 18)
                                                                    )(else
                                                                        (if (Said('/bolt'))
                                                                            proc255_0(421 19)
                                                                        )(else
                                                                            (if (Said('/elevator'))
                                                                                (if ((== local1 2) or (== local1 1))
                                                                                    proc255_0(421 20)
                                                                                )(else
                                                                                    proc255_0(421 21)
                                                                                )
                                                                            )(else
                                                                                (if (Said('/button,control'))
                                                                                    (if ((send gEgo:inRect(0 37 73 133)) and (== global104 2))
                                                                                        proc255_0(421 22)
                                                                                    )(else
                                                                                        proc255_0(421 23)
                                                                                    )
                                                                                )
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )(else
                    (if (Said('explore/android,debris,body') and (== local0 5))
                        (if ((== global104 2) and (<= (send gEgo:distanceTo(gNewAct)) 30))
                            proc255_0(Format(@global402 421 11 
                                    (if (proc0_13(16 421))
                                        "Looking closely, you notice that the terminator's invisibility belt has survived relatively intact."
                                    )(else
                                        ""
                                    )
))
                        )(else
                            proc255_0(421 12)
                        )
                    )(else
                        (if (Said('press<up') or Said('press/button<up'))
                            (if ((send gEgo:inRect(39 123 62 133)))
                                proc255_0(421 24)
                            )(else
                                proc0_5()
                            )
                        )(else
                            (if ((Said('press/button') or Said('press<down')) or Said('use/elevator'))
                                (if ((send gEgo:inRect(39 123 63 133)) and (== local1 2))
                                    proc255_0(421 25)
                                    (send global2:setScript(lowerEgoElevator))
                                )(else
                                    proc0_5()
                                )
                            )(else
                                (if (Said('converse/android'))
                                    (if ((send global5:contains(gNewAct)))
                                        proc255_0(421 26)
                                    )(else
                                        proc255_0(421 27)
                                    )
                                )(else
                                    (if (Said('board,drag,hold/scout,rope,jar'))
                                        proc255_0(421 28)
                                    )(else
                                        (if (Said('swing,get,press,use/scout,pulley,rope,jar'))
                                            (switch (local3)
                                                (case 0
                                                    (send gEgo:setScript(doPulley))
                                                )
                                                (case 2
                                                    proc255_0(421 29)
                                                )
                                                (default 
                                                    proc255_0(421 30)
                                                )
                                            )
                                        )(else
                                            (if (Said('get/scout,banister,rope'))
                                                proc255_0(421 31)
                                            )(else
                                                (if (Said('get/belt'))
                                                    (if ((send gEgo:has(16)))
                                                        proc255_0(421 32)
                                                    )(else
                                                        (if (not proc0_13(16 421))
                                                            proc255_0(421 33)
                                                        )(else
                                                            (if (> (send gEgo:distanceTo(gNewView)) 12)
                                                                proc0_5()
                                                            )(else
                                                                proc255_0(421 34)
                                                                (send gNewView:dispose())
                                                                (send global1:changeScore(35))
                                                                (if (> (bringOnFester:seconds) 5)
                                                                    (bringOnFester:seconds(5))
                                                                )
                                                                (send gEgo:get(16))
                                                            )
                                                        )
                                                    )
                                                )(else
                                                    (if (Said('get/android'))
                                                        (if (== local0 5)
                                                            proc255_0(421 35)
                                                        )(else
                                                            proc255_0(421 36)
                                                        )
                                                    )(else
                                                        (if (Said('get<in/elevator'))
                                                            proc255_0(421 37)
                                                        )(else
                                                            (if (Said('attack/android'))
                                                                proc255_0(421 38)
                                                            )(else
                                                                (if (Said('use/orat,stick'))
                                                                    proc255_0(421 39)
                                                                )(else
                                                                    (if (Said('jump'))
                                                                        proc255_0(421 40)
                                                                    )(else
                                                                        (if (Said('turn<off/engine'))
                                                                            proc255_0(421 41)
                                                                        )(else
                                                                            (if (Said('climb'))
                                                                                proc255_0(421 42)
                                                                            )(else
                                                                                (if (Said('/scout,jar,rope,cog,device,engine'))
                                                                                    proc255_0(421 43)
                                                                                )
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
        return 
            (if (((((== (send pEvent:type) 4) and (== (send pEvent:message) 13)) and (== (send global2:script) bringOnFester)) and (<= 2 (bringOnFester:state))) and (<= (bringOnFester:state) 4))
                proc0_12()
                (bringOnFester:seconds(0))
                (bringOnFester:cue())
            )(else
                0
            )
    )


    (method (newRoom newRoomNumber)
        (send global8:eachElementDo(139))
        (super:newRoom(newRoomNumber))
    )

)
(instance raise of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = global104 1
                (send gEgo:setMotion(MoveTo 56 83 self))
                (cable1:setCycle(Beg))
            )
            (case 1
                proc0_3()
                (elevTop:
                    view(83)
                    setLoop(2)
                    cel(1)
                    posn(56 85)
                    setPri(10)
                    ignoreActors()
                    init()
                    stopUpd()
                )
                (elevBottom:
                    view(83)
                    setLoop(2)
                    cel(0)
                    posn(56 85)
                    setPri(8)
                    ignoreActors()
                    init()
                    stopUpd()
                )
                (send gEgo:
                    view(0)
                    setLoop(-1)
                    setCycle(Walk)
                    illegalBits(-32768)
                    observeControl(16384)
                    posn(56 129)
                    setPri(-1)
                )
                = global104 2
                = local1 2
            )
        )
    )

)
(instance termComesUp of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local0 1
                = local1 1
                (send gEgo:observeControl(4096))
                (elevator:
                    view(83)
                    setLoop(2)
                    setCel(4)
                    posn(56 (elevTop:y))
                    illegalBits(0)
                    ignoreActors()
                    setPri(8)
                    setMotion(MoveTo 56 202 self)
                    init()
                )
                (cable1:
                    view(83)
                    ignoreActors()
                    posn(56 83)
                    loop(3)
                    cel(255)
                    cycleSpeed(5)
                    setCycle(End)
                )
                (elevTop:
                    view(777)
                    forceUpd()
                )
                (elevBottom:
                    view(777)
                    forceUpd()
                )
            )
            (case 1
                (elevator:
                    setCel(3)
                    setMotion(MoveTo 56 83 self)
                )
                (cable1:
                    cel(9)
                    setCycle(Beg)
                )
            )
            (case 2
                (elevator:dispose())
                (elevTop:
                    view(83)
                    setLoop(2)
                    setCel(1)
                )
                (elevBottom:
                    view(83)
                    setLoop(2)
                    setCel(0)
                )
                (cable1:
                    view(777)
                    stopUpd()
                )
                = gNewAct (Act:new())
                (send gNewAct:
                    view(119)
                    posn(64 128)
                    loop(0)
                    setCycle(Walk)
                    setAvoider(Avoid)
                    setMotion(MoveTo 89 128 self)
                    init()
                )
            )
            (case 3
                (if (<> global104 7)
                    = newView (View:new())
                    (send newView:
                        view(108)
                        setLoop(6)
                        setCel(0)
                        posn(114 92)
                        ignoreActors()
                        setPri(15)
                        init()
                    )
                    = seconds 3
                )
            )
            (case 4
                (if (<> global104 7)
                    (send newView:dispose())
                    (send gNewAct:setScript(termChase))
                    = local1 1
                    (send gEgo:observeControl(4096))
                    (elevator:
                        view(83)
                        setLoop(2)
                        setCel(4)
                        posn(56 (elevTop:y))
                        illegalBits(0)
                        ignoreActors()
                        setPri(8)
                        setMotion(MoveTo 56 202 self)
                        init()
                    )
                    (cable1:
                        view(83)
                        ignoreActors()
                        posn(56 83)
                        loop(3)
                        cel(255)
                        cycleSpeed(5)
                        setCycle(End)
                    )
                    (elevTop:
                        view(777)
                        stopUpd()
                    )
                    (elevBottom:
                        view(777)
                        stopUpd()
                    )
                )
            )
            (case 5
                = local1 0
                (cable1:stopUpd())
                (send gEgo:ignoreControl(4096))
                (send gNewAct:observeControl(4096))
            )
        )
    )

)
(instance termChase of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return 
        )
        (if (== local0 2)
            (if (((== global104 4) or (== global104 3)) and (<> state 1))
                (self:changeState(1))
            )(else
                (if (((== global104 2) and (<> state 7)) and (< state 8))
                    (self:changeState(7))
                )
            )
        )(else
            (if (== local0 3)
                (if (((== global104 4) and (<> state 2)) and (< state 8))
                    (self:changeState(2))
                )(else
                    (if (((== global104 3) and (< state 8)) and (<> state 7))
                        (self:changeState(7))
                    )(else
                        (if (((== global104 2) and (< state 8)) and (<> state 5))
                            (self:changeState(5))
                        )
                    )
                )
            )(else
                (if (== local0 4)
                    (if (((== global104 4) and (< state 8)) and (<> state 7))
                        (self:changeState(7))
                    )(else
                        (if (((== global104 3) and (< state 8)) and (<> state 4))
                            (self:changeState(4))
                        )(else
                            (if ((== global104 2) and (<> state 4))
                                (self:changeState(4))
                            )
                        )
                    )
                )
            )
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local0 2
                (send gNewAct:observeControl(4096))
            )
            (case 1
                (send gNewAct:setMotion(MoveTo 286 156 self))
            )
            (case 2
                (send gNewAct:
                    setMotion(MoveTo 248 47 self)
                    setPri(10)
                    ignoreControl(16384 2048)
                    observeControl(8192)
                )
                = local0 3
            )
            (case 3
                = local0 4
                (send gNewAct:
                    setMotion(Chase gEgo 10 self)
                    observeControl(4 16384)
                    ignoreControl(8192)
                    setPri(-1)
                )
                = state 7
            )
            (case 4
                (send gNewAct:
                    ignoreControl(2048)
                    setMotion(MoveTo 252 51 self)
                )
            )
            (case 5
                = local0 3
                (send gNewAct:
                    observeControl(2048)
                    setMotion(MoveTo 290 156 self)
                    ignoreControl(16384)
                    setPri(10)
                    observeControl(8192)
                )
            )
            (case 6
                = local0 2
                (send gNewAct:
                    setMotion(Chase gEgo 10 self)
                    observeControl(16384)
                    setPri(-1)
                    ignoreControl(8192)
                )
                = state 7
            )
            (case 7
                (send gNewAct:setMotion(Chase gEgo 10 self))
            )
            (case 8
                proc0_2()
                (send gNewAct:posn((send gEgo:x) (send gEgo:y)))
                (send gEgo:
                    view(106)
                    setLoop(4)
                    cel(255)
                    ignoreHorizon()
                    illegalBits(0)
                    setCycle(End)
                    setPri((send gEgo:priority))
                    setStep(4 4)
                    setMotion(MoveTo + (send gEgo:x) 11 - (send gEgo:y) 15 self)
                )
            )
            (case 9
                (send gEgo:
                    setLoop(5)
                    setCycle(Fwd)
                )
                (send gNewAct:
                    view(106)
                    setLoop(6)
                    illegalBits(0)
                    setPri((send gEgo:priority))
                    setCycle(Fwd)
                    show()
                )
                = seconds 2
            )
            (case 10
                (send gNewAct:
                    view(106)
                    setLoop(7)
                    setPri((send gEgo:priority))
                    setCycle(Fwd)
                )
                = seconds 4
            )
            (case 11
                (send gEgo:hide())
                = newSound (Sound:new())
                (send newSound:
                    number(97)
                    loop(-1)
                    priority(99)
                    play()
                )
                (send gNewAct:
                    setLoop(8)
                    setCycle(Fwd)
                )
                = seconds 6
            )
            (case 12
                (send newSound:stop())
                (send gNewAct:
                    setLoop(8)
                    setCel(0)
                )
                proc0_17(901 0 14 16)
            )
        )
    )

)
(instance doPulley of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return 
        )
        (if (((== local3 1) and (== local0 4)) and (send global5:contains(gNewAct)))
            (if (((== (send thePulley1:heading) 90) and (< Abs((- (send gNewAct:x) (send thePulley1:x))) 12)) and ((((== thePulley1 pulley1) and (> (send gNewAct:y) 41)) and (< (send gNewAct:y) 49)) or (((== thePulley1 pulley2) and (> (send gNewAct:y) 60)) and (< (send gNewAct:y) 72))))
                (if ((< (send gNewAct:x) 113) or (> (send gNewAct:x) 192))
                    = local3 3
                    proc255_0(421 44)
                )(else
                    (self:changeState(5))
                )
            )(else
                (if (((== (send thePulley1:heading) 270) and (< Abs((- (send thePulley1:x) (send gNewAct:x))) 12)) and ((((== thePulley1 pulley1) and (> (send gNewAct:y) 41)) and (< (send gNewAct:y) 49)) or (((== thePulley1 pulley2) and (> (send gNewAct:y) 60)) and (< (send gNewAct:y) 72))))
                    (if ((< (send gNewAct:x) 113) or (> (send gNewAct:x) 192))
                        proc255_0(421 44)
                        = local3 3
                    )(else
                        (self:changeState(5))
                    )
                )
            )
        )
        (if ((== local3 1) and (((< (send thePulley1:x) 39) and (== (send thePulley1:heading) 270)) or ((> (send thePulley1:x) 230) and (== (send thePulley1:heading) 90))))
            (send thePulley1:
                cel(1)
                setMotion(0)
                stopUpd()
            )
            = state 4
            proc0_10()
            proc255_0(421 45)
            = local3 0
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if ((send global5:contains(gNewAct)) and (< (send gEgo:distanceTo(gNewAct)) 25))
                    proc255_0(421 46)
                    (send gEgo:setScript(0))
                )(else
                    (if (((== global104 4) and (< (send gEgo:y) 49)) and (< Abs((- (send gEgo:x) (pulley1:x))) 10))
                        = thePulley1 pulley1
                        (self:changeState(1))
                    )(else
                        (if (((== global104 4) and (> (send gEgo:y) 61)) and (< Abs((- (send gEgo:x) (pulley2:x))) 10))
                            = thePulley1 pulley2
                            (self:changeState(1))
                        )(else
                            proc0_5()
                            (send gEgo:setScript(0))
                        )
                    )
                )
            )
            (case 1
                proc255_0(421 47 67 -1 - (send gEgo:y) 20)
                (switch ((send gEgo:loop))
                    (case 0
                        (send thePulley1:
                            startUpd()
                            cel(0)
                            xStep(8)
                            setMotion(MoveTo + (send thePulley1:x) 50 (send thePulley1:y) self)
                        )
                    )
                    (case 1
                        (send thePulley1:
                            startUpd()
                            cel(2)
                            xStep(6)
                            setMotion(MoveTo - (send thePulley1:x) 50 (send thePulley1:y) self)
                        )
                    )
                    (default 
                        (if ((send global5:contains(gNewAct)))
                            (if (< (send gEgo:x) (send gNewAct:x))
                                (send thePulley1:
                                    startUpd()
                                    cel(0)
                                    xStep(8)
                                    setMotion(MoveTo + (send thePulley1:x) 50 (send thePulley1:y) self)
                                )
                            )(else
                                (send thePulley1:
                                    startUpd()
                                    cel(2)
                                    xStep(8)
                                    setMotion(MoveTo - (send thePulley1:x) 50 (send thePulley1:y) self)
                                )
                            )
                        )(else
                            (send thePulley1:
                                startUpd()
                                cel(0)
                                xStep(8)
                                setMotion(MoveTo + (send thePulley1:x) 50 (send thePulley1:y) self)
                            )
                        )
                    )
                )
                = local3 1
            )
            (case 2
                (if (== (send thePulley1:heading) 90)
                    (send thePulley1:
                        cel(1)
                        setMotion(MoveTo + (send thePulley1:x) 50 (send thePulley1:y) self)
                    )
                )(else
                    (send thePulley1:
                        cel(1)
                        setMotion(MoveTo - (send thePulley1:x) 50 (send thePulley1:y) self)
                    )
                )
            )
            (case 3
                (if (== (send thePulley1:heading) 90)
                    (send thePulley1:
                        cel(2)
                        setMotion(MoveTo + (send thePulley1:x) 50 (send thePulley1:y) self)
                    )
                )(else
                    (send thePulley1:
                        cel(0)
                        setMotion(MoveTo - (send thePulley1:x) 50 (send thePulley1:y) self)
                    )
                )
            )
            (case 4
                = local3 0
                (send thePulley1:
                    cel(1)
                    setMotion(0)
                    stopUpd()
                )
            )
            (case 5
                = local3 2
                (if (== (send thePulley1:heading) 90)
                    (send thePulley1:
                        cel(1)
                        setMotion(MoveTo - (send thePulley1:x) 15 (send thePulley1:y))
                    )
                )(else
                    (send thePulley1:
                        cel(1)
                        setMotion(MoveTo + (send thePulley1:x) 15 (send thePulley1:y))
                    )
                )
                = local0 6
                proc0_2()
                = newView_2 (View:new())
                (send newView_2:
                    view(120)
                    loop(1)
                    cel(3)
                    posn((send gNewAct:x) - (send gNewAct:y) 30)
                    setPri(15)
                    init()
                )
                (send gNewAct:
                    view(120)
                    setLoop(- 3 (& (send gNewAct:loop) $0001))
                    cel(255)
                    illegalBits(0)
                    setCycle(End)
                    setStep(6 4)
                    setMotion(MoveTo 160 55 self)
                )
                = seconds 2
            )
            (case 6
                (send newView_2:dispose())
            )
            (case 7
                (deathSound:
                    number(91)
                    priority(20)
                    play()
                )
                (send gNewAct:
                    setLoop(4)
                    setCycle(Fwd)
                    setPri(-1)
                    setMotion(MoveTo 160 127 self)
                )
            )
            (case 8
                proc0_3()
                = local0 5
                (send gNewAct:
                    ignoreActors(0)
                    setCel(6)
                    setPri(0)
                    stopUpd()
                )
                = gNewView (View:new())
                (send gNewView:
                    view(120)
                    loop(5)
                    cel(0)
                    posn(157 124)
                    setPri(1)
                    init()
                )
                (send global1:changeScore(35))
                proc0_14(16 421)
                (send gEgo:setScript(0))
                (send global2:setScript(bringOnFester))
                = global117 421
                = global110 3
            )
        )
    )

)
(instance smash of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (deathSound:
                    number(92)
                    priority(21)
                    play()
                )
                (send gEgo:
                    view(120)
                    setLoop(6)
                    illegalBits(0)
                    ignoreActors()
                    posn(156 63)
                    setPri(7)
                    setCycle(Fwd)
                )
                = seconds 7
                (if ((((send global5:contains(gNewAct)) and (< local0 5)) and (send global5:contains(gNewAct))) and (== (send gNewAct:script) termChase))
                    (send global2:setScript(0))
                    (send gNewAct:setMotion(0))
                )
            )
            (case 1
                proc0_17(901 0 3 99)
            )
        )
    )

)
(instance bringOnFester of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return 
        )
        (if ((== local1 2) and (& (send gEgo:onControl(0)) $1000))
            (self:changeState(10))
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 60
            )
            (case 1
                (send gEgo:observeControl(4096))
                = local1 1
                (elevator:
                    setCel(5)
                    setPri(9)
                    setMotion(MoveTo 56 83 self)
                )
                (cable1:
                    cel(9)
                    setCycle(Beg)
                )
            )
            (case 2
                (elevator:
                    setPri(9)
                    setMotion(MoveTo 56 85 self)
                )
            )
            (case 3
                proc0_2()
                (pulley1:startUpd())
                (pulley2:
                    setPri(14)
                    startUpd()
                )
                (gear:
                    setCycle(Fwd)
                    startUpd()
                )
                (send gLongSong:
                    loop(-1)
                    play()
                )
                == local8 -200
                proc0_10()
                proc255_0(421 48 67 66 53 91 80 "Fester")
                = seconds 8
            )
            (case 4
                proc0_12()
                proc0_10()
                proc255_0(421 49 67 66 29 91 80 "Fester")
                = seconds 12
            )
            (case 5
                proc0_12()
                proc255_0(421 50 67 66 65 91 80 "Fester")
                (send gEgo:ignoreControl(4096))
                = local1 2
                = seconds 4
            )
            (case 6
                proc0_12()
                proc0_3()
                (send gEgo:ignoreControl(4096))
                = seconds 15
            )
            (case 7
                proc0_12()
                proc255_0(421 51 67 66 64 25 5 80 "Fester")
                --state
                = seconds 20
            )
            (case 10
                proc0_2()
                = seconds 0
                (pulley1:stopUpd())
                (pulley2:stopUpd())
                (send gEgo:
                    view(777)
                    stopUpd()
                )
                (elevTop:
                    view(777)
                    stopUpd()
                )
                (elevBottom:
                    view(777)
                    stopUpd()
                )
                (elevator:
                    setLoop(2)
                    setCel(6)
                    setMotion(MoveTo (elevator:x) 220 self)
                )
                (cable1:setCycle(End))
            )
            (case 11
                (send global2:newRoom(42))
            )
        )
    )

)
(instance fall of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (bringOnFester:seconds(0))
                (send global2:setScript(0))
                (elevator:
                    view(94)
                    setLoop(0)
                    cel(255)
                    yStep(9)
                    ignoreActors()
                    illegalBits(0)
                    posn(56 (send gEgo:y))
                    cycleSpeed(3)
                    setCycle(End)
                    init()
                )
                (deathSound:
                    number(45)
                    priority(12)
                    loop(1)
                    play()
                )
                (send gEgo:
                    ignoreActors()
                    illegalBits(0)
                    setPri(8)
                    yStep(15)
                    posn(64 127)
                    setCycle(0)
                    setMotion(MoveTo 64 300 self)
                )
                = global104 7
                (if ((send global5:contains(gNewAct)) and (< local0 5))
                    (send gNewAct:
                        setScript(0)
                        setMotion(0)
                    )
                )
            )
            (case 1
                (elevator:hide())
                = seconds 6
            )
            (case 2
                proc0_17(901 0 0 1)
            )
        )
    )

)
(instance lowerEgoElevator of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = global104 1
                (send gEgo:setMotion(MoveTo 56 129 self))
            )
            (case 1
                (send gEgo:
                    view(777)
                    stopUpd()
                )
                (elevTop:
                    view(777)
                    stopUpd()
                )
                (elevBottom:
                    view(777)
                    stopUpd()
                )
                (elevator:
                    view(83)
                    setLoop(2)
                    setCel(2)
                    setPri(8)
                    illegalBits(0)
                    ignoreActors()
                    posn((elevBottom:x) (elevBottom:y))
                    setMotion(MoveTo (elevBottom:x) 220 self)
                    init()
                )
                (cable1:setCycle(End))
            )
            (case 2
                (send global2:newRoom(420))
            )
        )
    )

)
(instance gearActions of Script
    (properties)

    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return <> global11 global13
        )
        return 
            (if (not global124)
                (if (== local4 0)
                    (if ((((== global104 7) or (== local3 1)) or (== local0 6)) or (>= local8 200))
                        = local8 0
                        (gear:
                            setCycle(Fwd)
                            startUpd()
                        )
                        (send gLongSong:
                            loop(-1)
                            play()
                        )
                        = local4 1
                    )(else
                        ++local8
                    )
                )(else
                    (if ((<> global104 7) and ((>= local8 40) or ((send global5:contains(elevator)) and (< (elevator:y) 189))))
                        = local4 0
                        (gear:
                            setCycle(0)
                            stopUpd()
                        )
                        (send gLongSong:stop())
                        = local8 0
                    )(else
                        ++local8
                    )
                )
            )(else
                0
            )
    )

)
