(version 2)
(include "sci.sh")
(exports
    0 rm75
)
(use "Main")
(use "Class_255_0")
(use "Blk")
(use "n958")
(use "DPath")
(use "Sound")
(use "Cycle")
(use "Game")
(use "User")
(use "PicView")
(use "Obj")
(script 75)


(local
    local0[2]
    local2
    local3[2]
    local5
    local6
    local7
    local8
    local9

)
(instance ratBlock of Blk
    (properties
        top 136
        left 36
        bottom 147
        right 86
    )
)
(instance public rm75 of Rm
    (properties
        picture 75
        east 74
        west 76
    )

    (method (init)
        Load(rsVIEW 275)
        Load(rsSOUND 15)
        = local5 proc0_12(32)
        (if (not local5)
            proc958_0(128 3 20 105 106)
            proc958_0(132 45 67 46 43)
            (send (ScriptID(0 21)):
                number(45)
                init()
                loop(-1)
                play()
            )
            (if ((send gEgo:has(8)) and proc0_12(9))
                Load(rsVIEW 50)
            )
        )
        (self:style(
            (switch (gGNumber)
                (case west
                    3
                )
                (case east
                    2
                )
            )
))
        (super:init())
        (if (not local5)
            = local2 0
            (rat:
                setPri(10)
                ignoreActors()
                init()
                stopUpd()
            )
            (if (>= global101 1)
                (rat:setScript(ratBlinkScript))
            )
            (send gEgo:observeBlocks(ratBlock))
            (ratEyes:
                posn(+ (rat:x) 18 - (rat:y) 37)
                setPri(11)
                init()
                hide()
                stopUpd()
            )
            (eyeBalls:
                posn((ratEyes:x) (ratEyes:y))
                setPri(11)
                init()
            )
            (tongue:
                setPri(11)
                posn(+ (rat:x) 12 - (rat:y) 35)
                init()
                hide()
                stopUpd()
            )
            (if (>= global101 1)
                (tongue:setScript(tongueScript))
            )
            (slobber:
                setPri(10)
                posn(+ (rat:x) 12 - (rat:y) 35)
                init()
                hide()
                stopUpd()
            )
            (if (>= global101 1)
                (slobber:setScript(slobberScript))
            )
            (ratGut:
                posn(+ (rat:x) 5 - (rat:y) 12)
                cycleSpeed(2)
                setPri(10)
                init()
                stopUpd()
            )
            (if (>= global101 1)
                (ratGut:setCycle(Fwd))
            )
            (ratFightCloud:
                init()
                hide()
                stopUpd()
            )
        )
        (door:
            ignoreActors()
            setPri(9)
            init()
            stopUpd()
        )
        (switch (gGNumber)
            (case west
                (send gEgo:posn(34 144))
                (door:setScript(closeDoor))
                proc0_10(32)
            )
            (default 
                (send gEgo:posn(317 proc0_17(166 (send gEgo:y) 134)))
            )
        )
        (send gEgo:init())
        proc0_1()
        (torchLight:
            setPri(4)
            init()
            stopUpd()
        )
        (if (>= global101 1)
            (torchLight:setCycle(Fwd))
        )
        (if (global124)
            = global124 Random(10 40)
        )
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            (if ((not local5 and not local7) and (== (send gEgo:onControl(1)) 64))
                (send gEgo:setMotion(0))
                (if (proc0_12(1))
                    proc255_0(75 0)
                )(else
                    proc255_0(75 1)
                )
                proc255_0(75 2)
                = local7 1
            )(else
                (if (not local5 and (== (send gEgo:onControl(1)) 4))
                    (send global2:setScript(fightRat))
                )(else
                    (if (== (send gEgo:onControl(1)) 16)
                        (send global2:setScript(openDoor))
                    )(else
                        = temp0 
                            (switch ((send ((User:alterEgo)):edgeHit))
                                (case 1
                                    north
                                )
                                (case 2
                                    east
                                )
                                (case 3
                                    south
                                )
                                (case 4
                                    west
                                )
                            )
                        (if (temp0)
                            (self:newRoom((= temp0 
                                    (switch ((send ((User:alterEgo)):edgeHit))
                                        (case 1
                                            north
                                        )
                                        (case 2
                                            east
                                        )
                                        (case 3
                                            south
                                        )
                                        (case 4
                                            west
                                        )
                                    )
)))
                        )
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (var temp0)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (local5 and (Said('/rat') or Said('//rat')))
                    proc255_0(75 3)
                )(else
                    (if (Said('trade,bargain//rat<with'))
                        proc255_0(75 4)
                    )(else
                        (if (Said('/mouse') or Said('//mouse'))
                            (if (local5)
                                proc255_0(75 5)
                            )(else
                                proc255_0(75 6)
                            )
                        )(else
                            (if ((((Said('look,look/rat') or proc255_5(rat pEvent 3)) or proc255_5(tongue pEvent 3)) or proc255_5(ratGut pEvent 3)) or proc255_5(ratEyes pEvent 3))
                                proc255_0(75 7)
                                (send pEvent:claimed(1))
                            )(else
                                (if ((Said('/rat>') or Said('//rat>')) or Said('/*<rat>'))
                                    (if (Said('bite'))
                                        proc255_0(75 8)
                                    )(else
                                        (if (Said('talk,speak'))
                                            (if (local2)
                                                proc255_0(75 9)
                                            )(else
                                                = local2 1
                                                (if (proc0_12(1))
                                                    proc255_0(75 10)
                                                )(else
                                                    proc255_0(75 11)
                                                )
                                                proc255_0(75 12)
                                            )
                                        )(else
                                            (if (Said('kill,shoot,attack,kill/'))
                                                proc255_0(75 13)
                                            )(else
                                                (if (Said('ask/[rat]/door'))
                                                    proc255_0(75 14)
                                                )(else
                                                    (if (Said('show/'))
                                                        (if (proc0_12(1))
                                                            proc255_0(75 15)
                                                        )(else
                                                            (if (Said('cheese'))
                                                                (if ((send gEgo:has(13)))
                                                                    proc255_0(75 16)
                                                                )(else
                                                                    proc0_6()
                                                                )
                                                            )(else
                                                                proc255_0(75 17)
                                                            )
                                                        )
                                                    )(else
                                                        (if (Said('cast,cast/boulder,pebble'))
                                                            (if ((send gEgo:has(9)) and not proc0_12(32))
                                                                proc0_27()
                                                                (if (== global140 0)
                                                                    proc255_0(75 18)
                                                                )(else
                                                                    proc255_0(75 19)
                                                                )
                                                            )(else
                                                                (if (proc0_12(32) and (send gEgo:has(9)))
                                                                    proc255_0(75 20)
                                                                )(else
                                                                    proc255_0(75 21)
                                                                )
                                                            )
                                                        )(else
                                                            (if (Said('cast/bucket,water'))
                                                                (if (not (send gEgo:has(8)) or not proc0_12(9))
                                                                    proc255_0(75 22)
                                                                )(else
                                                                    (if (> (send gEgo:distanceTo(rat)) 70)
                                                                        proc0_4()
                                                                    )(else
                                                                        (if ((send global2:script))
                                                                            proc0_22()
                                                                        )(else
                                                                            (send global2:setScript(waterRat))
                                                                        )
                                                                    )
                                                                )
                                                            )(else
                                                                (if (Said('capture,attack,pet,touch'))
                                                                    (if ((send global2:script))
                                                                        proc0_22()
                                                                    )(else
                                                                        (if (> (send gEgo:distanceTo(rat)) 65)
                                                                            proc255_0(75 23)
                                                                            proc255_0(75 24)
                                                                        )(else
                                                                            (send global2:setScript(fightRat))
                                                                        )
                                                                    )
                                                                )(else
                                                                    (if (Said('cast/dagger'))
                                                                        (if (not (send gEgo:has(0)))
                                                                            proc0_6()
                                                                        )(else
                                                                            (if (not proc0_12(32))
                                                                                proc255_0(75 25)
                                                                            )(else
                                                                                proc255_0(75 26)
                                                                                (send pEvent:claimed(1))
                                                                            )
                                                                        )
                                                                    )(else
                                                                        (if (Said('feed>'))
                                                                            (if (Said('/cheese'))
                                                                                (if (not (send gEgo:has(13)))
                                                                                    proc0_6()
                                                                                )(else
                                                                                    = local9 0
                                                                                    = local8 13
                                                                                )
                                                                            )(else
                                                                                (if (Said('/egg'))
                                                                                    (if (not (send gEgo:has(15)))
                                                                                        proc0_6()
                                                                                    )(else
                                                                                        = local9 6
                                                                                        = local8 15
                                                                                    )
                                                                                )(else
                                                                                    (if (Said('/nut,nut') and proc0_12(67))
                                                                                        (if (not (send gEgo:has(18)))
                                                                                            proc0_6()
                                                                                        )(else
                                                                                            = local9 6
                                                                                            = local8 18
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )
                                                                            (if (not local8)
                                                                                0
                                                                            )(else
                                                                                (if (> (send gEgo:distanceTo(rat)) 80)
                                                                                    proc255_0(75 27)
                                                                                )(else
                                                                                    (if ((send global2:script))
                                                                                        proc0_22()
                                                                                    )(else
                                                                                        (send global2:setScript(grabScript))
                                                                                    )
                                                                                )
                                                                            )
                                                                        )(else
                                                                            (if (Said('give>'))
                                                                                (if (Said('/treasure'))
                                                                                    = local9 0
                                                                                    (if ((send gEgo:has(14)))
                                                                                        (send gEgo:put(14))
                                                                                        = local9 8
                                                                                    )(else
                                                                                        (if ((send gEgo:has(16)))
                                                                                            (send gEgo:put(16))
                                                                                            = local9 8
                                                                                        )(else
                                                                                            (if ((send gEgo:has(1)))
                                                                                                (send gEgo:put(1))
                                                                                                = local9 8
                                                                                            )(else
                                                                                                (if ((send gEgo:has(11)))
                                                                                                    (send gEgo:put(11))
                                                                                                    (if (proc0_12(62))
                                                                                                        = local9 6
                                                                                                    )(else
                                                                                                        = local9 3
                                                                                                    )
                                                                                                )(else
                                                                                                    (if ((send gEgo:has(18)))
                                                                                                        (send gEgo:put(18))
                                                                                                        (if (proc0_12(67))
                                                                                                            = local9 6
                                                                                                        )(else
                                                                                                            = local9 3
                                                                                                        )
                                                                                                    )(else
                                                                                                        (if ((send gEgo:has(15)))
                                                                                                            (send gEgo:put(15))
                                                                                                            = local9 6
                                                                                                        )(else
                                                                                                            (if ((send gEgo:has(12)))
                                                                                                                (send gEgo:put(12))
                                                                                                                = local9 6
                                                                                                            )
                                                                                                        )
                                                                                                    )
                                                                                                )
                                                                                            )
                                                                                        )
                                                                                    )
                                                                                    (if (== local9 0)
                                                                                        proc255_0(75 28)
                                                                                    )(else
                                                                                        (send global2:setScript(grabScript))
                                                                                    )
                                                                                )(else
                                                                                    (if (Said('/diamond,bag'))
                                                                                        (if (not (send gEgo:has(11)))
                                                                                            proc0_6()
                                                                                        )(else
                                                                                            (if (proc0_12(62))
                                                                                                = local9 3
                                                                                            )(else
                                                                                                = local9 6
                                                                                            )
                                                                                            = local8 11
                                                                                        )
                                                                                    )(else
                                                                                        (if (Said('/mirror'))
                                                                                            (if (not (send gEgo:has(14)))
                                                                                                proc0_6()
                                                                                            )(else
                                                                                                = local9 8
                                                                                                = local8 14
                                                                                            )
                                                                                        )(else
                                                                                            (if (Said('/chest'))
                                                                                                (if (not (send gEgo:has(1)))
                                                                                                    proc0_6()
                                                                                                )(else
                                                                                                    = local9 8
                                                                                                    = local8 1
                                                                                                )
                                                                                            )(else
                                                                                                (if (Said('/ring'))
                                                                                                    (if (not (send gEgo:has(5)))
                                                                                                        proc0_6()
                                                                                                    )(else
                                                                                                        = local9 3
                                                                                                        = local8 5
                                                                                                        proc0_11(17)
                                                                                                        proc0_11(1)
                                                                                                        proc0_1()
                                                                                                    )
                                                                                                )(else
                                                                                                    (if (Said('/cheese'))
                                                                                                        (if (not (send gEgo:has(13)))
                                                                                                            proc0_6()
                                                                                                        )(else
                                                                                                            = local9 0
                                                                                                            = local8 13
                                                                                                        )
                                                                                                    )(else
                                                                                                        (if (Said('/egg'))
                                                                                                            (if (not (send gEgo:has(15)))
                                                                                                                proc0_6()
                                                                                                            )(else
                                                                                                                = local9 6
                                                                                                                = local8 15
                                                                                                            )
                                                                                                        )(else
                                                                                                            (if (Said('/nut,nut') and proc0_12(67))
                                                                                                                (if (not (send gEgo:has(18)))
                                                                                                                    proc0_6()
                                                                                                                )(else
                                                                                                                    = local9 6
                                                                                                                    = local8 18
                                                                                                                )
                                                                                                            )(else
                                                                                                                = temp0 (send gInv:firstTrue(#saidMe))
                                                                                                                (if (temp0 and (send ((= temp0 (send gInv:firstTrue(#saidMe)))):ownedBy(gEgo)))
                                                                                                                    proc255_0(75 29)
                                                                                                                )(else
                                                                                                                    (send pEvent:claimed(0))
                                                                                                                )
                                                                                                            )
                                                                                                        )
                                                                                                    )
                                                                                                )
                                                                                            )
                                                                                        )
                                                                                    )
                                                                                )
                                                                                (if (not local8)
                                                                                    0
                                                                                )(else
                                                                                    (if (> (send gEgo:distanceTo(rat)) 80)
                                                                                        proc255_0(75 30)
                                                                                    )(else
                                                                                        (if ((send global2:script))
                                                                                            proc0_22()
                                                                                        )(else
                                                                                            (send global2:setScript(grabScript))
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )(else
                                    (if (Said('bite'))
                                        proc255_0(75 31)
                                    )(else
                                        (if (Said('talk,speak'))
                                            proc255_0(75 32)
                                        )(else
                                            (if (Said('cast'))
                                                proc255_0(75 33)
                                            )(else
                                                (if (Said('attack,pet,touch'))
                                                    proc255_0(75 34)
                                                )(else
                                                    (if (Said('count/finger'))
                                                        (if (proc0_12(1))
                                                            proc255_0(75 35)
                                                        )(else
                                                            (if (local5)
                                                                proc255_0(75 36)
                                                            )(else
                                                                proc255_0(75 37)
                                                            )
                                                        )
                                                    )(else
                                                        (if (Said('listen'))
                                                            (if (local5)
                                                                proc255_0(75 38)
                                                            )(else
                                                                proc255_0(75 39)
                                                            )
                                                        )(else
                                                            (if (Said('smell,smell'))
                                                                proc255_0(75 40)
                                                            )(else
                                                                (if (Said('get,get,drink/water,drink'))
                                                                    proc255_0(75 41)
                                                                )(else
                                                                    (if (Said('light/torch,match'))
                                                                        proc255_0(75 42)
                                                                    )(else
                                                                        (if (Said('/wall[<cave]>') or (Said('/cave>') and Said('/side>')))
                                                                            (if (Said('look,look'))
                                                                                proc255_0(75 43)
                                                                            )(else
                                                                                (if (Said('climb,climb,ascend'))
                                                                                    proc255_0(75 44)
                                                                                )
                                                                            )
                                                                        )(else
                                                                            (if (Said('/boulder,mold>'))
                                                                                (if (Said('eat,consume'))
                                                                                    proc255_0(75 45)
                                                                                )(else
                                                                                    (if (Said('get'))
                                                                                        proc255_0(75 46)
                                                                                    )(else
                                                                                        (if (Said('look,look'))
                                                                                            proc255_0(75 47)
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )(else
                                                                                (if (Said('get,bend/stalactite,stalactite>'))
                                                                                    proc255_0(75 48)
                                                                                )(else
                                                                                    (if (Said('look,look>'))
                                                                                        (if (Said('/floor') or Said('<down'))
                                                                                            proc255_0(75 49)
                                                                                        )(else
                                                                                            (if (Said('[<at,around][/room,cave]'))
                                                                                                (if (not local5)
                                                                                                    proc255_0(75 50)
                                                                                                    proc255_0(75 51)
                                                                                                )(else
                                                                                                    proc255_0(75 52)
                                                                                                )
                                                                                            )(else
                                                                                                (if (Said('/stalactite,stalactite'))
                                                                                                    proc255_0(75 53)
                                                                                                )
                                                                                            )
                                                                                        )
                                                                                    )(else
                                                                                        (if (Said('give,feed/*'))
                                                                                            proc255_0(75 54)
                                                                                        )(else
                                                                                            (if (((== (send pEvent:type) 1) and (& (send pEvent:modifiers) $0003)) and (== OnControl(2 (send pEvent:x) (send pEvent:y)) -32768))
                                                                                                proc255_0(75 53)
                                                                                            )
                                                                                        )
                                                                                    )
                                                                                )
                                                                            )
                                                                        )
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance doorSound of Sound
    (properties
        priority 10
    )
)
(instance torchLight of Prop
    (properties
        x 237
        y 112
        description 7680
        view 275
        loop 1
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if (Said('get,get,get/torch'))
                proc255_0(75 55)
            )(else
                (if (proc255_5(self pEvent) or Said('look,look/torch,candle,light,flame,fire'))
                    proc255_0(75 56)
                )(else
                    (super:handleEvent(pEvent))
                )
            )
        )
    )

)
(instance door of Prop
    (properties
        x 31
        y 132
        view 275
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )
        (if (Said('look,look/door') or proc255_5(self pEvent 3))
            proc255_0(75 57)
            (send pEvent:claimed(1))
        )(else
            (if (Said('enter,open,open/door'))
                (if (proc0_12(32))
                    proc255_0(75 58)
                )(else
                    proc255_0(75 59)
                )
            )
        )
    )

)
(instance ratFightCloud of Actor
    (properties
        x 50
        y 150
        view 20
    )

    (method (doVerb)
    )

)
(instance rat of Prop
    (properties
        x 55
        y 150
        view 105
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )
        (if (Said('look,look/rat') or proc255_5(self pEvent 3))
            proc255_0(75 60)
            (send pEvent:claimed(1))
        )(else
            (if (Said('look,look/teeth'))
                proc255_0(75 61)
            )(else
                (if (Said('look,look/claw'))
                    proc255_0(75 62)
                )
            )
        )
    )

)
(instance tongue of Prop
    (properties
        x 86
        y 115
        view 105
        loop 2
    )
)
(instance slobber of Prop
    (properties
        x 86
        y 115
        view 105
        loop 1
    )
)
(instance ratGut of Prop
    (properties
        x 79
        y 138
        description 7735
        view 105
        loop 3
    )
)
(instance ratEyes of View
    (properties
        x 92
        y 113
        description 7750
        view 105
        cel 1
    )
)
(instance eyeBalls of View
    (properties
        x 92
        y 113
        description 7769
        view 105
        loop 5
    )
)
(instance waterRat of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    view(50)
                    loop(0)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 1
                = local6 1
                (ratGut:cycleSpeed(1))
                proc255_0(75 63)
                proc0_3()
                proc0_1()
                (send gEgo:loop(1))
                proc0_20(0)
                (self:dispose())
            )
        )
    )

)
(instance grabScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (== local8 13)
                    proc255_0(75 64)
                )(else
                    proc255_0(75 65)
                )
                = cycles 2
            )
            (case 1
                (send (ScriptID(0 21)):fade())
                (send gEgo:setMotion(MoveTo 105 (rat:y) self))
            )
            (case 2
                proc0_8(local8)
                (send gGame:changeScore((- 0 local9)))
                (send gEgo:
                    loop(1)
                    ignoreBlocks(ratBlock)
                    stopUpd()
                )
                (rat:setScript(0))
                (ratEyes:dispose())
                (eyeBalls:dispose())
                (tongue:
                    setScript(0)
                    dispose()
                )
                (ratGut:dispose())
                (slobber:
                    setScript(0)
                    dispose()
                )
                (send (ScriptID(0 21)):
                    number(67)
                    loop(1)
                    play()
                )
                (rat:
                    view(106)
                    setLoop(0)
                    cycleSpeed(2)
                    setCycle(End self)
                )
            )
            (case 3
                (if (proc0_12(1))
                    (if (== local8 13)
                        proc255_0(75 66)
                        proc0_19(102 2)
                    )(else
                        proc255_0(75 67)
                    )
                )(else
                    (if (== local8 13)
                        proc255_0(75 68)
                        proc0_19(102 2)
                    )(else
                        proc255_0(75 69)
                    )
                )
                (self:cue())
            )
            (case 4
                (send (ScriptID(0 21)):
                    number(43)
                    loop(1)
                    play()
                )
                (rat:
                    setLoop(1)
                    setCel(0)
                    setCycle(End self)
                )
            )
            (case 5
                (rat:dispose())
                = local5 1
                proc0_10(32)
                proc0_3()
                = cycles 2
            )
            (case 6
                (self:dispose())
            )
        )
    )

)
(instance slobberScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (slobber:
                    show()
                    setCycle(Fwd)
                )
                = cycles Random(40 60)
            )
            (case 1
                (slobber:
                    hide()
                    stopUpd()
                )
                = cycles 
                    (if (local6)
                        Random(8 15)
                    )(else
                        Random(4 8)
                    )
            )
            (case 2
                (self:changeState(0))
            )
        )
    )

)
(instance tongueScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (tongue:
                    cycleSpeed(1)
                    setCycle(Fwd)
                    show()
                )
                = cycles Random(10 20)
            )
            (case 1
                (tongue:
                    hide()
                    stopUpd()
                )
                = cycles 1
            )
            (case 2
                (tongue:setCel(0))
                = seconds Random(6 15)
            )
            (case 3
                (self:init())
            )
        )
    )

)
(instance ratBlinkScript of Script
    (properties)

    (method (doit)
        (super:doit())
        (eyeBalls:
            cel(
                (if (> (send gEgo:x) 166)
                    0
                )(else
                    (if (> (send gEgo:y) (+ (rat:y) 5))
                        2
                    )(else
                        (if (< (send gEgo:y) (- (rat:y) 5))
                            1
                        )(else
                            0
                        )
                    )
                )
)
            forceUpd()
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (ratEyes:show())
                (eyeBalls:
                    hide()
                    stopUpd()
                )
                = cycles Random(3 6)
            )
            (case 1
                (ratEyes:
                    hide()
                    stopUpd()
                )
                (eyeBalls:show())
                = seconds 
                    (if (local6)
                        Random(10 20)
                    )(else
                        Random(2 5)
                    )
            )
            (case 2
                (self:init())
            )
        )
    )

)
(instance fightRat of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (ratEyes:
                    hide()
                    stopUpd()
                )
                (eyeBalls:
                    hide()
                    stopUpd()
                )
                (tongue:
                    setScript(0)
                    hide()
                    stopUpd()
                )
                (ratGut:
                    hide()
                    stopUpd()
                )
                (slobber:
                    setScript(0)
                    hide()
                    stopUpd()
                )
                (rat:
                    setLoop(4)
                    setScript(0)
                    setCycle(End self)
                )
            )
            (case 1
                (rat:hide())
                (send gEgo:hide())
                (ratFightCloud:
                    posn(/ (+ (rat:x) (send gEgo:x)) 2 / (+ (rat:y) (send gEgo:y)) 2)
                    setLoop(2)
                    setCel(0)
                    show()
                )
                (send (ScriptID(0 21)):
                    number(46)
                    loop(1)
                    play(self)
                )
                = cycles 2
            )
            (case 2
                (rat:stopUpd())
                (send gEgo:stopUpd())
                (if (proc0_12(1))
                    proc255_0(75 70)
                )
                (ratFightCloud:
                    setLoop(0)
                    setCycle(Fwd)
                    show()
                    setMotion(MoveTo (send gEgo:x) (send gEgo:y))
                )
                = cycles 6
            )
            (case 3
                (ratFightCloud:
                    setLoop(0)
                    setMotion(MoveTo / (+ (rat:x) (- (send gEgo:x) 35)) 2 (rat:y))
                )
            )
            (case 4
                (send gEgo:
                    view(3)
                    setLoop(0)
                    setCel(0)
                    posn(82 160)
                    setCycle(0)
                    show()
                    stopUpd()
                )
                (rat:
                    setLoop(0)
                    setCel(0)
                    show()
                    stopUpd()
                )
                (if (>= global101 1)
                    (rat:setScript(ratBlinkScript))
                )
                (ratEyes:
                    show()
                    stopUpd()
                )
                (eyeBalls:
                    show()
                    stopUpd()
                )
                (tongue:
                    show()
                    stopUpd()
                )
                (if (>= global101 1)
                    (tongue:setScript(tongueScript))
                )
                (ratGut:
                    show()
                    stopUpd()
                )
                (slobber:
                    show()
                    stopUpd()
                )
                (if (>= global101 1)
                    (slobber:setScript(slobberScript))
                )
                (ratFightCloud:
                    setLoop(1)
                    setCel(0)
                    setCycle(End self)
                )
            )
            (case 5
                (ratFightCloud:hide())
                = seconds 3
            )
            (case 6
                proc0_16("Rats!  This was one shady character you shouldn't have tangled with.")
                proc0_3()
            )
        )
    )

)
(instance openDoor of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (doorSound:
                    number(15)
                    init()
                    loop(1)
                    play()
                )
                (send gEgo:stopUpd())
                (door:
                    cycleSpeed(1)
                    setCycle(End self)
                )
            )
            (case 1
                (doorSound:stop())
                (send gEgo:setMotion(DPath 24 139 -1 139 self))
            )
            (case 2
                proc0_3()
                (send global2:newRoom((send global2:west)))
            )
        )
    )

)
(instance closeDoor of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (doorSound:
                    number(16)
                    loop(1)
                    init()
                    play()
                )
                (send gEgo:stopUpd())
                (door:
                    cel(4)
                    setCycle(Beg self)
                )
            )
            (case 1
                (doorSound:stop())
                (door:stopUpd())
                (self:dispose())
            )
        )
    )

)
