(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "InvI")
(use "Obj")
(script 503)


(local
    local0[7]
    local7
    gEgoViewer

)
(instance public beachReg of Rgn
    (properties)

    (method (init)
        (super:init())
        Load(rsVIEW 21)
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (Said('look>'))
                    (if (Said('<in,under/ocean,water'))
                        (if (<> (send gEgo:view()) 2)
                            Print(503 0)
                        )(else
                            Print(503 1)
                        )
                    )(else
                        (if (Said('/ocean,water'))
                            Print(503 2)
                        )(else
                            (if (Said('/fish'))
                                (if ((send gEgo:has(24)))
                                    (send ((Inv:at(24))):showSelf())
                                )(else
                                    Print(503 3)
                                )
                            )(else
                                (if (Said('/beach'))
                                    Print(503 4)
                                )(else
                                    (if (Said('/sky') or Said('<up'))
                                        (if (not global100)
                                            Print(503 5)
                                        )(else
                                            Print(503 6)
                                        )
                                    )(else
                                        (if (Said('/dirt') or Said('<down'))
                                            Print(503 7)
                                        )(else
                                            (if (Said('/boulder'))
                                                Print(503 8)
                                            )(else
                                                (if (Said('/forest'))
                                                    Print(503 9)
                                                )(else
                                                    (if (Said('/grass'))
                                                        Print(503 10)
                                                    )(else
                                                        (if (Said('/bush'))
                                                            Print(503 11)
                                                        )(else
                                                            (if (Said('/flora,blossom'))
                                                                Print(503 12)
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )(else
                    (if (Said('get/flora,blossom'))
                        Print(503 13)
                    )(else
                        (if (Said('get/water'))
                            Print(503 14)
                        )(else
                            (if (Said('drink') or Said('get/drink'))
                                (if (<> (send gEgo:view()) 2)
                                    Print(503 15)
                                )(else
                                    (if ((((& (= local7 proc0_2(gEgo 12)) $0008) or (& local7 $0800)) or (& local7 $0002)) or (& local7 $0200))
                                        = gGEgoScript (send gEgo:script())
                                        (send gEgo:setScript(drinking))
                                    )(else
                                        Print(800 1)
                                    )
                                )
                            )(else
                                (if (Said('bathe,dive,wade[<enter][/ocean]>'))
                                    (if (<> global105 4)
                                        Print(503 16)
                                    )(else
                                        (if (Said('<under'))
                                            Print(503 17)
                                        )(else
                                            Print(503 18)
                                        )
                                    )
                                    (send pEvent:claimed(1))
                                )(else
                                    (if (Said('capture,get/fish') or Said('fish[<enter]'))
                                        (if (== global105 4)
                                            Print(503 19)
                                        )(else
                                            (if ((send gEgo:has(17)))
                                                Print(503 20)
                                            )(else
                                                Print(503 21)
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )

)
(instance drinking of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (= global204 1 proc0_10() = gEgoViewer (send gEgo:viewer()) (send gEgo:
                    viewer(0)
                    view(21)
                    cel(0)
                    setCycle(End self)
                )
  )
            )
            (case 1
                ((Timer:setReal(self 5)) = global120 Print(503 22 134 -1 20 172)  )
            )
            (case 2
                ((send gEgo:setCycle(Beg self))  )
            )
            (case 3
                (
                (if (gTheNewDialog)
                    (send gTheNewDialog:dispose())
                )
 = global204 0 (send gEgo:
                    view(2)
                    setCycle(Walk)
                )
 (send gEgo:
                    script(gGEgoScript)
                    viewer(gEgoViewer)
                )
 proc0_11() )
            )
        )
    )

)
