(version 2)
(include "sci.sh")
(exports
    0 rm730
)
(use "Main")
(use "FPRoom")
(use "Scaler")
(use "ROsc")
(use "RandCycle")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "StopWalk")
(use "Timer")
(use "Cycle")
(use "View")
(use "Obj")
(script 730)


(local
    local0

)
(instance public rm730 of FPRoom
    (properties
        picture 730
    )

    (method (init)
        (send gEgo:
            view(730)
            setLoop(0)
            x(175)
            y(93)
            init()
            setScale(Scaler 121 68 153 61)
        )
        Palette(palSET_INTENSITY 0 256 0)
        UnLoad(128 842)
        (super:init())
        proc0_3(81)
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(52 40 50 82 69 88 45 180 304 180 304 132 182 143 155 116 176 64 89 64 89 80 71 80 62 44 74 44 152 0 319 0 319 189 0 189 0 0 147 0 76 40)
                yourself()
            )
))
        (floor:init())
        (barrel:
            init()
            setOnMeCheck(1 2)
        )
        (books:
            init()
            setOnMeCheck(1 4)
        )
        (colBooks:
            init()
            setOnMeCheck(1 8)
        )
        (colCrates:
            init()
            setOnMeCheck(1 16)
        )
        (colMaps:
            init()
            setOnMeCheck(1 32)
        )
        (crates:
            init()
            setOnMeCheck(1 64)
        )
        (desks:
            init()
            setOnMeCheck(1 128)
        )
        (jester:
            init()
            setOnMeCheck(1 512)
        )
        (jug:
            init()
            setOnMeCheck(1 1024)
        )
        (lamp:
            init()
            setOnMeCheck(1 2048)
        )
        (map:
            init()
            setOnMeCheck(1 4096)
        )
        (pitcher:
            init()
            setOnMeCheck(1 256)
        )
        (oil:
            init()
            setOnMeCheck(1 8192)
        )
        (toyChest:
            init()
            setOnMeCheck(1 16384)
        )
        (drum:init())
        (jars:init())
        (piano:init())
        (smallShelf:init())
        (tallShelf:init())
        (pillar:init())
        (stairs:init())
        (penelope:
            init()
            ignoreActors()
            stopUpd()
        )
        (lantern:
            init()
            setPri(10)
            stopUpd()
            ignoreActors()
        )
        (self:setScript(sTauntFreddy))
    )


    (method (notify param1)
        (if (param1)
            (self:setScript(sCutAndRun))
        )(else
            (self:setScript(sFreddyTips))
        )
    )

)
(instance sTauntFreddy of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = cycles 1
            )
            (case 1
                (send gGameMusic1:
                    number(733)
                    loop(-1)
                    play()
                )
                proc0_15(0 2 self)
            )
            (case 2
                (send gEgo:setCycle(End self))
            )
            (case 3
                (send gFpMessager:say(2 0 0 0 self))
            )
            (case 4
                (penelope:setMotion(PolyPath 136 95 self))
            )
            (case 5
                (send gEgo:
                    view(733)
                    loop(0)
                    cel(0)
                    setCycle(End self)
                )
                (penelope:hide())
                (send gEgo:put(52))
            )
            (case 6
                UnLoad(128 733)
                (send gEgo:
                    view(730)
                    loop(2)
                    cel(0)
                    setCycle(End self)
                )
                (penelope:
                    posn(136 100)
                    show()
                )
                (ear:
                    init()
                    setScale(-1 gEgo)
                    setLoop(2)
                    setStep(10 10)
                    scaleSignal(5)
                    setCycle(Fwd)
                    setMotion(MoveTo 79 110 self)
                )
                (localSound:
                    number(2731)
                    loop(1)
                    play()
                )
            )
            (case 7
                0
            )
            (case 8
                (send gEgo:stopUpd())
                (ear:
                    setCycle(0)
                    stopUpd()
                )
                = cycles 3
            )
            (case 9
                (send gGameMusic1:pause(1))
                (localSound:
                    number(2701)
                    loop(1)
                    play(self)
                )
                (send gFpMessager:say(1 0 0 1 6 self))
            )
            (case 10
                (send gGameMusic1:pause(0))
            )
            (case 11
                (penelope:setMotion(PolyPath 82 100 self))
            )
            (case 12
                proc0_5(penelope gEgo)
                = cycles 3
            )
            (case 13
                (penelope:stopUpd())
                = cycles 100
            )
            (case 14
                (send gFpMessager:say(1 0 0 7 9 self))
            )
            (case 15
                (penelope:setMotion(PolyPath 64 88 self))
            )
            (case 16
                proc0_5(penelope gEgo)
                = cycles 3
            )
            (case 17
                (penelope:stopUpd())
                = cycles 100
            )
            (case 18
                (send gFpMessager:say(1 0 0 10 11 self))
            )
            (case 19
                (penelope:setMotion(PolyPath 64 60 self))
            )
            (case 20
                (penelope:stopUpd())
                = cycles 20
            )
            (case 21
                (send gFpMessager:say(1 0 0 12 self))
            )
            (case 22
                (penelope:setMotion(PolyPath 69 39 self))
            )
            (case 23
                (send gFpMessager:say(3 0 0 1 4 self))
                proc958_0(128 737)
            )
            (case 24
                proc0_5(penelope gEgo)
                = cycles 3
            )
            (case 25
                (penelope:stopUpd())
                = cycles 100
            )
            (case 26
                (penelope:
                    view(734)
                    setCycle(0)
                    setLoop(0)
                    cel(0)
                    x(72)
                    y(46)
                )
                = seconds 3
            )
            (case 27
                (send gFpMessager:say(3 0 0 5 7 self))
            )
            (case 28
                = cycles 100
            )
            (case 29
                (penelope:setCycle(CT 4 1 self))
            )
            (case 30
                (penelope:setCycle(End))
                (lantern:setCycle(End self))
            )
            (case 31
                (glassSound:play())
                (lantern:dispose())
                = cycles 3
            )
            (case 32
                (send gGameMusic1:
                    number(732)
                    loop(-1)
                    play()
                )
                = cycles 3
            )
            (case 33
                (fire1:
                    init()
                    setCycle(RandCycle)
                )
                = cycles 3
            )
            (case 34
                (send gFpMessager:say(4 0 0 1 self))
            )
            (case 35
                (fire2:
                    init()
                    hide()
                )
                (fireTimer:setReal(fire1 13))
                (penelope:
                    ignoreHorizon()
                    view(802)
                    setCycle(StopWalk -1)
                    setMotion(MoveTo 149 -2 self)
                )
            )
            (case 36
                (send gFpMessager:say(4 0 0 2 self))
                UnLoad(128 802)
                UnLoad(128 734)
            )
            (case 37
                (send gEgo:setCycle(End self))
            )
            (case 38
                UnLoad(128 730)
                (send gEgo:
                    view(731)
                    setLoop(0)
                    cel(3)
                )
                = seconds 1
                (send gEgo:setSpeed(6))
            )
            (case 39
                (send gIconBar:enable(2 1))
                (send gIconBar:curIcon((send gIconBar:at(2))))
                (send gGame:setCursor(2))
                (send gUser:canControl(0))
                (send gUser:input(1))
                (self:dispose())
            )
        )
    )

)
(instance sFreddyTips of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                = cycles 2
            )
            (case 1
                (if (== (send ((send gEgo:cycler)):cycleDir) 1)
                    (send gEgo:setCycle(End self))
                )(else
                    (send gEgo:setCycle(Beg self))
                )
            )
            (case 2
                (if (< (send gEgo:cel) 3)
                    (send gEgo:setCycle(CT 3 1 self))
                )(else
                    (send gEgo:setCycle(CT 3 -1 self))
                )
            )
            (case 3
                (send gEgo:
                    view(731)
                    loop(1)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 4
                = local0 1
                (send gEgo:signal((| (send gEgo:signal) $1000)))
                (send gIconBar:enable(2 1))
                (send gGame:setCursor(2))
                (send gIconBar:curIcon((send gIconBar:at(2))))
                (send gUser:canControl(0))
                (send gUser:input(1))
                (self:dispose())
            )
        )
    )

)
(instance sGetEar of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                UnLoad(128 731)
                (send gEgo:
                    view(732)
                    loop(0)
                    cel(0)
                    posn(137 94)
                    setCycle(Fwd)
                    moveSpeed(10)
                    cycleSpeed(10)
                    setMotion(MoveTo 87 112 self)
                )
            )
            (case 1
                (send gEgo:
                    loop(1)
                    cel(0)
                    setCycle(CT 4 1 self)
                )
                (ear:hide())
                (send gEgo:get(-1 52))
            )
            (case 2
                (send gFpMessager:say(27 4 2 0 self))
            )
            (case 3
                (send gIconBar:enable(2 1 6))
                (send gIconBar:curIcon((send gIconBar:at(2))))
                (send gGame:setCursor(2))
                (send gUser:canControl(0))
                (send gUser:input(1))
                (send gGame:points(1))
                (self:dispose())
            )
        )
    )

)
(instance sSharpen of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                (send gFpMessager:say(28 55 0 0 self))
                (send gEgo:get(-1 49))
                (send gEgo:put(52))
            )
            (case 1
                (localSound:
                    number(2736)
                    loop(-1)
                    play()
                )
                (send gEgo:
                    view(732)
                    loop(1)
                    cel(0)
                    setCycle(ROsc 4 5 6 self)
                )
            )
            (case 2
                (send gGame:points(10 147))
                (localSound:stop())
                (send gIconBar:disable(0))
                (send gUser:canControl(0))
                (send gUser:input(1))
                (send gInv:curIcon(0))
                (send gGame:handsOn())
                (self:dispose())
            )
        )
    )

)
(instance sCutAndRun of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gGame:handsOff())
                UnLoad(128 732)
                (send gTimers:delete(fireTimer))
                (send gEgo:
                    view(735)
                    loop(0)
                    cel(0)
                    setSpeed(12)
                    setCycle(End self)
                )
                (localSound:
                    number(2737)
                    loop(1)
                    play()
                )
            )
            (case 1
                (send gFpMessager:say(29 60 0 0 self))
                (send gGame:points(10 148))
            )
            (case 2
                UnLoad(128 735)
                (chair:
                    init()
                    ignoreActors()
                    stopUpd()
                )
                (send gGameMusic1:pause(1))
                proc0_4(81)
                (localSound:
                    number(2701)
                    loop(1)
                    play(self)
                )
                (send gEgo:
                    view(736)
                    loop(0)
                    cel(0)
                    x(86)
                    y(111)
                    setScale(0)
                    setCycle(CT 2 1 self)
                )
            )
            (case 3
            )
            (case 4
                (send gGameMusic1:pause(0))
                (send gEgo:
                    cel(2)
                    setSpeed(0)
                    setPri(1)
                    setCycle(End self)
                )
            )
            (case 5
                (send gEgo:hide())
                = cycles 3
            )
            (case 6
                proc0_15(1 5 self)
            )
            (case 7
                (send global2:newRoom(740))
                (self:dispose())
            )
        )
    )

)
(instance sTimeToDie of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    setCycle(ROsc 3 5)
                    cycleSpeed(0)
                )
                (fire2:setCycle(End self))
            )
            (case 1
                (fire3:
                    init()
                    setCycle(RandCycle)
                )
                = seconds 3
            )
            (case 2
                = global122 10
                (send global2:newRoom(99))
                (self:dispose())
            )
        )
    )

)
(instance fire1 of Prop
    (properties
        x 122
        y 72
        view 737
        cycleSpeed 10
        detailLevel 2
    )

    (method (cue)
        (if (> ++loop 2)
            = loop 2
        )
        (fireTimer:setReal(
            (if (== loop 2)
                fire2
            )(else
                fire1
            )
 10))
    )

)
(instance fire2 of Prop
    (properties
        x 267
        y 109
        view 738
        cycleSpeed 10
        detailLevel 2
    )

    (method (cue)
        (self:show())
        (if (> ++loop 4)
            = loop 1
        )
        (if (== loop 1)
            (self:setCycle(ROsc -1 0 1))
        )(else
            (self:setCycle(RandCycle))
        )
        (fireTimer:setReal(
            (if (== loop 1)
                fire3
            )(else
                fire2
            )
 10))
    )

)
(instance fire3 of Prop
    (properties
        x 76
        y 144
        view 739
        loop 1
        cycleSpeed 10
        detailLevel 2
    )

    (method (cue)
        (send global2:setScript(sTimeToDie))
    )

)
(instance penelope of Actor
    (properties
        x 103
        y 100
        view 802
    )

    (method (init)
        (super:init())
        (self:setCycle(StopWalk -1))
    )

)
(instance lantern of Prop
    (properties
        x 79
        y 17
        view 734
        loop 1
    )
)
(instance ear of Actor
    (properties
        x 123
        y 72
        noun 27
        view 732
        loop 2
        signal $4000
    )

    (method (doVerb theVerb param2)
        (switch (theVerb)
            (case 4
                (if (local0)
                    (self:setScript(sGetEar))
                )(else
                    (send gFpMessager:say(noun theVerb 1))
                )
            )
            (default 
                (super:doVerb(theVerb rest param2))
            )
        )
    )

)
(instance chair of View
    (properties
        x 87
        y 112
        view 736
        loop 1
    )
)
(instance floor of Feature
    (properties
        x 1
        y 1
        noun 28
    )

    (method (init)
        (self:setOnMeCheck(2 (send ((Polygon:new())):
                type(0)
                init(180 81 180 109 176 116 193 129 193 139 152 139 159 135 147 130 116 129 119 126 100 121 102 119 87 118 86 121 45 123 46 119 33 118 34 110 45 110 54 105 55 90 51 88 51 82)
                yourself()
            )
))
        (super:init())
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 55
                (send global2:setScript(sSharpen))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance barrel of Feature
    (properties
        x 76
        y 156
        noun 10
    )
)
(instance books of Feature
    (properties
        x 47
        y 170
        noun 11
    )
)
(instance colBooks of Feature
    (properties
        x 207
        y 118
        noun 23
    )
)
(instance colCrates of Feature
    (properties
        x 231
        y 95
        noun 24
    )
)
(instance colMaps of Feature
    (properties
        x 243
        y 99
        noun 25
    )
)
(instance crates of Feature
    (properties
        x 43
        y 79
        noun 19
    )
)
(instance desks of Feature
    (properties
        x 246
        y 40
        noun 22
    )
)
(instance jester of Feature
    (properties
        x 312
        y 133
        noun 6
    )
)
(instance jug of Feature
    (properties
        x 238
        y 174
        noun 8
    )
)
(instance lamp of Feature
    (properties
        x 305
        y 44
        noun 5
    )
)
(instance map of Feature
    (properties
        x 29
        y 131
        noun 12
    )
)
(instance pitcher of Feature
    (properties
        x 281
        y 166
        noun 7
    )
)
(instance oil of Feature
    (properties
        x 147
        y 10
        noun 26
    )
)
(instance toyChest of Feature
    (properties
        x 159
        y 173
        noun 9
    )
)
(instance drum of Feature
    (properties
        x 17
        y 56
        noun 13
        nsTop 41
        nsLeft 3
        nsBottom 73
        nsRight 29
    )
)
(instance jars of Feature
    (properties
        x 14
        y 12
        noun 14
        nsTop 3
        nsLeft 4
        nsBottom 24
        nsRight 24
        sightAngle 40
    )
)
(instance piano of Feature
    (properties
        x 158
        y 39
        noun 20
        nsTop 17
        nsLeft 137
        nsBottom 61
        nsRight 179
    )
)
(instance smallShelf of Feature
    (properties
        x 36
        y 23
        noun 16
        nsTop 11
        nsLeft 31
        nsBottom 35
        nsRight 42
    )
)
(instance tallShelf of Feature
    (properties
        x 16
        y 4
        noun 15
        nsTop -1
        nsBottom 130
        nsRight 32
    )
)
(instance pillar of Feature
    (properties
        x 212
        y 58
        noun 21
        nsLeft 184
        nsBottom 116
        nsRight 241
    )
)
(instance stairs of Feature
    (properties
        x 66
        y 53
        noun 18
        nsTop 35
        nsLeft 47
        nsBottom 72
        nsRight 85
    )
)
(instance fireTimer of Timer
    (properties)
)
(instance localSound of FPSound
    (properties
        flags $0001
    )
)
(instance glassSound of FPSound
    (properties
        flags $0001
        number 2542
    )
)
