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



(instance public gardenReg of Rgn
    (properties)

    (method (init)
        Load(rsVIEW 1)
        (super:init())
        proc0_11(49)
        proc0_11(50)
    )


    (method (doit param1)
        (super:doit(rest param1))
        (if (& (send gEgo:onControl(1)) $0006)
            (send gEgo:z(-5))
        )(else
            (send gEgo:z(0))
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
            )(else
                (if ((& (send pEvent:modifiers) $0003) and (proc0_12(49) or proc0_12(50)))
                    proc0_11(50)
                    proc0_11(49)
                    (send pEvent:claimed(1))
                )(else
                    (if (Said('look,look/garden,grass,bury,bush') or (((& $0404 OnControl(4 (send pEvent:x) (send pEvent:y))) and (& (send pEvent:modifiers) $0003)) and not proc0_12(49)))
                        proc0_10(49)
                        proc255_0(604 0)
                        (send pEvent:claimed(1))
                    )(else
                        (if (Said('look,look/brick,border') or (((& $4000 OnControl(4 (send pEvent:x) (send pEvent:y))) and (& (send pEvent:modifiers) $0003)) and not proc0_12(50)))
                            proc0_10(50)
                            proc255_0(604 1)
                        )(else
                            (if (Said('look,look>'))
                                (if (Said('[<at,around][/room]'))
                                    proc255_0(604 2)
                                )(else
                                    (if (Said('<down'))
                                        (if (& (send gEgo:onControl(1)) $0006)
                                            proc255_0(604 3)
                                        )(else
                                            (send pEvent:claimed(0))
                                        )
                                    )(else
                                        (if (Said('/carrot'))
                                            (if ((send gEgo:has(2)))
                                                (send pEvent:claimed(0))
                                            )(else
                                                (if (& (send gEgo:onControl(1)) $0006)
                                                    proc255_0(604 3)
                                                )(else
                                                    proc255_0(604 4)
                                                )
                                            )
                                        )
                                    )
                                )
                            )(else
                                (if (Said('get,get,pick/carrot'))
                                    (if ((send gEgo:has(2)))
                                        proc255_0(604 5)
                                    )(else
                                        (if ((send global2:script))
                                            proc255_0(604 6)
                                        )(else
                                            (if (proc0_12(1))
                                                proc255_0(604 7)
                                            )(else
                                                (if (& (send gEgo:onControl(1)) $0006)
                                                    (send global2:setScript(pickCarrot))
                                                )(else
                                                    proc255_0(604 8)
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance pickCarrot of Script
    (properties)

    (method (doit param1)
        (super:doit(rest param1))
        (if (((send gEgo:isStopped()) and (== state 0)) and (send gEgo:isBlocked()))
            (self:cue())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gEgo:setMotion(MoveTo 134 135))
            )
            (case 1
                (send gEgo:
                    view(1)
                    setLoop(
                        (if (((< 120 (send gEgo:heading)) and (< (send gEgo:heading) 260)) and (< (send gEgo:loop) 2))
                            2
                        )(else
                            -1
                        )
)
                    setMotion(0)
                    setCycle(End self)
                )
                proc0_11(10)
            )
            (case 2
                (send (ScriptID(0 21)):
                    number(105)
                    loop(1)
                    init()
                    play()
                )
                proc255_0(604 9)
                (send gEgo:get(2))
                (if (not proc0_12(5))
                    proc0_19(64 2)
                )
                = cycles 4
            )
            (case 3
                (send gEgo:setCycle(Beg self))
            )
            (case 4
                proc0_1()
                (send gEgo:illegalBits(-31744))
                proc0_3()
                (self:dispose())
            )
        )
    )

)
