(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "PV")
(script 6)


(local
    local0
    newProp

)
(instance public Room6 of Rm
    (properties
        picture 6
    )

    (method (init)
        = south 12
        = west 5
        = horizon 80
        = global101 0
        (if (global100)
            = picture 106
        )
        (send gEgo:edgeHit(0))
        (super:init())
        (self:setRegions(508 511))
        (switch (gPicture)
            (case west
                (
                (if (>= (send gEgo:y()) 160)
                    (send gEgo:
                        x(1)
                        y(160)
                    )
                )(else
                    (if (<= (send gEgo:y()) 84)
                        (send gEgo:
                            x(2)
                            y(84)
                        )
                    )(else
                        (send gEgo:x(1))
                    )
                )
 )
            )
            (case south
                (
                (if (>= (send gEgo:x()) 265)
                    (send gEgo:posn(265 188))
                )(else
                    (if (<= (send gEgo:x()) 100)
                        (send gEgo:posn(100 188))
                    )(else
                        (send gEgo:posn((send gEgo:x()) 188))
                    )
                )
 )
            )
            (case 57
                ((send gEgo:
                    loop(1)
                    x(200)
                    y(153)
                )
  )
            )
            (case 0
                ((send gEgo:
                    x(180)
                    y(160)
                )
 )
            )
        )
        = newProp (Prop:new())
        (send newProp:
            view(628)
            loop(1)
            cel(0)
            x(247)
            y(35)
            setCycle(Fwd)
            setPri(15)
            cycleSpeed(2)
            init()
        )
        (send gEgo:
            xStep(2)
            yStep(1)
            view(2)
            init()
        )
    )


    (method (doit)
        (super:doit())
        (if (& (= local0 (send gEgo:onControl(0))) $0040)
            = gTheGGNewPropX 57
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (Said('look<in,in,in/cave,skull'))
                    Print(6 0)
                )(else
                    (if ((Said('look/room') or Said('look/around')) or Said('look[<around][/!*]'))
                        Print(6 1)
                    )(else
                        (if (Said('look>'))
                            (if (Said('/cave,skull'))
                                Print(6 2)
                            )(else
                                (if (Said('/grass'))
                                    Print(6 3)
                                )(else
                                    (if (Said('/bush'))
                                        Print(6 4)
                                    )(else
                                        (if (Said('/flora'))
                                            Print(6 5)
                                        )(else
                                            (if (Said('blossom'))
                                                Print(6 6)
                                            )(else
                                                (if (Said('/forest'))
                                                    Print(6 7)
                                                )(else
                                                    (if (Said('/boulder'))
                                                        Print(6 8)
                                                    )(else
                                                        (if (Said('/sky') or Said('<up'))
                                                            (if (not global100)
                                                                Print(6 9)
                                                            )(else
                                                                Print(6 10)
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )(else
                            (if (Said('get/blossom'))
                                Print(6 6)
                            )(else
                                (if (Said('climb/boulder'))
                                    Print(6 11)
                                )(else
                                    (if (Said('look/boulder'))
                                        Print(6 12)
                                    )(else
                                        (if (Said('look/dirt'))
                                            Print(6 13)
                                        )(else
                                            (if (Said('climb/forest'))
                                                Print(6 14)
                                            )(else
                                                (if (Said('kill/forest'))
                                                    Print(6 15)
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )

)
