(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "ulence")
(use "SQRoom")
(use "Polygon")
(use "Class_950_0")
(use "Cycle")
(use "Obj")
(script 611)



(instance public rm611 of SQRoom
    (properties
        picture 611
        horizon 90
        north 614
        west 610
    )

    (method (init)
        (ulence:roomVer(22891))
        (switch (gWest)
            (case 614
                (send gEgo:x(195))
            )
            (case 610
                (if (< (send gEgo:y) 166)
                    (send gEgo:y(166))
                )
                (send gLongSong2:
                    number(0)
                    vol(0)
                    stop()
                )
            )
            (default 
                (send gEgo:
                    x(24)
                    y(181)
                )
            )
        )
        (send gEgo:
            init()
            illegalBits(0)
            ignoreActors(1)
        )
        (super:init())
        (self:
            setFeatures(building1 building2 graffiti)
            setRegions(706)
            addObstacle((send ((Polygon:new())):
                    type(2)
                    init(0 0 319 0 319 189 300 189 263 189 198 189 256 182 291 163 288 149 291 134 265 86 132 86 149 101 169 107 179 124 170 140 138 158 0 163)
                    yourself()
                )
)
        )
        (if ((> Random(0 100) 20) and (== (ulence:status) 1))
            (ulence:
                status(2)
                bikerComing(1)
            )
            Load(rsVIEW 633)
            Load(rsVIEW 635)
            Load(rsSOUND 50)
        )
        (send (ScriptID(706 7)):
            init()
            nsLeft(0)
            nsTop(55)
            nsBottom(189)
            nsRight(319)
        )
        (send (ScriptID(706 8)):
            init()
            nsLeft(0)
            nsTop(0)
            nsBottom(55)
            nsRight(319)
        )
    )


    (method (doit param1)
        (if ((== (ulence:status) 4) and (< (send (ScriptID(706 1)):distanceTo(gEgo)) 15))
            proc0_2()
            (ulence:status(6))
            (send gEgo:setScript(0))
            (ulence:deathLoop(1))
            (self:setScript(ScriptID(706 3)))
        )
        (if (script)
            0
        )(else
            (if ((== (ulence:status) 2) and (send gEgo:inRect(155 172 175 183)))
                proc0_2()
                (ulence:status(3))
                (send (ScriptID(706 1)):
                    view(633)
                    init()
                    hide()
                    posn(65506 - (send gEgo:y) 5)
                    setLoop(0)
                    setScript(runOver)
                )
                (send gEgo:setScript(ScriptID(706 5)))
            )
        )
        (super:doit(rest param1))
    )

)
(instance runOver of Script
    (properties)

    (method (changeState newState)
        (var temp0[2])
        (switch (= state newState)
            (case 0
                (ulence:egoBusy(1))
                (send gLongSong:
                    vol(25)
                    number(50)
                    loop(-1)
                    playBed()
                    fade(127 10 10 0)
                )
                = seconds 3
            )
            (case 1
                (send (ScriptID(706 6)):
                    init()
                    play()
                )
                (send (ScriptID(706 1)):
                    show()
                    setMotion(MoveTo 50 - (send gEgo:y) 5 self)
                )
            )
            (case 2
                (ulence:status(4))
                proc0_3()
                (send (ScriptID(706 1)):
                    setPri(+ (send gEgo:priority) 1)
                    setMotion(MoveTo 171 - (send gEgo:y) 5 self)
                )
            )
            (case 3
                (send (ScriptID(706 1)):
                    posn(202 160)
                    setLoop(6)
                )
                = cycles 1
            )
            (case 4
                (send (ScriptID(706 1)):setMotion(MoveTo 244 141 self))
            )
            (case 5
                (send (ScriptID(706 1)):
                    posn(250 131)
                    setLoop(3)
                )
                = cycles 1
            )
            (case 6
                (send (ScriptID(706 1)):setMotion(MoveTo 250 99 self))
            )
            (case 7
                (send (ScriptID(706 1)):
                    posn(225 87)
                    setLoop(7)
                )
                = cycles 1
            )
            (case 8
                (send (ScriptID(706 1)):setMotion(MoveTo 179 73 self))
            )
            (case 9
                (send (ScriptID(706 1)):
                    setPri(4)
                    setLoop(1)
                    setMotion(MoveTo 46 73 self)
                )
            )
            (case 10
                (send (ScriptID(706 6)):fade())
                (send gLongSong:fade())
                (send (ScriptID(706 1)):hide())
                = seconds 3
            )
            (case 11
                (if (<> (ulence:status) 6)
                    (ulence:
                        status(1)
                        fieldOff(0)
                        bikerComing(0)
                        egoBusy(0)
                    )
                    (send gEgo:setScript(0))
                    proc0_3()
                    Print("Boy, that was close!")
                )
                (self:dispose())
            )
        )
    )

)
(instance graffiti of Feature
    (properties
        x 30
        y 117
        nsTop 85
        nsBottom 150
        nsRight 60
        description "gr"
        sightAngle 45
        lookStr "You don't know what it says but you're sure it's not flattering."
    )
)
(instance building1 of Feature
    (properties
        x 85
        y 91
        nsTop 32
        nsBottom 151
        nsRight 170
        description "back of bar"
        sightAngle 45
        onMeCheck 2
        lookStr "This must be the back of the bar. Some fading grafitti adorns the wall."
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 11
                Print("Back here, the bar smells like everything they didn't want stinking up the front.")
            )
            (case 10
                Print("An interesting mix of flavors! Stale Keronian ale, regurgitated Keronian ale, and Keronian ale that's otherwise been used and disposed of.")
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
(instance building2 of Feature
    (properties
        x 137
        y 46
        nsTop 23
        nsLeft 63
        nsBottom 70
        nsRight 212
        description "Toys B Us building."
        sightAngle 45
        onMeCheck 8
        lookStr "You see the Droids-B-Us store in the distance."
    )

    (method (doVerb param1 param2 param3)
        (switch (param1)
            (case 11
                Print("From here, you can't really smell the Droids-B-Us building.")
            )
            (case 10
                Print("You'll have to get closer if you want to lick the Droids-B-Us building.")
            )
            (default 
                (super:doVerb(param1 rest param3))
            )
        )
    )

)
