(version 2)
(include "sci.sh")
(exports
    0 Room86
)
(use "Main")
(use "Class_255_0")
(use "Avoid")
(use "Cycle")
(use "Game")
(use "Feature")
(use "Obj")
(script 86)



(instance door of Prop
    (properties)
)
(instance public Room86 of Rm
    (properties
        picture 86
    )

    (method (init)
        (super:init())
        proc0_1()
        proc0_2()
        (door:
            view(125)
            loop(0)
            cel(0)
            posn(161 136)
            init()
        )
        (switch (gNorth)
            (case 90
                (send gEgo:
                    view(0)
                    init()
                    posn(159 130)
                )
                (send global2:setScript(inFromNinety))
            )
            (default 
                proc0_1()
                (send gEgo:
                    view(123)
                    loop(3)
                    posn(159 155)
                    observeControl(16384)
                    init()
                )
                (send global2:setScript(Actions))
            )
        )
        (if ((send gEgo:has(12)))
            (send gEgo:view(113))
        )
    )


    (method (doit)
        (super:doit())
        (if (<> global11 global13)
            return 
        )
        (if (& (send gEgo:onControl(0)) $0040)
            (send global2:newRoom(85))
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 1
        )
        return 
            (if (== (send pEvent:type) 128)
                (if (Said('look>'))
                    (if ((Said('/area') or Said('/around')) or Said('[<around][/!*]'))
                        proc255_0(86 0)
                    )(else
                        (if (Said('/door,elevator'))
                            proc255_0(86 1)
                        )(else
                            (if (Said('/partition'))
                                proc255_0(86 2)
                            )(else
                                (if (Said('/ramp,stair'))
                                    proc255_0(86 3)
                                )(else
                                    (if (Said('/button'))
                                        proc255_0(86 4)
                                    )
                                )
                            )
                        )
                    )
                )(else
                    (if (Said('open/door'))
                        proc255_0(86 5)
                    )(else
                        (if (Said('press/button'))
                            (send gEgo:setScript(pushButton))
                        )
                    )
                )
            )(else
                0
            )
    )


    (method (newRoom newRoomNumber)
        (if (not global597)
            = global597 1
            (send global1:changeScore(25))
        )
        (super:newRoom(newRoomNumber))
    )

)
(instance Actions of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = seconds 2
            )
            (case 1
                proc0_2()
                (send gEgo:
                    setMotion(0)
                    view(134)
                    setLoop(4)
                    setCycle(Fwd)
                )
                proc0_10()
                = seconds 2
            )
            (case 2
                (send gEgo:
                    setLoop(3)
                    cel(0)
                )
                proc0_10()
                proc255_0(86 6)
                = seconds 2
            )
            (case 3
                (send gEgo:setLoop(1))
                = seconds 2
            )
            (case 4
                proc0_1()
                (send gEgo:
                    view(0)
                    loop(2)
                )
                = global120 2
                = global105 0
                proc0_10()
                proc255_0(86 7)
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance inFromNinety of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (door:
                    ignoreActors()
                    setCycle(End self)
                )
            )
            (case 1
                (send gEgo:setMotion(MoveTo 159 155 self))
            )
            (case 2
                (door:setCycle(Beg self))
                proc0_1()
                (send gEgo:observeControl(16384))
                proc0_3()
            )
        )
    )

)
(instance pushButton of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:
                    setAvoider(Avoid)
                    setMotion(MoveTo 134 143 self)
                )
            )
            (case 1
                = seconds 2
            )
            (case 2
                (send gEgo:setAvoider(0))
                (door:setCycle(End self))
            )
            (case 3
                (door:ignoreActors())
                (send gEgo:
                    ignoreControl(16384)
                    setMotion(MoveTo 159 141 self)
                )
            )
            (case 4
                (send gEgo:setMotion(MoveTo 159 130 self))
            )
            (case 5
                (send gEgo:loop(2))
                (door:setCycle(Beg self))
            )
            (case 6
                (send global2:newRoom(90))
            )
        )
    )

)
