(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "SQRoom")
(use "PolyPath")
(use "Polygon")
(use "Class_950_0")
(use "Cycle")
(use "PicView")
(use "Obj")
(script 65)


(local
    local0[46] = (26 0 27 36 42 48 66 50 86 42 86 89 96 99 133 100 152 87 169 97 192 97 194 116 204 124 201 162 230 160 231 148 241 143 243 148 246 160 271 162 273 155 319 149 319 )
    local46[16] = (0 70 106 173 81 184 75 172 65 168 41 175 40 182 0 183 )
    local62[48] = (0 0 26 0 27 35 43 49 67 51 86 43 86 89 94 100 118 103 138 100 151 86 166 97 191 98 192 115 203 122 199 164 190 167 186 163 151 174 143 167 128 173 111 170 105 172 0 70 )
    local110[32] = (0 70 79 148 78 151 78 152 76 153 74 152 73 150 62 139 57 140 43 126 23 113 15 107 3 93 1 90 1 88 0 87 )

)
(instance public rm065 of SQRoom
    (properties
        picture 65
        style 30
        horizon 48
        north 50
        west 60
        vanishingX 0
        vanishingY 65471
    )

    (method (init)
        (switch (gWest)
            (case north
                proc0_2()
                (self:setScript(enterScript))
            )
            (case west
                (if (> (send gEgo:y) 179)
                    (send gEgo:y(179))
                )
            )
            (default 
                (send gEgo:
                    x(160)
                    y(160)
                )
            )
        )
        (send gEgo:init())
        (if (== (send ((send gInv:at(1))):owner) 65)
            (aRope:init())
        )
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(0 179 185 179 192 159 227 149 152 103 139 109 101 109 82 99 77 85 91 71 105 69 86 51 77 55 40 54 22 46 18 30 30 26 6 0 319 0 319 189 0 189)
                yourself()
            )
))
        (buildingPoly:
            points(@local0)
            size(23)
        )
        (streetPoly:
            points(@local46)
            size(8)
        )
        (sidewalkPoly:
            points(@local62)
            size(24)
        )
        (liquidPoly:
            points(@local110)
            size(16)
        )
        (theRubble:init())
        (theRedBldg:init())
        (theLiquid:init())
        (theGrate:init())
        (theStreet:init())
        (theSidewalk:init())
        (theArea:init())
        (if (not Btest(0))
            (self:setRegions(701))
        )
        (super:init())
        (self:setRegions(705))
    )


    (method (newRoom param1)
        (if ((((== (send gEgo:edgeHit) 1) and (<> script exitScript)) and (<> script ScriptID(701 3))) and (<> (send (ScriptID(701 1)):script) ScriptID(701 4)))
            proc0_2()
            (self:setScript(exitScript 0 1))
        )(else
            (if ((== (send gEgo:edgeHit) 1) and not (send script:register))
                (super:newRoom(param1))
            )(else
                (super:newRoom(param1))
            )
        )
    )

)
(instance enterScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:
                    posn(4 -1)
                    setMotion(MoveTo 17 49 self)
                )
            )
            (case 1
                proc0_3()
                (send client:setScript(0))
            )
        )
    )

)
(instance exitScript of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(MoveTo 5 65526 self))
            )
            (case 1
                = register 0
                (send global2:newRoom((send global2:north)))
            )
        )
    )

)
(instance getRope of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(PolyPath 160 183 self))
            )
            (case 1
                (send gEgo:setMotion(PolyPath (send gEgo:x) (+ (send gEgo:y) 2) self))
            )
            (case 2
                proc0_3()
                (aRope:dispose())
                proc0_11(39 5)
                (self:cue())
            )
            (case 3
                Print("You take possesion of the small, frayed, useless-looking length of rope.")
                (send gEgo:get(1))
                (send client:setScript(0))
            )
        )
    )

)
(instance aRope of View
    (properties
        x 160
        y 189
        z 10
        description "rope"
        sightAngle 45
        lookStr "It's a lightweight, worn piece of rope."
        view 33
        priority 14
        signal 16400
    )

    (method (doit)
        (super:doit())
        (if (== (send global2:curPic) 31)
            (self:z(1000))
        )(else
            (self:z(10))
        )
    )


    (method (doVerb param1)
        (switch (param1)
            (case 2
                proc0_2()
                (send global2:setScript(getRope))
            )
            (case 11
                Print("Smells like a frayed old length of rope.")
            )
            (case 10
                Print("You run the risk of tying your tongue in a frayed knot.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theRubble of Feature
    (properties
        x 160
        y 188
        nsBottom 200
        nsRight 320
        description "rubble"
        onMeCheck 64
        lookStr "The clearing ends here. Progress south is not possible over the jagged terrain."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                (if (<> (send ((send gInv:at(1))):owner) 65)
                    Print("The rubble is too dangerous for you to mess around on.")
                )(else
                    Print("The rubble is too dangerous for you to mess with - except maybe for that knotted-looking thing.")
                )
            )
            (case 11
                Print("The faint aroma of burnt hemp teases playfully around your nostrils.")
            )
            (case 10
                Print("You swish the rubble around in your mouth a bit, but the flavor is too subtle to identify. And the bouquet leaves a LOT to be desired.")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theRedBldg of Feature
    (properties
        x 280
        y 180
        description "red building"
        sightAngle 40
        lookStr "A battered and boarded storefront shows the wear and tear a little war can have on it."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(buildingPoly))
    )


    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("The building is closed-up with welded metal panels enhancing the non-access accent.")
            )
            (case 11
                Print("There's a sweet, fruity odor coming from the building.")
            )
            (case 10
                Print("Mmmmmm! Wild Berry!")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance buildingPoly of Polygon
    (properties)
)
(instance theLiquid of Feature
    (properties
        x 39
        y 115
        nsBottom 200
        nsRight 320
        description "solidified run-off"
        sightAngle 45
        lookStr "What looks like fluid is actually a sedimentary mixture of toxic atmospheric solids."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(liquidPoly))
    )


    (method (doVerb param1)
        (switch (param1)
            (case 11
                Print("It smells just as good as it looks.")
            )
            (case 10
                Print("It tastes just as good as it smells. And as an added bonus you can attempt to predict which vital organs will filter and collect quantities of some of the potentially lethal elements of the atmospheric solids deposited in the fine sediment. Heavy metals, various corrosives... who knows what could be in the environmental seasoning?")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance liquidPoly of Polygon
    (properties)
)
(instance theGrate of Feature
    (properties
        x 85
        y 163
        nsBottom 200
        nsRight 320
        description "grate"
        sightAngle 45
        onMeCheck 512
        lookStr "The grate is anchored securely by bolts with corroded heads."
    )

    (method (doVerb param1)
        (switch (param1)
            (case 2
                Print("The bolted-down grate won't budge.")
            )
            (case 11
                Print("It smells grate! (Did I really say that?)")
            )
            (case 10
                Print("It tastes grate!")
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance theStreet of Feature
    (properties
        description "street"
        lookStr "It seems to have everything you'd look for in a street with the exception of vehicles to use it."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(streetPoly))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 11
                Print("The street stinks. Somebody must have been driving on it.")
            )
            (case 10
                Print("A strange sense of revulsion prevents you from licking the street. Not so strange, actually.")
            )
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance streetPoly of Polygon
    (properties)
)
(instance theSidewalk of Feature
    (properties
        description "sidewalk"
        lookStr "It's very pleasant looking."
    )

    (method (init)
        (super:init())
        (self:onMeCheck(sidewalkPoly))
    )


    (method (doVerb param1 param2)
        (switch (param1)
            (case 10
                Print("You clean a little patch of the sidewalk with your tongue.")
            )
            (case 11
                Print("The sidewalk stinks. Somebody must have been walking on it.")
            )
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
(instance sidewalkPoly of Polygon
    (properties)
)
(instance theArea of Feature
    (properties
        nsBottom 200
        nsRight 320
        description "area"
        lookStr "You are at the southeastern corner of the clearing. Rubble restricts southern passage."
    )

    (method (doVerb param1 param2)
        (switch (param1)
            (case 3
                (send (ScriptID(705 4)):doVerb(param1 param2))
            )
            (default 
                (super:doVerb(param1))
            )
        )
    )

)
