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


(local
    newAct
    newAct_2
    newAct_3
    newAct_4

)
(instance theMusic of Sound
    (properties)
)
(instance public Room47 of Rm
    (properties
        picture 47
        style 16
    )

    (method (init)
        Load(rsVIEW 632)
        Load(rsVIEW 111)
        Load(rsVIEW 113)
        (super:init())
        (if ((== gPicture 37) or (== gPicture 0))
            (send gEgo:
                posn(156 177)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (if (== gPicture 46)
            (send gEgo:
                posn(72 142)
                view(4)
                xStep(4)
                yStep(1)
                init()
            )
        )
        (send ((View:new())):
            view(632)
            loop(0)
            cel(3)
            posn(38 106)
            setPri(14)
            addToPic()
        )
        (send ((View:new())):
            view(632)
            loop(0)
            cel(4)
            posn(281 107)
            setPri(14)
            addToPic()
        )
        (send (= newAct (Act:new())):
            view(632)
            loop(2)
            cel(2)
            illegalBits(0)
            setPri(14)
            posn(41 98)
            setCycle(Fwd)
            init()
        )
        (send (= newAct_2 (Act:new())):
            view(632)
            loop(2)
            cel(2)
            illegalBits(0)
            setPri(14)
            setCycle(Fwd)
            posn(278 99)
            init()
        )
        (send (= newAct_3 (Act:new())):
            view(111)
            posn(250 80)
            illegalBits(8192)
            setPri(14)
            xStep(1)
            yStep(3)
            setMotion(Wander 5)
            setCycle(Fwd)
            init()
        )
        (send (= newAct_4 (Act:new())):
            view(113)
            posn(65 75)
            illegalBits(8192)
            setPri(14)
            xStep(1)
            yStep(3)
            setMotion(Wander 5)
            setCycle(Fwd)
            init()
        )
        (theMusic:
            number(33)
            loop(1)
            play()
        )
    )


    (method (doit)
        (super:doit())
        (if (& (send gEgo:onControl(0)) $0040)
            (send global2:newRoom(37))
        )
        (if (& (send gEgo:onControl(0)) $0020)
            (send global2:newRoom(46))
        )
    )


    (method (dispose)
        (theMusic:dispose())
        (super:dispose())
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (Said('look[<around][/!*]') or Said('look[<around]/room'))
                    Print(47 0)
                )(else
                    (if (Said('look>'))
                        (if (Said('<around') or Said('[<around]/room,room,hall,entry'))
                            Print(47 0)
                        )(else
                            (if (Said('/door'))
                                Print(47 1)
                            )(else
                                (if (Said('/flora,blossom'))
                                    Print(47 2)
                                )(else
                                    (if (Said('/wall'))
                                        Print(47 3)
                                    )(else
                                        (if (Said('[<down]/dirt'))
                                            Print(47 4)
                                        )(else
                                            (if (Said('/fairies[<little]'))
                                                Print(47 5)
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )(else
                        (if (Said('open/door'))
                            (if ((send gEgo:inRect(146 127 176 131)) or (send gEgo:inRect(238 141 260 153)))
                                Print(47 6)
                            )(else
                                Print(800 1)
                            )
                        )(else
                            (if (Said('unlatch/door'))
                                (if ((send gEgo:inRect(146 127 176 131)) or (send gEgo:inRect(238 141 260 153)))
                                    (if ((send gEgo:has(32)) or (send gEgo:has(20)))
                                        Print(47 7)
                                    )(else
                                        Print(47 8)
                                    )
                                )(else
                                    Print(800 1)
                                )
                            )(else
                                (if (Said('bang/door'))
                                    (if ((send gEgo:inRect(146 127 176 131)) or (send gEgo:inRect(238 141 260 153)))
                                        Print(47 9)
                                    )(else
                                        Print(800 1)
                                    )
                                )(else
                                    (if (Said('break/door'))
                                        (if ((send gEgo:inRect(146 127 176 131)) or (send gEgo:inRect(238 141 260 153)))
                                            Print(47 10)
                                        )(else
                                            Print(800 1)
                                        )
                                    )(else
                                        (if (Said('use/key'))
                                            (if ((send gEgo:inRect(146 127 176 131)) or (send gEgo:inRect(238 141 260 153)))
                                                (if ((send gEgo:has(20)) or (send gEgo:has(32)))
                                                    Print(47 11)
                                                )(else
                                                    Print(47 12)
                                                )
                                            )(else
                                                Print(47 13)
                                            )
                                        )(else
                                            (if (Said('converse/fairies[<little]') or Said('converse[/!*]'))
                                                Print(47 14)
                                            )(else
                                                (if (Said('kill/fairies[<little]'))
                                                    Print(47 15)
                                                )(else
                                                    (if (Said('get/fairies[<little]'))
                                                        Print(47 16)
                                                    )(else
                                                        (if (Said('capture/fairies[<little]'))
                                                            Print(47 16)
                                                        )(else
                                                            (if (Said('kiss/fairies[<little]') or Said('kiss[/!*]'))
                                                                Print(47 17)
                                                            )(else
                                                                (if (Said('help/fairies[<little]'))
                                                                    Print(47 18)
                                                                )(else
                                                                    (if (Said('deliver/*/fairies'))
                                                                        Print(47 19)
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )

)
