(version 2)
(include "sci.sh")
(exports
    0 rm710
)
(use "Main")
(use "FPRoom")
(use "Inset")
(use "Scaler")
(use "Osc")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Cycle")
(use "View")
(use "Obj")
(script 710)


(local
    gEgoMoveSpeed

)
(instance public rm710 of FPRoom
    (properties
        noun 26
        picture 710
        style $000a
        west 250
    )

    (method (init)
        (send gEgo:
            init()
            setScale(Scaler 125 89 164 124)
            normalize()
        )
        (switch (gGNumber)
            (case west
                (send global2:setScript(sEnterFrom250))
            )
            (case 680
                (send gGame:handsOn())
            )
            (default 
                (send gEgo:
                    x(263)
                    y(150)
                    setHeading(270)
                )
                (send gGame:handsOn())
            )
        )
        (super:init())
        proc958_0(128 253)
        (inWantedSign1:loop(Random(1 2)))
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(319 189 0 189 0 154 291 154 291 125 240 125 232 135 217 135 215 144 162 144 162 135 137 135 119 132 89 132 68 147 0 147 0 0 319 0)
                yourself()
            )
))
        (sheriff:
            init()
            approachVerbs(2 49)
            setCycle(Fwd)
        )
        (clockPen:init())
        (chairLegs:init())
        (desk:
            init()
            setOnMeCheck(1 2)
        )
        (bars:
            init()
            setOnMeCheck(1 4)
        )
        (jail:
            init()
            setOnMeCheck(1 8)
        )
        (border:
            init()
            setOnMeCheck(1 16)
        )
        (guns:
            init()
            setOnMeCheck(1 32)
        )
        (table:
            init()
            setOnMeCheck(1 64)
        )
        (lamp:
            init()
            setOnMeCheck(1 128)
        )
        (clothes:
            init()
            setOnMeCheck(1 256)
        )
        (books:
            init()
            setOnMeCheck(1 512)
        )
        (bookShelf:
            init()
            setOnMeCheck(1 1024)
        )
        (wantedSign:
            init()
            setOnMeCheck(1 2048)
        )
        (clock:
            init()
            setOnMeCheck(1 4096)
        )
        (spitoon:
            init()
            setOnMeCheck(1 8192)
        )
        (trunk:
            init()
            setOnMeCheck(1 16384)
        )
        (wantedSign2:
            init()
            setOnMeCheck(1 -32768)
        )
        (bucket:
            init()
            setOnMeCheck(1 2)
        )
        (if (proc0_2(39))
            (coffee:
                init()
                setCycle(Fwd)
            )
        )
        (if (proc0_2(38))
            (pie:
                init()
                setCycle(Fwd)
            )
        )
        (if (== global119 14)
            0
        )(else
            (if (== gGNumber 250)
                0
            )(else
                (send gGameMusic1:
                    number(710)
                    flags(1)
                    loop(-1)
                    play()
                )
            )
        )
    )


    (method (dispose)
        (super:dispose())
        (send gGameMusic2:fade(80 10 16 0))
    )

)
(instance sEnterFrom250 of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gEgo:
                    x(5)
                    y(154)
                    setMotion(MoveTo 55 154 self)
                )
            )
            (case 1
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sSwingIt of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (clockPen:setCycle(End self))
            )
            (case 1
                (clockPen:setCycle(Beg self))
            )
            (case 2
                (self:changeState(0))
            )
        )
    )

)
(instance sGiveSheriffCoffee of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                (send gEgo:setHeading(90))
                = cycles 5
            )
            (case 1
                (if (proc0_2(38))
                    (send gEgo:get(-1 9))
                    (send gFpMessager:say(36 0 2 1 self))
                )(else
                    (send gEgo:get(-1 3))
                    (send gFpMessager:say(36 0 1 1 self))
                    (if ((send gEgo:has(44)))
                        = global119 17
                    )
                )
                (send gEgo:put(11))
            )
            (case 2
                (sheriff:
                    loop(1)
                    setCycle(End self)
                )
            )
            (case 3
                (sheriff:
                    loop(3)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 4
                (sheriff:
                    loop(2)
                    cel(0)
                    setCycle(Osc 1 self)
                )
                (send gEgo:
                    view(606)
                    loop(1)
                    setSpeed(10)
                    setCycle(Osc 1 self)
                )
            )
            (case 5
            )
            (case 6
                (coffee:
                    init()
                    setCycle(Fwd)
                )
                (send gGame:points(4 139))
                (if (proc0_2(38))
                    (send gFpMessager:say(36 0 2 2 3 self))
                )(else
                    (send gFpMessager:say(36 0 1 2 4 self))
                )
            )
            (case 7
                (sheriff:
                    loop(4)
                    cel(0)
                    setCycle(CT 12 1 self)
                )
            )
            (case 8
                (send gEgo:setCycle(End self))
            )
            (case 9
                (if (proc0_2(38))
                    (send gFpMessager:say(36 0 2 4 self))
                )(else
                    (send gFpMessager:say(36 0 1 5 self))
                )
            )
            (case 10
                (send gEgo:setCycle(Beg self))
                (sheriff:setCycle(End))
            )
            (case 11
                (sheriff:
                    loop(1)
                    cel(5)
                    setCycle(Beg self)
                )
            )
            (case 12
                (sheriff:
                    loop(0)
                    cel(0)
                    setCycle(Fwd)
                )
                (send gEgo:
                    normalize()
                    cel(0)
                    setSpeed(gEgoMoveSpeed)
                )
                UnLoad(128 606)
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sGiveSheriffPie of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = gEgoMoveSpeed (send gEgo:moveSpeed)
                (send gEgo:setHeading(90))
                = cycles 5
            )
            (case 1
                (if (proc0_2(39))
                    (send gEgo:get(-1 9))
                    (send gFpMessager:say(36 0 4 1 self))
                )(else
                    (send gEgo:get(-1 3))
                    (if ((send gEgo:has(44)))
                        = global119 17
                    )
                    (send gFpMessager:say(36 0 3 1 self))
                )
                (send gEgo:put(43))
            )
            (case 2
                (sheriff:
                    loop(1)
                    setCycle(End self)
                )
            )
            (case 3
                (sheriff:
                    loop(3)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 4
                (sheriff:
                    loop(2)
                    cel(0)
                    setCycle(Osc 1 self)
                )
                (send gEgo:
                    view(606)
                    loop(1)
                    setSpeed(10)
                    setCycle(Osc 1 self)
                )
            )
            (case 5
            )
            (case 6
                (pie:
                    init()
                    setCycle(Fwd)
                )
                (send gGame:points(4 140))
                (if (proc0_2(39))
                    (send gFpMessager:say(36 0 4 2 3 self))
                )(else
                    (send gFpMessager:say(36 0 3 2 3 self))
                )
            )
            (case 7
                (sheriff:
                    loop(4)
                    cel(0)
                    setCycle(CT 12 1 self)
                )
            )
            (case 8
                (send gEgo:setCycle(End self))
            )
            (case 9
                (if (proc0_2(39))
                    (send gFpMessager:say(36 0 4 4 self))
                )(else
                    (send gFpMessager:say(36 0 3 4 self))
                )
            )
            (case 10
                (send gEgo:setCycle(Beg self))
                (sheriff:setCycle(End))
            )
            (case 11
                (sheriff:
                    loop(1)
                    cel(5)
                    setCycle(Beg self)
                )
            )
            (case 12
                (sheriff:
                    loop(0)
                    cel(0)
                    setCycle(Fwd)
                )
                (send gEgo:
                    normalize()
                    cel(0)
                    setSpeed(gEgoMoveSpeed)
                )
                UnLoad(128 606)
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sheriff of Prop
    (properties
        x 191
        y 124
        noun 13
        approachX 147
        approachY 135
        view 711
        signal $1000
        cycleSpeed 10
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 49
                (if (proc0_2(39))
                    (super:doVerb(theVerb rest param2))
                )(else
                    proc0_3(39)
                    (sheriff:setScript(sGiveSheriffCoffee))
                )
            )
            (case 48
                proc0_3(38)
                (sheriff:setScript(sGiveSheriffPie))
            )
            (case 2
                (if (<= global120 1)
                    (switch (global138)
                        (case 0
                            (send gFpMessager:say(noun theVerb 6))
                            ++global138
                        )
                        (case 1
                            (send gFpMessager:say(noun theVerb 7))
                            ++global138
                        )
                        (case 2
                            (send gFpMessager:say(noun theVerb 8))
                        )
                    )
                )(else
                    (if ((== global119 9) or (== global119 8))
                        (switch (global138)
                            (case 0
                                (send gFpMessager:say(noun theVerb 9))
                                ++global138
                            )
                            (case 1
                                (send gFpMessager:say(noun theVerb 10))
                            )
                        )
                    )(else
                        (if (== global119 10)
                            (switch (global138)
                                (case 0
                                    ++global138
                                    (send gFpMessager:say(noun theVerb 11))
                                )
                                (case 1
                                    (send gFpMessager:say(noun theVerb 12))
                                )
                            )
                        )(else
                            (if (== global119 12)
                                (switch (global138)
                                    (case 0
                                        (send gFpMessager:say(noun theVerb 13))
                                        ++global138
                                    )
                                    (case 1
                                        (send gFpMessager:say(noun theVerb 14))
                                    )
                                )
                            )(else
                                (if (== global119 13)
                                    (switch (global138)
                                        (case 0
                                            (send gFpMessager:say(noun theVerb 15))
                                            ++global138
                                        )
                                        (case 1
                                            (send gFpMessager:say(noun theVerb 16))
                                        )
                                    )
                                )(else
                                    (if ((== global119 16) or (== global119 17))
                                        (send gFpMessager:say(noun theVerb 17))
                                    )(else
                                        (if (== global119 19)
                                            (send gFpMessager:say(noun theVerb 18))
                                        )(else
                                            (if (== global119 20)
                                                (switch (global138)
                                                    (case 0
                                                        (send gFpMessager:say(noun theVerb 19))
                                                        ++global138
                                                    )
                                                    (case 1
                                                        (send gFpMessager:say(noun theVerb 20))
                                                    )
                                                )
                                            )(else
                                                (if (== global119 22)
                                                    (switch (global138)
                                                        (case 0
                                                            (send gFpMessager:say(noun theVerb 21))
                                                            ++global138
                                                        )
                                                        (case 1
                                                            (send gFpMessager:say(noun theVerb 22))
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance clockPen of Prop
    (properties
        x 203
        y 73
        view 711
        loop 6
        signal $1010
        cycleSpeed 10
    )

    (method (init)
        (super:init())
        (self:setScript(sSwingIt))
    )

)
(instance pie of Prop
    (properties
        x 191
        y 98
        noun 38
        view 710
        loop 1
        signal $1000
    )
)
(instance coffee of Prop
    (properties
        x 206
        y 101
        noun 39
        view 710
        signal $1000
    )
)
(instance chairLegs of View
    (properties
        x 190
        y 127
        noun 37
        view 711
        loop 5
        priority 7
        signal $1010
    )
)
(instance desk of Feature
    (properties
        x 178
        y 86
        noun 14
    )
)
(instance bars of Feature
    (properties
        x 160
        y 200
        noun 15
    )
)
(instance jail of Feature
    (properties
        x 50
        y 86
        noun 16
    )
)
(instance border of Feature
    (properties
        x 160
        y 200
        noun 17
    )
)
(instance guns of Feature
    (properties
        x 252
        y 86
        noun 18
    )
)
(instance table of Feature
    (properties
        x 271
        y 86
        noun 19
    )
)
(instance lamp of Feature
    (properties
        x 200
        y 86
        noun 20
    )
)
(instance clothes of Feature
    (properties
        x 123
        y 86
        noun 21
    )
)
(instance books of Feature
    (properties
        x 182
        y 86
        noun 22
    )
)
(instance bookShelf of Feature
    (properties
        x 138
        y 86
        noun 23
    )
)
(instance clock of Feature
    (properties
        x 209
        y 86
        noun 25
    )
)
(instance spitoon of Feature
    (properties
        x 137
        y 86
        noun 28
    )
)
(instance trunk of Feature
    (properties
        x 267
        y 200
        noun 27
    )
)
(instance wantedSign of Feature
    (properties
        x 105
        y 86
        noun 24
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 1
                (send global2:setInset(inWantedSign1))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance wantedSign2 of Feature
    (properties
        x 218
        y 86
        noun 29
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 1
                (send global2:setInset(inWantedSign2))
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance bucket of Feature
    (properties
        x 109
        y 87
        noun 30
        nsTop 111
        nsLeft 99
        nsBottom 128
        nsRight 120
    )
)
(instance inWantedSign1 of Inset
    (properties
        view 253
        x 160
        y 88
        priority 15
        disposeNotOnMe 1
    )

    (method (doVerb)
        (self:dispose())
    )

)
(instance inWantedSign2 of Inset
    (properties
        view 253
        x 160
        y 88
        priority 15
        disposeNotOnMe 1
    )

    (method (doVerb)
        (self:dispose())
    )

)
