(version 2)
(include "sci.sh")
(exports
    0 rm430
)
(use "Main")
(use "TellerIcon")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Cycle")
(use "Game")
(use "User")
(use "View")
(use "Obj")
(script 430)


(local
    local0
    local1
    local2
    local3
    local4
    local5 =     160
    local6 =     130
    local7
    local8
    local9
    local10
    local11
    local12
    local13
    local14[12] = (0 50 -30 5 -53 -51 4 -31 -20 -15 -23 999 )
    local26[2]
    local28[6] = (0 -61 -54 -12 -58 999 )
    local34[4] = (0 -3 -24 999 )
    local38[3] = (0 -62 999 )
    local41[3] = (0 2 999 )
    local44[4] = (0 -60 -7 999 )
    local48[3] = (0 6 999 )
    local51[3] = (0 -56 999 )
    local54[3] = (0 9 999 )
    local57[3] = (0 -16 999 )
    local60[3] = (0 -17 999 )
    local63[4] = (0 -59 -18 999 )
    local67[3] = (0 -21 999 )
    local70[3] = (0 19 999 )
    local73[3] = (0 22 999 )
    local76[3] = (0 -57 999 )
    local79[3] = (0 14 999 )
    local82[5] = (0 -26 29 -25 999 )
    local87[3] = (0 -27 999 )
    local90[3] = (0 28 999 )
    local93[20] = (0 -61 -54 -12 -58 -3 -24 -62 -60 -7 -56 -16 -17 -59 -18 -21 -57 -26 -27 999 )
    local113[20]
    local133[7] = (0 -34 -3 -37 -38 -19 999 )
    local140[4] = (0 -35 -6 999 )
    local144[3] = (0 -36 999 )
    local147[4] = (0 -34 -6 999 )
    local151[4]

)
(procedure (localproc_1ad8 param1)
    return * 2 (/ (+ (* param1 800) (- local3 1)) local3)
)


(procedure (localproc_1aec)
    return 
        (if (not (send gGQg3KDHandler:contains(ScriptID(35 1))) and not local7)
            not local9
        )(else
            0
        )
)


