(version 2)
(include "sci.sh")
(exports
    0 rm720
)
(use "Main")
(use "TellerIcon")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Sound")
(use "Cycle")
(use "Game")
(use "View")
(use "Obj")
(script 720)


(local
    local0
    local1
    local2[5] = (0 9 -8 10 999 )
    local7[2]
    local9[7] = (0 4 1 2 3 -5 999 )
    local16[3] = (0 -6 999 )
    local19[3] = (0 -7 999 )
    local22[3] = (0 -8 999 )
    local25[5] = (0 -5 -6 -7 999 )
    local30[5]

)
(instance public rm720 of Rm
    (properties
        picture 720
    )

    (method (init)
        (super:init())
        (send gLongSong:
            number(720)
            setLoop(-1)
            play(127)
        )
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 0 319 0 319 128 237 127 211 111 171 111 156 127 192 147 187 157 91 160 112 135 85 133 79 150 58 150 46 140 0 143)
                yourself()
            )
))
        = local7[0] @local2
        = local30[0] @local9
        = local30[1] @local16
        = local30[2] @local19
        = local30[3] @local22
        (manuTell:init(funkyMonkey @local9 @local30 @local25))
        (egoTell:init(gOwner @local2 @local7))
        (send gOwner:
            x(-10)
            y(160)
            setScale(189)
            normalize()
            noun(2)
            init()
        )
        (send (ScriptID(41 1)):
            x(-10)
            y(170)
            setScale(189)
            noun(12)
            init()
        )
        (tree:init())
        (treeTop:
            init()
            approachVerbs(4)
        )
        (tree:init())
        (leaves:init())
        (otherTree:init())
        (notherTree:init())
        (threeTree:init())
        (fourTree:init())
        (fern:init())
        (roots:init())
        (rocks:init())
        (funkyMonkey:init())
        (send global2:setScript(enterRoom))
    )


    (method (doit)
        (if ((> (send gOwner:z) 80) and (== script ScriptID(31 1)))
            = global67 1
            (send gOwner:solvePuzzle(321 8))
            (send global2:newRoom(730))
        )
        (if (script)
            0
        )(else
            (if (> (send gOwner:x) 10)
                0
            )(else
                (if (proc0_6(14))
                    (send global2:setScript(blockEgo))
                )(else
                    (if (not proc0_6(14))
                        (send global2:newRoom(180))
                    )
                )
            )
        )
        (super:doit())
    )


    (method (dispose)
        (funkyMonkey:dispose())
        proc958_0(0 41 31)
        (super:dispose())
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 84
                (if (local1)
                    (send global2:setScript(byeByeLance))
                )(else
                    (send (ScriptID(31 0)):init(187 131))
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance byeByeLance of Script
    (properties)

    (method (doit)
        (if (< (send gOwner:y) 5)
            (send gOwner:priority(-1))
            (send gOwner:solvePuzzle(321 8))
            (send global2:newRoom(730))
        )
        (super:doit())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(PolyPath 160 137 self))
            )
            (case 1
                (send gQg3Messager:say(3 6 13 0 self))
            )
            (case 2
                (sFx:
                    number(945)
                    play()
                )
                (send gOwner:
                    view(731)
                    setPri(10)
                    setCycle(Fwd)
                    setMotion(MoveTo 160 0 self)
                )
            )
        )
    )

)
(instance enterRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    setScale(0)
                    setMotion(PolyPath 50 160 self)
                )
            )
            (case 1
                (send (ScriptID(41 1)):stopUpd())
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance egoClimb of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 95 137 self))
            )
            (case 1
                (send gOwner:
                    setPri(10)
                    view(7)
                    loop(2)
                    cel(1)
                )
                = cycles 1
            )
            (case 2
                (sFx:
                    number(928)
                    play()
                )
                (send gOwner:
                    loop(3)
                    cel(0)
                    yStep(3)
                    setCycle(Fwd)
                    setMotion(MoveTo 95 49 self)
                )
            )
            (case 3
                (send gOwner:
                    yStep(2)
                    setPri(-1)
                    normalize(111)
                )
                = cycles 1
            )
            (case 4
                (send gOwner:solvePuzzle(321 8))
                (send global2:newRoom(730))
            )
        )
    )

)
(instance egoTryClimb of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 95 137 self))
            )
            (case 1
                (send gOwner:
                    setPri(10)
                    view(7)
                    loop(2)
                    cel(1)
                )
                = cycles 1
            )
            (case 2
                (sFx:
                    number(928)
                    play()
                )
                (send gOwner:
                    loop(3)
                    cel(0)
                    setCycle(Fwd)
                    cycleSpeed(3)
                )
                = ticks 120
            )
            (case 3
                (send gOwner:
                    view(0)
                    y(137)
                    setPri(-1)
                    normalize()
                )
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance dropRope of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (ladder:
                    init()
                    setCycle(End self)
                )
            )
            (case 1
                (sFx:
                    number(920)
                    play()
                )
                (send gOwner:setMotion(PolyPath 187 131 self))
            )
            (case 2
                (send gOwner:
                    view(7)
                    loop(2)
                    cel(1)
                    y(86)
                )
                = cycles 1
            )
            (case 3
                (send gOwner:solvePuzzle(321 8))
                (send global2:newRoom(730))
            )
        )
    )

)
(instance climbRope of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    setMotion(PolyPath 215 155 self)
                    ignoreActors(1)
                )
            )
            (case 1
                (send gOwner:
                    view(8)
                    loop(1)
                    cel(0)
                    setCycle(CT 6 1 self)
                )
            )
            (case 2
                (send gOwner:setCycle(End))
                (rope:
                    setPri(0)
                    setCycle(End self)
                    init()
                )
                (sFx:
                    number(721)
                    play()
                )
            )
            (case 3
                (send gOwner:
                    view(0)
                    setCycle(Walk)
                    setMotion(PolyPath 190 145 self)
                )
            )
            (case 4
                (send gOwner:
                    view(7)
                    setLoop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 5
                (sFx:
                    number(928)
                    play()
                )
                (send gOwner:
                    cel(1)
                    setPri(2)
                    y(100)
                    yStep(3)
                    setCycle(Fwd)
                    setMotion(MoveTo 193 0 self)
                )
            )
            (case 6
                (send gOwner:
                    normalize()
                    dispose()
                )
                = cycles 1
            )
            (case 7
                (send gOwner:solvePuzzle(321 8))
                (send global2:newRoom(730))
            )
        )
    )

)
(instance blockEgo of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gQg3Messager:say(1 6 10))
                (send gOwner:setMotion(PolyPath 50 160 self))
            )
            (case 1
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance funkyMonkey of Prop
    (properties
        x 40
        y 69
        noun 1
        view 988
        loop 3
        signal $4000
        cycleSpeed 10
        detailLevel 3
    )

    (method (doit)
        (if (not (self:cycler) and (== Random(1 120) 5))
            (self:
                loop(Random(0 3))
                cel(0)
                setCycle(End)
            )
            (sFx:
                number(929)
                play()
            )
        )
        (super:doit())
    )

)
(instance rope of Prop
    (properties
        x 190
        y 103
        view 50
        signal $4000
    )
)
(instance ladder of Prop
    (properties
        x 188
        y 27
        view 720
        signal $4000
    )
)
(instance treeTop of Feature
    (properties
        x 144
        y 16
        nsTop 5
        nsLeft 56
        nsBottom 35
        nsRight 233
        sightAngle 40
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 16
                (if (not (send global2:script))
                    (send global2:setScript(climbRope))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance leaves of Feature
    (properties
        x 137
        y 13
        noun 9
        nsTop 1
        nsLeft 33
        nsBottom 26
        nsRight 241
        sightAngle 180
    )
)
(instance otherTree of Feature
    (properties
        x 274
        y 40
        noun 5
        nsTop 9
        nsLeft 254
        nsBottom 72
        nsRight 295
        sightAngle 180
    )
)
(instance notherTree of Feature
    (properties
        x 179
        y 53
        noun 6
        nsTop 27
        nsLeft 168
        nsBottom 80
        nsRight 191
        sightAngle 180
    )
)
(instance threeTree of Feature
    (properties
        x 139
        y 55
        noun 7
        nsTop 27
        nsLeft 130
        nsBottom 83
        nsRight 149
        sightAngle 180
    )
)
(instance fourTree of Feature
    (properties
        x 24
        y 48
        noun 8
        nsLeft 4
        nsBottom 97
        nsRight 44
        sightAngle 180
    )
)
(instance fern of Feature
    (properties
        x 64
        y 172
        noun 10
        nsTop 159
        nsLeft 31
        nsBottom 186
        nsRight 98
        sightAngle 180
    )
)
(instance roots of Feature
    (properties
        x 140
        y 139
        noun 11
        nsTop 126
        nsLeft 108
        nsBottom 153
        nsRight 173
        sightAngle 180
    )
)
(instance rocks of Feature
    (properties
        x 203
        y 95
        noun 13
        nsTop 88
        nsLeft 176
        nsBottom 103
        nsRight 231
        sightAngle 180
    )
)
(instance tree of Feature
    (properties
        x 95
        y 67
        noun 4
        nsTop 11
        nsLeft 56
        nsBottom 123
        nsRight 134
        sightAngle 40
        approachX 95
        approachY 137
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (not (send global2:script))
                    (if (gGOwnerMaxStamina[11])
                        (send global2:setScript(egoClimb))
                    )(else
                        (send global2:setScript(egoTryClimb))
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance sFx of Sound
    (properties)
)
(instance egoTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-8 (== local0 1)))
    )


    (method (doChild)
        return 
            (switch (query)
                (case -8
                    (send global2:setScript(dropRope))
                    return query
                )
                (default 
                    return query
                )
            )
    )

)
(instance manuTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-5 
            (if (not > gGOwnerMaxStamina[28] 0)
                not (> gGOwnerMaxStamina[11] 0)
            )(else
                0
            )
))
    )


    (method (doChild)
        return 
            (switch (query)
                (case -8
                    = local0 1
                    return query
                )
                (case -5
                    (super:doChild(query))
                )
                (case -6
                    (super:doChild(query))
                )
                (case -7
                    (super:doChild(query))
                )
                (default 
                    return query
                )
            )
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 41
                = local1 1
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
