(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "User")
(use "PV")
(use "Obj")
(script 83)


(local
    newAct
    newView
    local2

)
(instance public Room83 of Rm
    (properties
        picture 83
        style 16
    )

    (method (init)
        Load(rsVIEW 649)
        Load(rsVIEW 634)
        Load(rsVIEW 512)
        (self:setRegions(604))
        (super:init())
        (send ((View:new())):
            view(634)
            loop(1)
            cel(0)
            posn(55 79)
            setPri(4)
            init()
            addToPic()
        )
        (send ((View:new())):
            view(634)
            loop(1)
            cel(1)
            posn(267 79)
            setPri(4)
            init()
            addToPic()
        )
        (if (global100)
            (send ((Prop:new())):
                view(512)
                loop(0)
                posn(57 67)
                setPri(3)
                init()
                setCycle(Fwd)
            )
            (send ((Prop:new())):
                view(512)
                loop(0)
                posn(267 67)
                setPri(3)
                init()
                setCycle(Fwd)
            )
        )
        = global101 1
        (if (global100)
            (send (= newView (View:new())):
                view(649)
                loop(0)
                cel(0)
                posn(162 65)
                init()
                stopUpd()
            )
        )
        (if ((== gPicture 86) or (== gPicture 0))
            (send gEgo:
                posn(156 160)
                view(4)
                illegalBits(32768)
                loop(3)
                xStep(4)
                yStep(1)
                init()
            )
            (if (== global109 0)
                Load(rsVIEW 141)
                (self:setScript(takeBack))
            )
        )
    )


    (method (doit)
        (super:doit())
        (if ((== global109 99) and (& (send gEgo:onControl(0)) $0040))
            (send global2:newRoom(86))
        )
    )


    (method (handleEvent pEvent)
        return 
            (if ((send pEvent:claimed()))
                return 1
            )(else
                (if (== (send pEvent:type()) 128)
                    (if (Said('look[<around][/!*]') or Said('look/room,castle'))
                        Print(83 0)
                    )(else
                        (if (Said('look>'))
                            (if (Said('/skeleton,['))
                                Print(83 1)
                            )(else
                                (if (Said('/machine'))
                                    Print(83 2)
                                )(else
                                    (if (Said('/whip'))
                                        Print(83 3)
                                    )(else
                                        (if (Said('/chain'))
                                            Print(83 4)
                                        )(else
                                            (if (Said('/window'))
                                                Print(83 5)
                                            )(else
                                                (if (Said('/wall'))
                                                    Print(83 6)
                                                )(else
                                                    (if (Said('/dirt') or Said('<down'))
                                                        Print(83 7)
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )(else
                            (if (Said('use,(turn<on)/machine') or Said('turn/wheel'))
                                Print(83 8)
                            )(else
                                (if (Said('get/whip'))
                                    Print(83 9)
                                )(else
                                    (if (Said('get/chain'))
                                        Print(83 4)
                                    )(else
                                        (if (Said('open/window'))
                                            Print(83 10)
                                        )(else
                                            (if (Said('break/window'))
                                                Print(83 11)
                                            )(else
                                                (if (Said('open/door'))
                                                    (if (< global109 5)
                                                        Print(83 12)
                                                    )(else
                                                        Print(83 13)
                                                    )
                                                )(else
                                                    (if (Said('unlatch/door'))
                                                        (if (< global109 5)
                                                            Print(83 14)
                                                        )(else
                                                            Print(83 15)
                                                        )
                                                    )(else
                                                        (if (Said('call,help,,'))
                                                            Print(83 16)
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
    )

)
(instance takeBack of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= seconds 30  )
            )
            (case 1
                ((User:
                    canControl(0)
                    canInput(0)
                )
 (send gEgo:setMotion(0)) Print(83 17) 
                (if ((send gEgo:inRect(123 142 193 180)))
                    (send gEgo:setMotion(MoveTo 150 130 self))
                )(else
                    (self:cue())
                )
 )
            )
            (case 2
                ((send gEgo:loop(2)) (send (= newAct (Act:new())):
                    view(141)
                    posn(150 195)
                    illegalBits(0)
                    ignoreActors(1)
                    init()
                    setCycle(Walk)
                    setMotion(MoveTo 150 160 self)
                )
  )
            )
            (case 3
                (= local2 Print(83 18 134 -1 20 66 global23 172) (User:
                    canControl(0)
                    canInput(0)
                )
 (send gEgo:
                    illegalBits(0)
                    setMotion(MoveTo 160 (send gEgo:y()) self)
                )
  )
            )
            (case 4
                ((send gEgo:
                    illegalBits(0)
                    setLoop(2)
                    setMotion(Follow newAct 5)
                )
 (self:cue())  )
            )
            (case 5
                ((send newAct:setMotion(MoveTo 150 225 self))  )
            )
            (case 6
                (proc0_23() (send gEgo:
                    setLoop(-1)
                    setAvoider(0)
                )
 (send global2:newRoom(86)) )
            )
        )
    )

)