(instance public rm430 of Rm
    (properties
        noun 4
        picture 430
        vanishingY -300
    )

    (method (init)
        proc0_2()
        (send global2:addObstacle((send ((Polygon:new())):
                type(3)
                init(263 117 219 117 172 106 175 98 141 98 131 91 64 91 64 153 101 139 116 128 168 128 199 128 199 165 183 189 263 189)
                yourself()
            )
))
        (mat:
            approachVerbs(4)
            init()
        )
        (send gLongSong:
            setLoop(-1)
            changeTo(430)
        )
        (send gLongSong3:
            number(913)
            setLoop(-1)
            play()
        )
        (fire:
            setCycle(Fwd)
            init()
        )
        (shield:init())
        (zebra:init())
        (leftbed:init())
        (rightbed:init())
        (wall:init())
        (fireplace:init())
        (basket:init())
        (log:init())
        = local26[0] @local14
        (egoActions:init(gOwner @local14 @local26))
        (if (not == gGClientModNum 440)
            (send gQg3Walkers:addToFront(global2))
        )
        (if (== gGClientModNum 440)
            (send global2:setScript(firstTime))
        )(else
            (if (proc0_6(118))
                (self:style(8))
                (send global2:setScript(afterStory))
            )(else
                (send global2:setScript(enterRoom))
            )
        )
        (chestLid:
            approachVerbs(4 58)
            init()
            stopUpd()
        )
        (chest:
            approachVerbs(4 58)
            init()
        )
        (super:init())
    )


    (method (doit param1)
        (if (GameIsRestarting() and (== (send gOwner:view) 40))
            = local0 1
        )(else
            (if ((send global2:script))
                0
            )(else
                (if ((send gOwner:mover) and (== (send gOwner:view) 40))
                    (if (IsObject((send gOwner:looper)))
                        (send ((send gOwner:looper)):dispose())
                    )
                    (send gOwner:
                        setMotion(0)
                        setScript(egoGetUp)
                    )
                )(else
                    (if ((> (send gOwner:y) 155) and (> (send gOwner:x) 170))
                        (send global2:setScript(exitRoom))
                    )
                )
            )
        )
        (super:doit(rest param1))
    )


    (method (dispose)
        (send gLongSong2:stop())
        (send gLongSong3:stop())
        (send gQg3Walkers:delete(global2))
        proc958_0(0 29 34 35)
        (super:dispose())
    )


    (method (doVerb theVerb)
        return 
            (switch (theVerb)
                (case 74
                    (if ((send gGQg3KDHandler:contains(ScriptID(34 1))))
                        (self:setScript(uhuraGoodNight 0 0))
                    )(else
                        (self:setScript(goToBed))
                    )
                )
                (case 3
                    (egoActions:doVerb(3))
                )
                (case 84
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(28)))
                            (send (ScriptID(31 0)):init((send gOwner:x) (+ (send gOwner:y) 1) 20))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 82
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(26)))
                            (self:setScript(ScriptID(37 0)))
                            return 1
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 81
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(25)))
                            (self:setScript(ScriptID(32 0) self 81))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 83
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(27)))
                            (self:setScript(ScriptID(32 0) self 83))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 75
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(19)))
                            proc0_14((send ((User:curEvent)):x) (send ((User:curEvent)):y))
                            (send gOwner:setScript(ScriptID(13) 0 chest))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 88
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(32)))
                            (self:setScript(ScriptID(32 0) self 88))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 80
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(24)))
                            (send gOwner:setScript(ScriptID(12 0) 0 80))
                            (super:doVerb(80))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 86
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(30)))
                            (send gOwner:setScript(ScriptID(62 0)))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 78
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(22)))
                            (send gOwner:setScript(ScriptID(12 0) 0 78))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 76
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(20)))
                            (send gOwner:setScript(ScriptID(12 0) 0 76))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 77
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(21)))
                            (send gOwner:setScript(ScriptID(12 0) 0 77))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 85
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(29)))
                            (self:setScript(ScriptID(12 0) 0 85))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case 87
                    (if (localproc_1aec())
                        (send gOwner:addHonor(-5))
                        (if ((send gOwner:castSpell(31)))
                            (send gOwner:setScript(ScriptID(46 0)))
                        )
                    )(else
                        (send gQg3Messager:say(9 6 45 0 0))
                    )
                )
                (case -77
                    (send gQg3Messager:say(0 0 2 1 0 12))
                )
                (case -76
                    (send gQg3Messager:say(0 0 1 1 0 12))
                )
                (case -80
                    (send gQg3Messager:say(0 0 4 1 0 12))
                )
                (default 
                    (super:doVerb(theVerb))
                )
            )
    )

)
(instance egoActions of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(50 (send gGQg3KDHandler:contains(ScriptID(35 1))) -30 (send gGQg3KDHandler:contains(ScriptID(35 1))) 5 (send gGQg3KDHandler:contains(ScriptID(35 1))) -53 
            (if (not local8)
                local7
            )(else
                0
            )
 -51 
            (if (not local8)
                local7
            )(else
                0
            )
 4 
            (if (not local12 and local7)
            )(else
                local9
            )
 -31 
            (if (not local12 and local7)
            )(else
                local9
            )
 -20 localproc_1aec() -15 
            (if (global121)
                localproc_1aec()
            )(else
                0
            )
 -23 localproc_1aec()))
    )


    (method (doChild)
        return 
            (switch (query)
                (case -53
                    = local8 1
                    proc0_2()
                    (send gQg3Messager:say(2 5 53 0))
                    (send global2:setScript(walkUhuraIn))
                    return 0
                )
                (case -51
                    = local8 1
                    = local12 1
                    return 1
                )
                (case -31
                    = local8 1
                    (send gQg3Messager:say(2 5 31))
                    (send global2:setScript(uhuraGoodNight 0 1))
                    return 0
                )
                (case -20
                    = query 13
                    return 1
                )
                (case -15
                    = query 13
                    return 1
                )
                (case -23
                    = query 13
                    return 1
                )
                (case -30
                    (send gQg3Messager:say(2 5 30))
                    (send global2:doVerb(74))
                    return 0
                )
            )
    )


    (method (doVerb theVerb)
        return 
            (switch (theVerb)
                (case 3
                    (if ((send global2:script))
                        0
                    )(else
                        (if (== (send gOwner:view) 40)
                            = local5 (send ((User:curEvent)):x)
                            = local6 (send ((User:curEvent)):y)
                            (send global2:setScript(egoGetUp))
                            return 1
                        )
                    )
                )
                (case 2
                    (super:doVerb(theVerb))
                )
                (default 
                    (send gOwner:doVerb(theVerb))
                )
            )
    )

)
(instance rakeeshTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-24 (== global362 1) 2 (== global362 1)))
    )


    (method (doChild param1)
        return 
            (if (== query -25)
                (send global2:setScript(checkForMagic))
                return 0
            )(else
                (super:doChild(rest param1))
            )
    )

)
(instance uhuraTell of Teller
    (properties)

    (method (doChild)
        (switch (query)
            (case -34
                = local2 (| local2 $0001)
                (super:doChild(query))
            )
            (case -3
                = local2 (| local2 $0002)
                return 1
            )
            (case -37
                = local2 (| local2 $0004)
                return 1
            )
            (case -38
                = local2 (| local2 $0008)
                return 1
            )
            (case -19
                = local2 (| local2 $0010)
                return 1
            )
            (case -35
                = local2 (| local2 $0020)
                return 1
            )
            (case -36
                = local2 (| local2 $0040)
                return 1
            )
            (case -6
                = local2 (| local2 $0080)
                (super:doChild(query))
            )
        )
        = local11 1
        return local11
    )

)
(instance checkForMagic of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(1 5 25 1 self))
            )
            (case 1
                (if (gGOwnerMaxStamina[12])
                    (send gQg3Messager:say(1 5 25 2 self))
                )(else
                    = cycles 1
                )
            )
            (case 2
                (self:dispose())
            )
        )
    )

)
(instance afterStory of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                proc0_5(31)
                (send gOwner:
                    view(0)
                    setLoop(0)
                    x(102)
                    y(106)
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    signal(| (send gOwner:signal) $1000)
                    init()
                )
                = cycles 3
            )
            (case 1
                (self:setScript(goToBed self))
            )
            (case 2
                proc0_5(118)
                (self:dispose())
            )
        )
    )

)
(instance goToBed of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (local0)
                    (send gOwner:
                        view(35)
                        loop(0)
                        setCel(8)
                        x(102)
                        y(106)
                    )
                    (self:changeState((= state (+ state 2))))
                )(else
                    (send gOwner:setMotion(PolyPath 76 108 self))
                )
            )
            (case 1
                (send gOwner:
                    view(35)
                    loop(0)
                    cel(0)
                    x(102)
                    y(106)
                    setCycle(End self)
                )
            )
            (case 2
                = seconds 3
            )
            (case 3
                (send gGQg3KDHandler:eachElementDo(102))
                (if ((send gGQg3KDHandler:contains(ScriptID(35 1))))
                    (send (ScriptID(35 1)):dispose())
                )
                (send global2:drawPic(0 9))
                = seconds 3
            )
            (case 4
                (send gGQg3KDHandler:eachElementDo(217))
                (send global2:drawPic(430 9))
                = cycles 3
            )
            (case 5
                UnLoad(129 0)
                (send (ScriptID(7 7)):init(5 40))
                (if (PalVary(pvGET_CURRENT_STEP))
                    PalVary(pvREVERSE 0)
                    proc0_5(81)
                )
                (send gOwner:setCycle(Beg self))
            )
            (case 6
                (send gOwner:
                    normalize(6)
                    cel(6)
                    x(76)
                    y(108)
                )
                = cycles 3
            )
            (case 7
                (if ((== global122 (+ global456 1)) and not proc0_6(75))
                    proc0_4(75)
                    (send gQg3Messager:say(5 6 55 0 self))
                )
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance checkTime of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                = local4 GetTime()
                = cycles 1
            )
            (case 1
                = cycles 5
            )
            (case 2
                = temp0 GetTime()
                = local3 (- temp0 local4)
                (self:dispose())
            )
        )
    )

)
(instance uhuraGoodNight of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(34 1)):setMotion(PolyPath (send (ScriptID(34 1)):x) (+ (send (ScriptID(34 1)):y) 100) self))
            )
            (case 1
                (if (register)
                    proc0_3()
                )
                = local7 0
                = local12 1
                = local9 0
                (send (ScriptID(34 1)):dispose())
                (self:dispose())
            )
        )
    )

)
(instance uhuraLeave of Script
    (properties)

    (method (doit param1)
        (if (local11)
            = local11 0
            (self:cycles(200))
        )
        (if (== local2 255)
            (self:changeState(1))
        )
        (super:doit(rest param1))
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(3 6 33))
                = local10 1
                = cycles 200
            )
            (case 1
                proc0_2()
                (send gQg3Messager:say(3 6 39 0 self))
            )
            (case 2
                (send (ScriptID(34 1)):setMotion(PolyPath (send (ScriptID(34 1)):x) (+ (send (ScriptID(34 1)):y) 100) self))
            )
            (case 3
                proc0_3()
                = local7 0
                = local12 1
                = local9 0
                (send (ScriptID(34 1)):dispose())
                (self:dispose())
            )
        )
    )

)
(instance stopEgo of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                = local8 1
                (send gOwner:setMotion(0))
                (send gQg3Messager:say(2 3 52 0 self))
            )
            (case 1
                (send gOwner:setMotion(PolyPath 190 135 self))
            )
            (case 2
                (send gOwner:setHeading(180))
                = cycles 18
            )
            (case 3
                (send client:setScript(walkUhuraIn))
            )
        )
    )

)
(instance walkUhuraIn of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local9 1
                = local151[0] @local133
                = local151[1] @local140
                = local151[2] @local144
                (uhuraTell:init(ScriptID(34 1) @local133 @local151 @local147))
                (send (ScriptID(34 1)):
                    x(200)
                    y(250)
                    noun(3)
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    init()
                    setCycle(Walk)
                    setMotion(MoveTo 200 155 self)
                )
            )
            (case 1
                (send (ScriptID(34 1)):setScript(uhuraLeave))
                = cycles 1
            )
            (case 2
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance exitRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if ((((((proc0_6(29) and not proc0_6(38)) and (== global123 5)) and not local0) and not local9) and not local12) and (<> global122 global456))
                    (send client:setScript(stopEgo))
                )
                proc0_2()
                (if (local9 and (send gGQg3KDHandler:contains(ScriptID(34 1))))
                    (send gOwner:setMotion(0))
                    (send gQg3Messager:say(2 3 54))
                    (send (ScriptID(34 1)):setMotion(PolyPath (send (ScriptID(34 1)):x) (+ (send (ScriptID(34 1)):y) 50) self))
                )(else
                    = cycles 1
                )
            )
            (case 1
                (send gOwner:setMotion(PolyPath (send gOwner:x) (+ (send gOwner:y) 30) self))
            )
            (case 2
                (send global2:newRoom(420))
            )
        )
    )

)
(instance uhuraTryEnter of Script
    (properties)

    (method (doit)
        (if (local9)
            (self:dispose())
        )(else
            (if (local8)
                = local7 0
                (self:dispose())
            )
        )
        (super:doit())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = local7 1
                (send gQg3Messager:say(3 6 52 0 self))
            )
            (case 1
                = cycles localproc_1ad8(10)
            )
            (case 2
                (send gQg3Messager:say(3 6 52))
                = cycles localproc_1ad8(10)
            )
            (case 3
                = local7 0
                = local12 1
                (self:dispose())
            )
        )
    )

)
(instance egoGetUp of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setCycle(Beg self))
            )
            (case 1
                (send gOwner:
                    view(0)
                    normalize()
                    setMotion(PolyPath local5 local6)
                )
                = local0 0
                (send gQg3Walkers:delete(global2))
                (self:dispose())
            )
        )
    )

)
(instance firstTime of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = global456 global122
                = local113[0] @local28
                = local113[1] @local34
                = local113[2] @local57
                = local113[3] @local76
                = local113[4] @local82
                = local113[5] @local38
                = local113[6] @local41
                = local113[7] @local44
                = local113[8] @local48
                = local113[9] @local51
                = local113[10] @local54
                = local113[11] @local60
                = local113[12] @local63
                = local113[13] @local67
                = local113[14] @local70
                = local113[15] @local73
                = local113[16] @local79
                = local113[17] @local87
                = local113[18] @local90
                (rakeeshTell:init(ScriptID(35 1) @local28 @local113 @local93))
                = local0 1
                (send global2:drawPic(0))
                Animate(0)
                (send (ScriptID(7 4)):init(20 0))
                (if ((send gOwner:looper))
                    (send ((send gOwner:looper)):dispose())
                    (send gOwner:looper(0))
                )
                (send gOwner:
                    view(40)
                    setCycle(0)
                    setLoop(-1)
                    setLoop(0)
                    setMotion(0)
                    cel(5)
                    x(103)
                    y(105)
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    actions(egoActions)
                    noun(2)
                    signal(| (send gOwner:signal) $1000)
                    init()
                )
                (send (ScriptID(35 1)):
                    view(432)
                    loop(2)
                    cel(0)
                    x(232)
                    y(105)
                    noun(1)
                    signal(| (send (ScriptID(35 1)):signal) $1000)
                    init()
                )
                = seconds 1
            )
            (case 1
                (if (PalVary(pvGET_CURRENT_STEP))
                    PalVary(pvCHANGE_TICKS 1)
                )
                (send gQg3Messager:say(1 6 1 0 self))
            )
            (case 2
                UnLoad(129 0)
                (switch (global362)
                    (case 0
                        (send gQg3Messager:say(1 6 43 0 self))
                    )
                    (case 1
                        proc0_4(133)
                        (send gQg3Messager:say(1 6 6 0 self))
                    )
                    (case 2
                        (send gQg3Messager:say(1 6 42 0 self))
                    )
                )
            )
            (case 3
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance sitDown of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(PolyPath 103 105 self))
            )
            (case 1
                (if ((send gOwner:looper))
                    (send ((send gOwner:looper)):dispose())
                    (send gOwner:looper(0))
                )
                (send gOwner:
                    view(40)
                    setLoop(0)
                    setCycle(End self)
                )
                = local0 1
            )
            (case 2
                (if (((((proc0_6(29) and not proc0_6(38)) and (== global123 5)) and not local7) and not local12) and (<> global122 global456))
                    (send gOwner:setScript(uhuraTryEnter))
                )
                = cycles 1
            )
            (case 3
                (send gQg3Walkers:addToFront(global2))
                (self:dispose())
            )
        )
    )

)
(instance enterRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (if (not proc0_6(75) and (== global122 global456))
                    = local113[0] @local28
                    = local113[1] @local34
                    = local113[2] @local57
                    = local113[3] @local76
                    = local113[4] @local82
                    = local113[5] @local38
                    = local113[6] @local41
                    = local113[7] @local44
                    = local113[8] @local48
                    = local113[9] @local51
                    = local113[10] @local54
                    = local113[11] @local60
                    = local113[12] @local63
                    = local113[13] @local67
                    = local113[14] @local70
                    = local113[15] @local73
                    = local113[16] @local79
                    = local113[17] @local87
                    = local113[18] @local90
                    (rakeeshTell:init(ScriptID(35 1) @local28 @local113 @local93))
                    (send (ScriptID(35 1)):
                        view(432)
                        loop(2)
                        cel(0)
                        x(232)
                        y(105)
                        noun(1)
                        signal(| (send (ScriptID(35 1)):signal) $1000)
                        init()
                    )
                )
                (send gOwner:
                    normalize()
                    x(240)
                    y(180)
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    actions(egoActions)
                    noun(2)
                    setMotion(PolyPath 240 150 self)
                    signal(| (send gOwner:signal) $1000)
                    init()
                )
            )
            (case 1
                (if ((== global122 global456) and (== gGClientModNum 420))
                    (send gQg3Messager:say(1 6 41 0 self))
                )(else
                    (if ((== global122 (+ global456 1)) and not proc0_6(75))
                        proc0_4(75)
                        (send gQg3Messager:say(5 6 46 0 self))
                    )(else
                        (if (proc0_6(29) and (== global123 5))
                            (self:setScript(checkTime self))
                        )(else
                            (if ((<> global122 global464) and (== global123 5))
                                (send gQg3Messager:say(5 6 63 0 self))
                            )(else
                                = ticks 1
                            )
                        )
                    )
                )
            )
            (case 2
                = global464 global122
                proc0_3()
                proc0_16()
                (self:dispose())
            )
        )
    )

)
(instance walkToChest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (self:setScript(egoGetUp self))
            )
            (case 1
                proc0_2()
                (send gOwner:setMotion(PolyPath 155 99 self))
            )
            (case 2
                (chest:doVerb(register))
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance useChest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (chestLid:setLoop(1))
                (send gLongSong2:
                    number(311)
                    setLoop(1)
                    play()
                )
                (send gOwner:
                    view(4)
                    setLoop(0)
                    cel(0)
                    setCycle(CT 2 1 self)
                )
            )
            (case 1
                = ticks 60
            )
            (case 2
                (send (ScriptID(29 0)):init())
                = cycles 1
            )
            (case 3
                (send gOwner:setCycle(CT 0 -1 self))
            )
            (case 4
                (send gOwner:normalize())
                (chestLid:
                    setLoop(2)
                    stopUpd()
                )
                (send gLongSong2:
                    number(312)
                    setLoop(1)
                    play()
                )
                = cycles 1
            )
            (case 5
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance useChestMag of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (chestLid:setLoop(1))
                (send gLongSong2:
                    number(311)
                    setLoop(1)
                    play()
                )
                = cycles 6
            )
            (case 1
                (send (ScriptID(29 0)):init())
                = cycles 1
            )
            (case 2
                (chestLid:
                    setLoop(2)
                    stopUpd()
                )
                (send gLongSong2:
                    number(312)
                    setLoop(1)
                    play()
                )
                = cycles 1
            )
            (case 3
                (chestLid:stopUpd())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance fillChest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (chestLid:loop(1))
                (send gLongSong2:
                    number(311)
                    setLoop(1)
                    play()
                )
                (send gOwner:
                    view(4)
                    setLoop(0)
                    cel(0)
                    setCycle(CT 2 1 self)
                )
            )
            (case 1
                = ticks 60
            )
            (case 2
                (send (ScriptID(29 1)):init(local1))
                = cycles 1
            )
            (case 3
                (send gOwner:setCycle(CT 0 -1 self))
            )
            (case 4
                (send gOwner:normalize())
                (chestLid:loop(2))
                (send gLongSong2:
                    number(312)
                    setLoop(1)
                    play()
                )
                = cycles 1
            )
            (case 5
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance warmHands of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (local0)
                    (self:setScript(egoGetUp self))
                )(else
                    = cycles 1
                )
            )
            (case 1
                proc0_2()
                (send gOwner:setMotion(PolyPath 149 130 self))
            )
            (case 2
                (send gOwner:setHeading(180))
                = cycles 18
            )
            (case 3
                (send gQg3Messager:say(7 4 0 0 self))
            )
            (case 4
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance shield of Feature
    (properties
        x 86
        y 50
        noun 10
        nsTop 26
        nsLeft 72
        nsBottom 74
        nsRight 100
        sightAngle 180
    )
)
(instance zebra of Feature
    (properties
        x 233
        y 50
        noun 11
        nsTop 24
        nsLeft 204
        nsBottom 76
        nsRight 263
        sightAngle 180
    )
)
(instance leftbed of Feature
    (properties
        x 95
        y 97
        noun 12
        nsTop 87
        nsLeft 45
        nsBottom 107
        nsRight 146
        sightAngle 180
    )
)
(instance rightbed of Feature
    (properties
        x 241
        y 100
        noun 13
        nsTop 83
        nsLeft 198
        nsBottom 118
        nsRight 284
        sightAngle 180
    )
)
(instance wall of Feature
    (properties
        x 163
        y 26
        noun 14
        nsTop 24
        nsLeft 38
        nsBottom 82
        nsRight 288
        sightAngle 180
    )
)
(instance fireplace of Feature
    (properties
        x 145
        y 136
        noun 16
        nsTop 122
        nsLeft 108
        nsBottom 150
        nsRight 183
        sightAngle 180
    )
)
(instance basket of Feature
    (properties
        x 59
        y 146
        noun 17
        nsTop 136
        nsLeft 47
        nsBottom 157
        nsRight 71
        sightAngle 180
    )
)
(instance log of Feature
    (properties
        x 81
        y 145
        noun 18
        nsTop 140
        nsLeft 73
        nsBottom 151
        nsRight 89
        sightAngle 180
    )
)
(instance chest of Feature
    (properties
        x 165
        y 82
        noun 15
        nsTop 74
        nsLeft 144
        nsBottom 95
        nsRight 192
        sightAngle 40
        approachX 155
        approachY 99
    )

    (method (doVerb theVerb param2)
        (if (== theVerb -75)
            (chestLid:setScript(useChestMag))
        )(else
            (if (== theVerb 4)
                (if (local0)
                    (send global2:setScript(walkToChest 0 theVerb))
                )(else
                    (chestLid:setScript(useChest))
                )
            )(else
                (if ((< 9 theVerb) and (< theVerb 62))
                    (if (>= theVerb 39)
                        = local1 (- theVerb 11)
                    )(else
                        = local1 (- theVerb 10)
                    )
                    (if (local0)
                        (send global2:setScript(walkToChest 0 theVerb))
                    )(else
                        (chestLid:setScript(fillChest))
                    )
                )(else
                    (super:doVerb(theVerb rest param2))
                )
            )
        )
    )

)
(instance mat of Feature
    (properties
        x 95
        y 99
        noun 6
        sightAngle 40
        onMeCheck $0004
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if ((send gOwner:script))
                    0
                )(else
                    (if (== (send gOwner:view) 40)
                        0
                    )(else
                        (send gOwner:setScript(sitDown))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance chestLid of Prop
    (properties
        x 161
        y 78
        view 430
        loop 2
        signal $4000
    )

    (method (doVerb theVerb param2)
        (chest:doVerb(theVerb rest param2))
    )

)
(instance fire of Prop
    (properties
        x 145
        y 141
        noun 7
        view 423
        priority 14
        signal $0010
        detailLevel 3
    )

    (method (doVerb theVerb param2)
        (if (not (send global2:script) and (== theVerb 4))
            (send global2:setScript(warmHands))
        )(else
            (super:doVerb(theVerb rest param2))
        )
    )

)
