(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "SQRoom")
(use "Class_950_0")
(use "User")
(use "PicView")
(use "Obj")
(script 398)


(local
    userCurEventX
    UserCurEventY
    theBoxProp
    theTheBoxProp
    local4
    boxPropBoxID
    local6
    local7
    theBoxProp_2
    local9
    gGameSetSpeed

)
(instance public rm398 of SQRoom
    (properties
        picture 398
    )

    (method (init)
        (myIcon:init())
        (super:init())
        proc0_3()
        (theRoom:init())
        = local9 global34
        = global34 0
        (box1:
            init()
            stopUpd()
            posn(218 125)
        )
        (box2:
            init()
            stopUpd()
            posn(175 123)
        )
        (box3:
            init()
            stopUpd()
            posn(50 150)
        )
        (box5:
            init()
            stopUpd()
            posn(130 143)
        )
        (box6:
            init()
            stopUpd()
            posn(216 83)
        )
        (box7:
            init()
            stopUpd()
            posn(142 94)
        )
        (box9:
            init()
            stopUpd()
            posn(152 164)
        )
        (if (not Btest(31))
            (box10:
                init()
                stopUpd()
                posn(186 128)
            )
        )
        = local4 11
        (send gCast:eachElementDo(99 syncPriority))
        = gGameSetSpeed (send gGame:setSpeed())
        (send gGame:setSpeed(0))
        (send gIconBar:disable(0 3 4 5 6))
    )


    (method (dispose)
        (send gIconBar:enable())
        = global34 local9
        (send gGame:setSpeed(gGameSetSpeed))
        (super:dispose())
    )

)
(instance showBox of Script
    (properties)

    (method (doit)
        (var temp0, temp1)
        (super:doit())
        = temp0 (send ((User:curEvent)):type)
        (if (((== temp0 1) or (== temp0 4)) and state)
            = temp0 0
            (self:cue())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gIconBar:disable())
                (send global2:drawPic((+ 699 boxPropBoxID) 100))
                (send gCast:eachElementDo(156))
                (scriptHandleEvent:init())
                = cycles 1
            )
            (case 1
                (switch (boxPropBoxID)
                    (case 1
                        = local6 Display("From the folks who brought\nyou Astro Chicken! When it\ncomes to stimulating\nchickens, Cluck Egger is\nthe expert...and now YOU\ncan learn from him! Design\nthe chicken of your choice\n(over 40 options, including\nlips/no lips and laying\nfrequency) and take your\ncreation for a wild ride\nover real barnyard scenery.\nBased on an authentic flight\nmodel of a chicken. You're\nin for a peck of fun now!" 106 275 100 160 10 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 2
                        = local6 Display("Following closely on the\nheels of his hit \"Tic-Tac-\nToe Construction Set,\" Phil\nPhudge does it again. Using\na simple point-and-click\ninterface, you construct the\ncheckerboard of your\ndreams! Fill in an 8x8 grid\nwith squares of your\nchoice... red or black, in any\narrangement as long it's\nalternating. Don't like it?\nErase it and start all over\nagain! Requires MCGA, CGA\nVGA, PGA or TA-RA-RA-BOOMGA." 106 275 100 160 10 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 3
                        = local6 Display("The latest bomb from master\nstoryteller Morrie Brianarty,\nBOOM is a post-holocaust\nadventure set in post-\nholocaust America after the\nholocaust. Neutron bombs\nhave eradicated all life,\nleaving only YOU to wander\nthrough the wreckage. No\nother characters, no\nconflict, no puzzles, no\nchance of dying and\nno interface make this\nthe easiest-to-finish \ngame yet! Just boot it\nup and watch it explode!" 106 275 100 160 10 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 4
                        = local6 Display("The Two Guys from Andromeda's\nlatest sci-fi comedy, SPACE\nQUEST IV, will give you hours\nof frustration unless you have\nthis hintbook. Want to know\nhow to get the dog into the\nhanging basket? Want to find\nout how to attach the melon?\nBuy this hintbook and it all\nbecomes obvious. You'll hit\nyour head and say, \"Boy, how\nstupid could I have been? A\nmoron could've figured this\nout. I must be a real dimwit,\na pathetic nimnal, a wretched,\nidiotic excuse for a human\nbeing not to have figured\nout these simple puzzles in\nthe first place.\" Try it\nand see!" 106 275 100 150 10 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 5
                        = local6 Display("It's the newest in the\nwacky Hymie Lipschitz\nseries! Hymie, son of a\nwealthy New York furrier,\nhas gone wild with Dad's\nFrequent Flier vouchers \nagain. Can you track \nHymie down and bring him\nhome to meet the girl Mom's\npicked out for him? Hold\non to your yarmulke, Hymie\nLipschitz strikes again!\n640k, Ronald-MT32 and\n3.5\" circumcision req'd." 106 275 100 160 5 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 6
                        = local6 Display("Presenting the latest in\nthe award-winning King's\nQuest series, from the\nstill-active mind of aging\nRoberta Williams III,\nlatest in the award-winning\nRoberta Williams series.\nWhat happens when Old Man\nGraham and his family\nare kicked out of\nDaventry Condo Association?\nYou'll meet the Fabulous\nBernoulli Brothers, Prof.\nC.D. Romberg, and of\ncourse, Rumplestiltskin!\nOver 12 Gigabytes in\nlength!" 106 275 100 160 5 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 7
                        = local6 Display("It's here at last! With\na combination of SAI\n(Simulated Artificial\nIntelligence), and VRAI\n(Virtually Real Artificial\nIntelligence), we at MaxThis!\nSoftware have created a \nsimulated simulator\nexperience that's unlike\nanything you've ever\nsimulated playing before.\nWith Sim Sim, you can\ncreate a simulated\nenvironment in which you\ncan create any simulated\nenvironment you want!" 106 275 100 160 5 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 8
                        = local6 Display("Formerly entitled \"Hero's\nFlyer,\" this is the flight\nsimulator you've been\nwaiting for. Tired of\nflight simulators that\n\"load\" and \"run?\" Still\nlooking for a sim that\nreally crashes? Featuring\na stunning 3-D filled\npolygon, Stunt Flyer will\nhave you going through\nthe roof the moment you\nget it home." 106 275 100 160 5 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 9
                        = local6 Display("Head for the hills! It's\ncoming, and this time, it's\nHUNGRY! IT CAME FOR \nDESSERT is a thrilling \naction/adventure in which\na mob of pushy, overweight\nrelatives invade your\nkitchen. Armed with only\na Jello mold and a pastry\nbag, you must repel the\ninvaders...always keeping an\neye on your blood sugar\nlevel. It's the merriest\nmix-up since Enemaware's\nfabulous DEFENDER OF THE\nCROWN RIB ROAST." 106 275 100 160 5 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                    (case 10
                        = local6 Display("Imagine a character SO\noffensive, SO sexually inept,\nand SO lame-brained that you\njust can't wait to step into\nhis shoes! That's Dacron\nDanny, first in the Sahara\nOff-Ramp's new educational\nseries of true-life adventures\nfrom the team of Hal Lowe-\nKen Hugo. Learn how others\nsee YOU! Dacron Danny.....\nyour computer guide to your\ninner self!" 106 275 100 160 5 101 0 105 68 102 proc0_18(12 global132) 107)
                    )
                )
            )
            (case 2
                (switch (Print("What do you want to do with this piece?"))
                    (case 0
                        proc255_4(398 1 (send theBoxProp_2:myPrice))
                        = state (- state 1)
                        = cycles 1
                    )
                    (case 1
                        (if (<> boxPropBoxID 4)
                            Print("You don't have that much money!")
                            = state (- state 1)
                            = cycles 1
                        )(else
                            (send gEgo:get(8))
                            (send gEgo:get(9))
                            = theBoxProp 0
                            = gBoxPropBoxID boxPropBoxID
                            (box10:dispose())
                        )
                    )
                    (case 2
                        0
                    )
                    (case 3
                        (send gIconBar:enable())
                        (send global2:newRoom(397))
                    )
                )
                (scriptHandleEvent:dispose())
                = cycles 1
            )
            (case 3
                (send gIconBar:disable())
                Display(398 3 108 local6)
                = cycles 1
            )
            (case 4
                (send gCast:eachElementDo(184))
                (send global2:drawPic(398))
                = cycles 1
            )
            (case 5
                (send gIconBar:enable())
                (send client:setScript(0))
            )
        )
    )

)
(instance syncPriority of Code
    (properties)

    (method (doit param1)
        (send param1:setPri(--local4))
    )

)
(class boxProp of Prop
    (properties
        x 0
        y 0
        z 0
        heading 0
        noun 0
        nsTop 0
        nsLeft 0
        nsBottom 0
        nsRight 0
        description 0
        sightAngle 26505
        actions 26505
        onMeCheck 26505
        lookStr 0
        yStep 2
        view 0
        loop 0
        cel 0
        priority 0
        underBits 0
        signal 0
        lsTop 0
        lsLeft 0
        lsBottom 0
        lsRight 0
        brTop 0
        brLeft 0
        brBottom 0
        brRight 0
        palette 0
        cycleSpeed 0
        script 0
        cycler 0
        timer 0
        boxID 0
        pIndex -1
        tooHigh 0
        myPrice 0
    )

    (method (init)
        (super:init())
        (if (== boxID 4)
            (self:myPrice(5))
        )(else
            (self:myPrice((+ global159 Random(1 15))))
        )
        (if (== gBoxPropBoxID (self:boxID))
            (self:delete())
            (self:dispose())
        )
    )


    (method (doit)
        (var userCurEvent)
        (super:doit())
        (if ((== theBoxProp self) and (== (send ((send gIconBar:curIcon)):message) 2))
            = userCurEvent (User:curEvent)
            = userCurEventX (send userCurEvent:x)
            = UserCurEventY (send userCurEvent:y)
            (if (> userCurEventX 235)
                (self:
                    x(235)
                    y(+ UserCurEventY 10)
                )
            )(else
                (if (< userCurEventX 50)
                    (self:
                        x(50)
                        y(+ UserCurEventY 10)
                    )
                )(else
                    (if (> UserCurEventY 180)
                        (self:
                            x(userCurEventX)
                            y(180)
                        )
                    )(else
                        (self:
                            x(userCurEventX)
                            y(+ UserCurEventY 10)
                        )
                    )
                )
            )
        )
        (if (== (self:tooHigh) 1)
            (if (< (self:y) Random(110 160))
                (self:
                    y(+ (self:y) 15)
                    startUpd()
                )
            )(else
                (self:stopUpd())
                = tooHigh 0
            )
        )
    )


    (method (doVerb param1)
        (if (== param1 2)
            (if (== theBoxProp 0)
                (self:startUpd())
                = theBoxProp self
                (self:doit())
                (send gCast:delete(self))
                (send gCast:addToFront(self))
                (self:pIndex(12))
            )(else
                (if (== theBoxProp self)
                    (if (<> theBoxProp theTheBoxProp)
                        = theTheBoxProp theBoxProp
                        = local4 11
                        (send gCast:eachElementDo(99 syncPriority))
                    )
                    = theBoxProp 0
                    (self:
                        pIndex(11)
                        stopUpd()
                    )
                    (if (< (self:y) 90)
                        = tooHigh 1
                    )
                )
            )
            (self:setPri(pIndex))
        )(else
            (if (== param1 1)
                (if ((<> theBoxProp 0) and (<> theBoxProp self))
                    0
                )(else
                    = boxPropBoxID (self:boxID)
                    = theBoxProp_2 self
                    (send global2:setScript(showBox))
                )
            )(else
                (super:doVerb(param1))
            )
        )
    )


    (method (onMe param1 param2)
        (var temp0, temp1, temp2, temp3)
        (if (IsObject(param1))
            = temp0 (send param1:x)
            = temp1 (send param1:y)
        )(else
            = temp0 param1
            = temp1 param2
        )
        = temp3 
            (if (not (super:onMe(temp0 temp1)) or (== theBoxProp self))
            )(else
(                = temp2 OnControl(2 temp0 temp1)
)                (& temp2 (<< $0001 priority))
            )
    )

)
(instance box1 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        boxID 1
    )
)
(instance box2 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 1
        boxID 2
    )
)
(instance box3 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 2
        boxID 3
    )
)
(instance box10 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 3
        boxID 4
    )
)
(instance box5 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 4
        boxID 5
    )
)
(instance box6 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 5
        boxID 6
    )
)
(instance box7 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 6
        boxID 7
    )
)
(instance box8 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 7
        boxID 8
    )
)
(instance box9 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 8
        boxID 9
    )
)
(instance box4 of boxProp
    (properties
        description "bin full of cheap software"
        view 399
        cel 9
        boxID 10
    )
)
(instance theRoom of Feature
    (properties
        x 159
        y 94
        nsTop -1
        nsBottom 189
        nsRight 319
        description "room"
        sightAngle 90
    )
)
(instance myIcon of Prop
    (properties
        x 280
        y 30
        description ""
        view 399
        loop 1
    )

    (method (doVerb)
        (self:setScript(doneWasClicked))
    )

)
(instance doneWasClicked of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (myIcon:setCel(1))
                = cycles 3
            )
            (case 1
                (myIcon:setCel(0))
                = cycles 1
            )
            (case 2
                (send global2:newRoom(397))
                (self:dispose())
            )
        )
    )

)
(instance scriptHandleEvent of Feature
    (properties)

    (method (handleEvent pEvent)
        (send pEvent:claimed(1))
        = local7 1
    )

)
