(version 2)
(include "sci.sh")
(exports
    0 Room80
)
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "Obj")
(script 80)



(instance public Room80 of Rm
    (properties
        picture 80
    )

    (method (init)
        = north (= west (= south (= east 81)))
        = horizon 55
        (super:init())
        proc0_1()
        (send gEgo:view(63))
        (switch (gNorth)
            (case 14
                (send gEgo:
                    posn(180 135)
                    init()
                )
                (send global2:setScript(Actions))
            )
            (case 81
                (send gEgo:
                    posn(gGEgoX gGEgoY)
                    loop(gGEgoX)
                )
            )
            (case 85
                (if (== global105 1)
                    (send gEgo:view(123))
                )
                (send gEgo:posn(1 144))
                = gSeconds 5
                (send (ScriptID(503)):notify())
            )
            (default 
                (send gEgo:
                    view(0)
                    posn(160 188)
                )
            )
        )
        (send gEgo:init())
        (if (== global105 1)
            proc255_0(80 0)
            = global105 0
        )
    )


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


    (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(80 1)
                    )(else
                        (if (Said('/tree'))
                            proc255_0(80 2)
                        )(else
                            (if (Said('/rock,banner,boulder'))
                                proc255_0(80 3)
                            )(else
                                (if (Said('/craft'))
                                    proc255_0(80 4)
                                )(else
                                    (if (Said('<up') or Said('/air'))
                                        proc255_0(80 5)
                                    )(else
                                        (if (Said('<down') or Said('/dirt,pass'))
                                            proc255_0(80 6)
                                        )
                                    )
                                )
                            )
                        )
                    )
                )(else
                    (if (Said('get,get/rock,banner'))
                        proc255_0(80 7)
                    )(else
                        (if (Said('climb/tree'))
                            proc255_0(80 8)
                        )
                    )
                )
            )(else
                0
            )
    )


    (method (newRoom newRoomNumber)
        (if (> (send gEgo:x) 317)
            = gGEgoX 317
            = gGEgoY (send gEgo:y)
            = gGEgoX 1
        )(else
            (if (> (send gEgo:y) 187)
                = gGEgoY 186
                = gGEgoX (send gEgo:x)
                = gGEgoX 3
            )(else
                (if (< (send gEgo:x) 2)
                    = gGEgoX 3
                    = gGEgoY (send gEgo:y)
                    = gGEgoX 0
                )(else
                    = gGEgoX (send gEgo:x)
                    = gGEgoY (+ horizon 3)
                    = gGEgoX 2
                )
            )
        )
        (super:newRoom(newRoomNumber))
    )

)
(instance Actions of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gEgo:setMotion(MoveTo 202 160 self))
            )
            (case 1
                proc0_3()
                (send global2:setScript(0))
            )
        )
    )

)
