home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1995 November / SHOWCASE.ISO / files / gallery.dir / 00001_Script_1 next >
Text File  |  1995-06-12  |  16KB  |  437 lines

  1.  
  2. -- òò -- Lingo coding by David K. Anderson and Terry R. Schussler -- òò --
  3.  
  4.  
  5. --òò-- Movie script for Gallery Section --òò--
  6.  
  7. --=============================================--
  8. --      GALLERY.DIR movie script handlers      --
  9. --=============================================--
  10.  
  11. global demoQTstate, cDemoQT, gSectionPressed, gGalleryList, gFirstGoRound
  12. global gProductList, gReturnFromDemo, gProductSelect, gSectionSelect, cAudioLevel
  13. global gPauseSprite, gPlaySprite, gStopSprite, gRewindSprite, gFforwardSprite, gDemoButtonSprite
  14. global gPictureList, gNumOPics, gCurrentPicture, gFirstProductButton, gLastProductButton
  15. global gPictureSprite, gCurrentSection, gLeftFromQT, gMacIDSprite, gWindowsIdSprite, gLaunchQTButton
  16. global gMyPath, gPTimerSet, gPresentationTime, gPresentationLight, gYellowSet, gRedSet, gLightColor
  17.  
  18. on startMovie
  19.   sound stop 1
  20.   sound stop 2
  21.   
  22.   -- Initialize global variables for the sprite channels...
  23.   set gFirstProductButton = 3
  24.   set gLastProductButton = 10
  25.   set gDemoButtonSprite = 11
  26.   set gRewindSprite = 12
  27.   set gFforwardSprite = 13
  28.   set gStopSprite = 14
  29.   set gPauseSprite = 15
  30.   set gPlaySprite = 16
  31.   set gMacIDSprite = 17
  32.   set gWindowsIDSprite = 18
  33.   set cDemoQT = 31
  34.   set gPictureSprite = 34
  35.   set gLaunchQTButton = 37
  36.   set cAudioLevel = 46 -- channel for volume indicator
  37.   set the preLoadEventAbort = TRUE
  38.   --  set the preLoadRAM = FALSE
  39.   if gReturnFromDemo = TRUE then -- We're coming back from a demo...
  40.     set gReturnFromDemo = FALSE
  41.     -- ... so reset the previous state for continued browsing. First check where we left from...
  42.     if gLeftFromQT = TRUE then
  43.       -- Make sure the movie is reset and stopped...
  44.       set the movierate of sprite cDemoQT = 0
  45.       set the movietime of sprite cDemoQT = 0
  46.       put #stop into demoQTstate
  47.     else
  48.       -- Reset the preview picture...
  49.       puppetsprite gLaunchQTButton, 1
  50.       puppetsprite gPictureSprite, 1
  51.       set the castnum of sprite gLaunchQTButton = the number of cast "PlayQT"
  52.       set the castNum of sprite gPictureSprite = the number of cast (string(gCurrentSection) & string(gCurrentPicture))
  53.     end if
  54.     
  55.     -- Turn on the Mac and Windows indicator lights if need be...
  56.     puppetsprite gMacIDSprite, 1
  57.     puppetsprite gWindowsIdSprite, 1
  58.     puppetSprite gDemoButtonSprite, 1
  59.     
  60.     if gProductSelect <> #null then
  61.       
  62.       put getProp(gProductList, gProductSelect) into sectionFlags
  63.       
  64.       if getAt(sectionFlags,1) then 
  65.         set the castNum of sprite gMacIDSprite = the number of cast "macID lit"
  66.       else
  67.         set the castNum of sprite gMacIDSprite = the number of cast "macID"
  68.       end if
  69.       
  70.       if getAt(sectionFlags,2) then 
  71.         set the castNum of sprite gWindowsIdSprite = the number of cast "windowsID lit"
  72.       else
  73.         set the castNum of sprite gWindowsIdSprite = the number of cast "windowsID"
  74.       end if
  75.       
  76.       if the machineType <> 256 then
  77.         
  78.         if getAt(sectionFlags,3) then
  79.           set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo"
  80.         else
  81.           set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo lit"
  82.         end if
  83.         
  84.       else  
  85.         
  86.         if getAt(sectionFlags,4) then
  87.           set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo"
  88.         else
  89.           set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo lit"
  90.         end if
  91.         
  92.       end if
  93.       
  94.       -- Reset the control buttons...
  95.       puppetsprite gSectionPressed, 1
  96.       puppetSprite gDemoButtonSprite, 1
  97.       set the castnum of sprite gDemoButtonSprite = the number of cast "GoDemo"
  98.       set whichCast = string(gSectionSelect)
  99.       set the castnum of sprite gSectionPressed = the number of cast (whichCast && "lit")
  100.     end if
  101.   end if
  102.   
  103.   if gPTimerSet then
  104.     puppetSprite gPresentationLight, 1
  105.     set the castnum of sprite gPresentationLight = the number of cast gLightColor
  106.     updateStage
  107.   end if
  108.   
  109. end
  110.  
  111. -- If we are coming to the Gallery from anywhere other than the Demos or the Quit Screen, we'll initialize
  112. -- the global variables and lists with an init handler called from a score script.
  113. on initGallery
  114.   global soundlevel
  115.   global gProductSelect, gSectionSelect
  116.   global gProductPressed, gSectionPressed, gReturnFromDemo
  117.   global cDemoQT, demoQTstate
  118.   global gGalleryList
  119.   global gProductList
  120.   set gFirstGoRound = 0
  121.   --  if voidP(soundlevel) then put 3 into soundlevel
  122.   set gProductSelect = #null
  123.   put "" into gSectionSelect
  124.   put 0 into gProductPressed
  125.   put 0 into gSectionPressed
  126.   put #stop into demoQTstate
  127.   -- Create a property list which holds the sections and products for those sections...
  128.   set gGalleryList = [#presentations:[#jobseek, #longevity, #sancwoods], #sales:[#virtualdrive, #intershop, #elliott, #cmddemo], #courseware:[#nasa, #connect, #lite], #consumer:[#startrek, #helix, #strad, #keroppi], #kiosks:[#telefono, #napa], #graphics:[#dreamlight, #freakshow, #medicine], #custom:[#imps, #mediaband], #macromedia:[#macromedia]]
  129.   -- The symbol is the name of the label marker which is branched to.
  130.   -- The sublist identifies TRUE (1) or FALSE (0) settings for:  
  131.   -- [Macintosh, Windows, Macintosh Demo, Windows Demo]
  132.   set gProductList =  [#jobseek:[1,1,1,1], #longevity:[1,1,0,0], #sancwoods:[1,1,1,1], #virtualdrive:[1,1,0,0],  #intershop:[1,1,0,0], #elliott:[1,1,1,1], #cmddemo:[1,1,0,0], #nasa:[1,1,0,0], #connect:[1,1,0,0], #lite:[1,1,0,0], #startrek:[1,1,0,0], #helix:[1,1,0,0], #strad:[1,1,0,0], #keroppi:[1,1,1,1], #telefono:[1,1,1,1], #napa:[1,0,0,0], #dreamlight:[1,1,0,0], #freakshow:[1,1,0,0], #medicine:[1,1,0,0], #imps:[1,1,0,0], #mediaband:[1,1,1,1]] 
  133.   -- Create a property list which holds the number of preview pictures for each section...
  134.   set gPictureList = [#presentations:4, #sales:5, #courseware:4, #consumer:5, #kiosks:3, #graphics:4, #custom:3, #macromedia:1]
  135. end
  136.  
  137.  
  138. -- This handler decides which demo to play...
  139. on playGalleryDemo whichOne
  140.   
  141.   set gReturnFromDemo = TRUE
  142.   
  143.   if whichOne = #sancwoods then
  144.     if the machineType = 256 then
  145.       play movie gMyPath & "DEMOS\SANCWOOD\SANCWOOD.DIR"
  146.     else
  147.       play movie gMyPath & "DEMOS:SANCWOOD:SANCWOOD.DIR"
  148.     end if
  149.     exit
  150.   end if
  151.   
  152.   if whichOne = #jobseek then
  153.     if the machineType = 256 then
  154.       play movie gMyPath & "DEMOS\JOBSWIN\JOBSEEK.DIR"
  155.     else
  156.       play movie gMyPath & "DEMOS:JOBSEEK:JOBSEEK.DIR"      
  157.     end if
  158.     exit
  159.   end if
  160.   
  161.   if whichOne = #elliott then
  162.     if the machineType = 256 then
  163.       play movie gMyPath & "DEMOS\ELLIOTTD\ELLIOTTD.DIR"
  164.     else
  165.       play movie gMyPath & "DEMOS:ELLIOTTD:ELLIOTTD.DIR"
  166.     end if
  167.     exit
  168.   end if
  169.   
  170.   if whichOne = #keroppi then
  171.     if the machineType = 256 then
  172.       play movie gMyPath & "DEMOS\KEROPPIW\KP_INTRO.DIR"
  173.     else
  174.       play movie gMyPath & "DEMOS:KEROPPI:KP_INTRO.DIR"
  175.     end if
  176.     exit
  177.   end if
  178.   
  179.   if whichOne = #telefono then
  180.     if the machineType = 256 then
  181.       play movie gMyPath & "DEMOS\ELTELDEM\ETDEMO.DIR"
  182.     else
  183.       play movie gMyPath & "DEMOS:ELTELDEM:ETDEMO.DIR"
  184.     end if
  185.     exit
  186.   end if
  187.   
  188.   if whichOne = #imps then
  189.     if the machineType = 256 then
  190.       play movie gMyPath & "DEMOS\WOODSTOK\WOODSTOK"
  191.     else
  192.       play movie gMyPath & "DEMOS:WOODSTOK:WOODSTOK"
  193.     end if
  194.     exit
  195.   end if
  196.   
  197.   if whichOne = #mediaband then
  198.     if the machineType = 256 then
  199.       play movie gMyPath & "DEMOS\MEDIABAN\HOUSEJAM"
  200.     else
  201.       play movie gMyPath & "DEMOS:MEDIABAN:HOUSEJAM"
  202.     end if
  203.     exit
  204.   end if
  205.   
  206. end
  207.  
  208. --Handlers to play QuickTime movies...
  209.  
  210. -- PLAY button
  211. on galleryQTplay
  212.   put the clickOn into whichSprite
  213.   puppetSprite whichSprite, 1
  214.   set the castNum of sprite gPlaySprite = the number of cast "playGallery lit"
  215.   set the movieRate of sprite cDemoQT = 1
  216.   put #play into demoQTstate
  217.   set the castNum of sprite gStopSprite = the number of cast "stopGallery"
  218.   set the castnum of sprite gPauseSprite = the number of cast "pauseGallery"
  219.   updatestage
  220. end
  221.  
  222. -- PAUSE button
  223. on galleryQTpause
  224.   put the clickOn into whichSprite
  225.   puppetSprite whichSprite, 1
  226.   set the castnum of sprite gPauseSprite = the number of cast "pauseGallery lit"
  227.   if demoQTstate = #play then
  228.     set the movieRate of sprite cDemoQT = 0
  229.     put #pause into demoQTstate
  230.     set the castNum of sprite gPlaySprite = the number of cast "playGallery"
  231.     updatestage
  232.   else
  233.     if demoQTstate = #pause then
  234.       set the movieRate of sprite cDemoQT = 1
  235.       put #play into demoQTstate
  236.       set the castNum of sprite gPauseSprite = the number of cast "pauseGallery"
  237.       set the castNum of sprite gPlaySprite = the number of cast "playGallery lit"
  238.       updatestage
  239.     end if
  240.   end if
  241. end
  242.  
  243. -- STOP button
  244. on galleryQTstop
  245.   -- go back to the menu
  246.   put the clickOn into whichSprite
  247.   puppetSprite whichSprite, 1
  248.   set the movieTime of sprite cDemoQT = 0
  249.   set the movieRate of sprite cDemoQT = 0
  250.   returnToSection
  251.   set the castNum of sprite gStopSprite = the number of cast "stopGallery"
  252.   set the castnum of sprite gPauseSprite = the number of cast "pauseGallery"
  253.   set the castNum of sprite gPlaySprite = the number of cast "playGallery"
  254.   updatestage
  255. end
  256.  
  257. -- FAST FORWARD button
  258. on galleryQTfforward
  259.   put the clickOn into whichSprite
  260.   puppetSprite whichSprite, 1
  261.   set the castNum of sprite gFforwardSprite = the number of cast "fforwardGallery lit"
  262.   set the movieRate of sprite cDemoQT = 2
  263.   repeat while the stillDown
  264.     updateStage
  265.   end repeat
  266.   if the movieTime of sprite cDemoQT = the stopTime of sprite cDemoQT then
  267.     -- go back to the menu
  268.     set the movieTime of sprite cDemoQT = 0
  269.     set the movieRate of sprite cDemoQT = 0
  270.     returnToSection
  271.     exit
  272.   end if
  273.   if demoQTstate = #pause OR demoQTstate = #stop then
  274.     set the movieRate of sprite cDemoQT = 0
  275.   else
  276.     set the movieRate of sprite cDemoQT = 1
  277.   end if
  278. end
  279.  
  280. -- FAST REWIND button
  281. on galleryQTrewind
  282.   put the clickOn into whichSprite
  283.   puppetSprite whichSprite, 1
  284.   set the castNum of sprite gRewindSprite = the number of cast "rewindGallery lit"
  285.   set the movieRate of sprite cDemoQT = -2
  286.   repeat while the stillDown
  287.     updateStage
  288.   end repeat
  289.   if demoQTstate = #pause OR demoQTstate = #stop then
  290.     set the movieRate of sprite cDemoQT = 0
  291.   else
  292.     set the movieRate of sprite cDemoQT = 1
  293.   end if
  294.   exit
  295. end
  296.  
  297. on resetVideoButt
  298.   set the castNum of sprite gPlaySprite = the number of cast "playGallery"
  299.   set the castNum of sprite gStopSprite = the number of cast "stopGallery"
  300.   set the castnum of sprite gPauseSprite = the number of cast "pauseGallery"
  301.   set the castNum of sprite gFforwardSprite = the number of cast "fforwardGallery"
  302.   set the castNum of sprite gRewindSprite = the number of cast "rewindGallery"
  303. end
  304.  
  305. on gallerySelect whichSection
  306.   global gProductPressed, gSectionPressed, gProductSelect, gSectionSelect, gReturnFromDemo
  307.   global gCompColor, gGalleryList, cDemoQT, gMacIDSprite, gWindowsIDSprite, gDemoButtonSprite
  308.   puppetSound "click"
  309.   set gProductSelect = #null
  310.   --  if NOT gFirstGoRound then -- Uncomment this section if memory seems to be in short supply.
  311.   --    set gFirstGoRound = 1
  312.   --  else
  313.   --    unLoadCast (the number of cast (string(gCurrentSection & "1"))),  ¼
  314. --(the number of cast (string(gCurrentSection & getProp(gPictureList, gCurrentSection))))
  315.   --  end if
  316.   -- clear the quickTime movie channel
  317.   puppetSprite cDemoQT, FALSE
  318.   resetVideoButt
  319.   put the clickOn into whichSprite
  320.   puppetSprite whichSprite, TRUE
  321.   put the name of cast the castnum of sprite whichSprite into whichCast
  322.   put whichSprite into gSectionPressed
  323.   put whichSection into gSectionSelect
  324.   set the castnum of sprite whichSprite = the number of cast (whichCast && "lit")
  325.   repeat with x = gFirstProductButton to gLastProductButton
  326.     if x <> gSectionPressed then puppetSprite x, FALSE
  327.   end repeat
  328.   set the castnum of sprite gMacIDSprite = the number of cast "macID"
  329.   set the castnum of sprite gWindowsIDSprite = the number of cast "windowsID"
  330.   set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo lit"
  331.   updateStage
  332.   go to frame string(getPropAt(gGalleryList, whichSprite - 2)) 
  333.   put getProp(gPictureList, whichSection) into gNumOPics
  334.   set gCurrentSection = whichSection
  335.   set gCurrentPicture = 1
  336.   
  337. end gallerySelect
  338.  
  339. on returnToSection
  340.   global gProductPressed, gSectionPressed, gProductSelect, gSectionSelect
  341.   global gGalleryList, cDemoQT
  342.   puppetSprite cDemoQT, FALSE
  343.   
  344.   repeat with n = gStopSprite to gPlaySprite
  345.     put word 1 of the name of cast (the castNum of sprite n) into offcast
  346.     set the castNum of sprite n = the number of cast (offcast)
  347.   end repeat
  348.   go to frame string(getPropAt(gGalleryList, gSectionPressed-2))
  349. end returnToSection
  350.  
  351. on galleryProductSelect whichSection
  352.   global gProductPressed, gSectionPressed, gProductSelect, gSectionSelect, gReturnFromDemo
  353.   global gCompColor, gGalleryList
  354.   if whichSection = #null then
  355.     set the castNum of sprite gMacIDSprite = the number of cast "macID"
  356.     set the castNum of sprite gMacIDSprite = the number of cast "windowsID"
  357.     exit
  358.   else
  359.     if the machinetype <> 256 then  puppetSound "click"
  360.     puppetSprite gPlaySprite, 1
  361.     puppetSprite gLaunchQTButton, 0
  362.     set the castNum of sprite gPlaySprite = the number of cast "playGallery lit"
  363.     put the clickOn into whichSprite
  364.     put the name of cast the castnum of sprite whichSprite into whichCast
  365.     put whichSprite into gProductPressed
  366.     put whichSection into gProductSelect
  367.     
  368.     go to frame string(whichSection)
  369.     
  370.     put getProp(gProductList, gProductSelect) into sectionFlags
  371.     if getAt(sectionFlags,1) then 
  372.       set the castNum of sprite gMacIDSprite = the number of cast "macID lit"
  373.     end if
  374.     
  375.     if getAt(sectionFlags,2) then 
  376.       set the castNum of sprite gWindowsIdSprite = the number of cast "windowsID lit"
  377.     end if
  378.     
  379.     if the machineType <> 256 AND getAt(sectionFlags,3) then
  380.       set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo"
  381.     end if
  382.     
  383.     if the machineType = 256 AND getAt(sectionFlags,4) then
  384.       set the castNum of sprite gDemoButtonSprite = the number of cast "GoDemo"
  385.     end if
  386.     
  387.     updateStage
  388.     galleryQTstart
  389.   end if
  390. end galleryProductSelect
  391.  
  392. -- this plays the quicktime movies in the gallery
  393. -- when movie is done, need to return to prior menu
  394. on galleryQTstart
  395.   global demoQTstate, cDemoQT, gSoundlevel
  396.   -- START button -- upon entry into a product area
  397.   set the movieRate of sprite cDemoQT = 1
  398.   --  set the volume of sprite cDemoQT = ((gSoundlevel)*32) + 32
  399.   set the volume of sprite cDemoQT = 256
  400.   put #play into demoQTstate
  401.   updateStage
  402. end
  403.  
  404.  
  405. on memoryman1
  406.   preLoadCast (the number of cast "Gallery blur"), (the number of cast "QuickDraw Box")
  407. end
  408.  
  409. on mrUnLoader1
  410.   put "Before unloading: The freebytes ="&&string(the freeBytes)&& "and the FreeBlock ="&&string(the freeBlock)
  411.   unLoadCast (the number of cast "up tooth.pict"), (the number of cast "Gallery blur")
  412.   put "After unloading the freebytes ="&&the freeBytes && "and the FreeBlock ="&&the freeBlock
  413. end
  414.  
  415. on mrUnLoader2
  416.   unLoadCast (the number of cast "Binder Snap"), (the number of cast "Startup Loop 2.AIFF")
  417.   unLoadCast (the number of cast "PowerUp1"), (the number of cast "PowerUp12")
  418.   unLoadCast (the number of cast "GALLERY pic"), (the number of cast "RightHand 3")
  419. end
  420.  
  421. on enterFrame
  422.   if gPTimerSet then
  423.     if  the timer > (gPresentationTime * 3600) AND not gRedSet then
  424.       set gLightColor = "Red timer light lit"
  425.       set the castnum of sprite gPresentationLight = the number of cast gLightColor
  426.       set gRedSet = TRUE
  427.       exit 
  428.     end if
  429.     if the timer > ((gPresentationTime * 3600)  - 7200) AND not gYellowSet then
  430.       set gLightColor = "Yellow timer light lit"
  431.       set the castnum of sprite gPresentationLight = the number of cast gLightColor
  432.       set gYellowSet = TRUE
  433.     end if
  434.   end if
  435. end    
  436.  
  437.