home *** CD-ROM | disk | FTP | other *** search
/ Computer Life: SuperPac / SuperPac (Computer Life Magazine)(Ziff-Davis)(1995).ISO / pc / demos / origin / catalog / catalog.exe / catalog.DXR / 00206.ls < prev    next >
Encoding:
Text File  |  1994-11-13  |  14.8 KB  |  465 lines

  1. on startMovie
  2.   global comeHome
  3.   updateStage()
  4. end
  5.  
  6. on stopMovie
  7. end
  8.  
  9. on simpleButton whereToGoOrWhatToDo
  10.   set mouseDownTime to the timer
  11.   set buttonOriginalV to the locV of sprite the clickOn
  12.   set buttonOriginalH to the locH of sprite the clickOn
  13.   set buttonNewV to the locV of sprite the clickOn + 1
  14.   set buttonNewH to the locH of sprite the clickOn + 1
  15.   set the puppet of sprite the clickOn to 1
  16.   set the locV of sprite the clickOn to buttonNewV
  17.   set the locH of sprite the clickOn to buttonNewH
  18.   set the puppet of sprite the clickOn to 0
  19.   updateStage()
  20.   repeat while the stillDown
  21.     if rollOver(the clickOn) then
  22.       set the puppet of sprite the clickOn to 1
  23.       set the locV of sprite the clickOn to buttonNewV
  24.       set the locH of sprite the clickOn to buttonNewH
  25.       set the puppet of sprite the clickOn to 0
  26.       updateStage()
  27.       next repeat
  28.     end if
  29.     set the puppet of sprite the clickOn to 1
  30.     set the locV of sprite the clickOn to buttonOriginalV
  31.     set the locH of sprite the clickOn to buttonOriginalH
  32.     set the puppet of sprite the clickOn to 0
  33.     updateStage()
  34.   end repeat
  35.   repeat while (mouseDownTime + 7) > the timer
  36.     nothing()
  37.   end repeat
  38.   set the puppet of sprite the clickOn to 1
  39.   set the locV of sprite the clickOn to buttonOriginalV
  40.   set the locH of sprite the clickOn to buttonOriginalH
  41.   set the puppet of sprite the clickOn to 0
  42.   updateStage()
  43.   if rollOver(the clickOn) then
  44.     if stringp(whereToGoOrWhatToDo) then
  45.       if the labelList contains whereToGoOrWhatToDo then
  46.         go(whereToGoOrWhatToDo)
  47.       else
  48.         do(whereToGoOrWhatToDo)
  49.       end if
  50.     end if
  51.   end if
  52. end
  53.  
  54. on oldthreeDbutton whereToGoOrWhatToDo
  55.   set mouseDownTime to the timer
  56.   set originalCastNum to the castNum of sprite the clickOn
  57.   set newCastNum to the castNum of sprite the clickOn + 1
  58.   set the puppet of sprite the clickOn to 1
  59.   set the castNum of sprite the clickOn to newCastNum
  60.   puppetSound("button down")
  61.   updateStage()
  62.   set lastSoundPlayed to "down sound"
  63.   repeat while the stillDown
  64.     if rollOver(the clickOn) then
  65.       set the castNum of sprite the clickOn to newCastNum
  66.       updateStage()
  67.       if lastSoundPlayed = "down sound" then
  68.         nothing()
  69.       else
  70.         if lastSoundPlayed = "up sound" then
  71.           puppetSound("button down")
  72.           set lastSoundPlayed to "down sound"
  73.         end if
  74.       end if
  75.       next repeat
  76.     end if
  77.     if not rollOver(the clickOn) then
  78.       set the castNum of sprite the clickOn to originalCastNum
  79.       updateStage()
  80.       if lastSoundPlayed = "up sound" then
  81.         nothing()
  82.         next repeat
  83.       end if
  84.       if lastSoundPlayed = "down sound" then
  85.         puppetSound("button up")
  86.         set lastSoundPlayed to "up sound"
  87.       end if
  88.     end if
  89.   end repeat
  90.   repeat while (mouseDownTime + 5) > the timer
  91.     nothing()
  92.   end repeat
  93.   set the castNum of sprite the clickOn to originalCastNum
  94.   set the puppet of sprite the clickOn to 0
  95.   updateStage()
  96.   if lastSoundPlayed = "up sound" then
  97.     nothing()
  98.   else
  99.     if lastSoundPlayed = "down sound" then
  100.       puppetSound("button up")
  101.       set lastSoundPlayed to "up sound"
  102.     end if
  103.   end if
  104.   if rollOver(the clickOn) then
  105.     if stringp(whereToGoOrWhatToDo) then
  106.       if the labelList contains whereToGoOrWhatToDo then
  107.         go(whereToGoOrWhatToDo)
  108.       else
  109.         do(whereToGoOrWhatToDo)
  110.       end if
  111.     end if
  112.   end if
  113. end
  114.  
  115. on threeDButton whereToGoOrWhatToDo
  116.   set mouseDownTime to the timer
  117.   set buttonOriginalCast to the castNum of sprite the clickOn
  118.   set buttonNewCast to the castNum of sprite the clickOn + 1
  119.   set the puppet of sprite the clickOn to 1
  120.   set the castNum of sprite the clickOn to buttonNewCast
  121.   set the puppet of sprite the clickOn to 0
  122.   updateStage()
  123.   repeat while the stillDown
  124.     if rollOver(the clickOn) then
  125.       set the puppet of sprite the clickOn to 1
  126.       set the castNum of sprite the clickOn to buttonNewCast
  127.       set the puppet of sprite the clickOn to 0
  128.       updateStage()
  129.       next repeat
  130.     end if
  131.     set the puppet of sprite the clickOn to 1
  132.     set the castNum of sprite the clickOn to buttonOriginalCast
  133.     set the puppet of sprite the clickOn to 0
  134.     updateStage()
  135.   end repeat
  136.   repeat while (mouseDownTime + 7) > the timer
  137.     nothing()
  138.   end repeat
  139.   set the puppet of sprite the clickOn to 1
  140.   set the castNum of sprite the clickOn to buttonOriginalCast
  141.   set the puppet of sprite the clickOn to 0
  142.   updateStage()
  143.   if rollOver(the clickOn) then
  144.     if stringp(whereToGoOrWhatToDo) then
  145.       if the labelList contains whereToGoOrWhatToDo then
  146.         cursor(4)
  147.         go(whereToGoOrWhatToDo)
  148.       else
  149.         do(whereToGoOrWhatToDo)
  150.       end if
  151.     end if
  152.   end if
  153. end
  154.  
  155. on startScroller graphic, quartetStart, speed
  156.   global scrollerOn, graphicSprite, qSprite, scrollSpeed
  157.   set graphicSprite to graphic
  158.   set qSprite to quartetStart
  159.   set scrollSpeed to speed
  160.   puppetSprite(graphicSprite, 1)
  161.   repeat with i = qSprite to qSprite + 3
  162.     puppetSprite(i, 1)
  163.   end repeat
  164.   set the scriptText of cast the castNum of sprite qSprite to the text of cast the number of cast "sDown"
  165.   set the scriptText of cast the castNum of sprite (qSprite + 1) to the text of cast the number of cast "sUp"
  166.   set the scriptText of cast the castNum of sprite (qSprite + 2) to the text of cast the number of cast "sTrack"
  167.   set the scriptText of cast the castNum of sprite (qSprite + 3) to the text of cast the number of cast "sThumb"
  168.   updateStage()
  169.   set scrollerOn to 1
  170. end
  171.  
  172. on stopScroller
  173.   global scrollerOn, comeHome, graphicSprite, qSprite, scrollSpeed
  174.   set comeHome to marker(0)
  175.   if scrollerOn then
  176.     puppetSprite(graphicSprite, 0)
  177.     repeat with i = qSprite to qSprite + 3
  178.       puppetSprite(i, 0)
  179.     end repeat
  180.     set the scriptText of cast the castNum of sprite qSprite to EMPTY
  181.     set the scriptText of cast the castNum of sprite (qSprite + 1) to EMPTY
  182.     set the scriptText of cast the castNum of sprite (qSprite + 2) to EMPTY
  183.     set the scriptText of cast the castNum of sprite (qSprite + 3) to EMPTY
  184.     set graphicSprite to 0
  185.     set qSprite to 0
  186.     set scrollSpeed to 0
  187.     set scrollerOn to 0
  188.   end if
  189. end
  190.  
  191. on scrollGraphic scrollDirection
  192.   global graphicSprite, scrollSpeed
  193.   set firstTimeThrough to 1
  194.   set insideSlopRect to 1
  195.   set done to 0
  196.   set clickOnCastNum to the castNum of sprite the clickOn
  197.   repeat while the stillDown
  198.     if firstTimeThrough then
  199.       set the castNum of sprite the clickOn to clickOnCastNum + 1
  200.       updateStage()
  201.       if scrollDirection = "up" then
  202.         set upOrDown to "down"
  203.       else
  204.         set upOrDown to "up"
  205.       end if
  206.       set firstTimeThrough to 0
  207.     end if
  208.     if insideSlopRect and not rollOver(the clickOn) then
  209.       set the castNum of sprite the clickOn to clickOnCastNum
  210.       updateStage()
  211.       set insideSlopRect to 0
  212.     end if
  213.     if not insideSlopRect and rollOver(the clickOn) then
  214.       set the castNum of sprite the clickOn to clickOnCastNum + 1
  215.       updateStage()
  216.       set insideSlopRect to 1
  217.     end if
  218.     if insideSlopRect then
  219.       if not done then
  220.         putGraphic(upOrDown, scrollSpeed)
  221.         set done to the result
  222.       end if
  223.     end if
  224.   end repeat
  225.   if insideSlopRect then
  226.     set the castNum of sprite the clickOn to clickOnCastNum
  227.     updateStage()
  228.   end if
  229. end
  230.  
  231. on moveGraphic
  232.   global graphicSprite, qSprite
  233.   set slopRect to 25
  234.   set clickOnCastNum to the castNum of sprite the clickOn
  235.   set offsetV to the mouseV - the locV of sprite the clickOn
  236.   set startV to the locV of sprite (qSprite + 3)
  237.   set topOff to the locV of sprite the clickOn - the top of sprite the clickOn
  238.   set topV to the top of sprite (qSprite + 2) + topOff
  239.   set botOff to the bottom of sprite the clickOn - the locV of sprite the clickOn
  240.   set botV to the bottom of sprite (qSprite + 2) - botOff
  241.   set firstTimeThrough to 1
  242.   set insideSlopRect to 1
  243.   set done to 0
  244.   repeat while the stillDown
  245.     if firstTimeThrough then
  246.       set the castNum of sprite the clickOn to clickOnCastNum + 1
  247.       updateStage()
  248.       set firstTimeThrough to 0
  249.     end if
  250.     set rollOverQ to 0
  251.     if not rollOver(qSprite + 2) then
  252.       if (the mouseH > (the left of sprite (qSprite + 3) - slopRect)) and (the mouseH < (the right of sprite (qSprite + 3) + slopRect)) then
  253.         set rollOverQ to 1
  254.       end if
  255.     else
  256.       set rollOverQ to 1
  257.     end if
  258.     if insideSlopRect and not rollOverQ then
  259.       set the castNum of sprite the clickOn to clickOnCastNum
  260.       updateStage()
  261.       set insideSlopRect to 0
  262.     end if
  263.     if not insideSlopRect and rollOverQ then
  264.       set the castNum of sprite the clickOn to clickOnCastNum + 1
  265.       updateStage()
  266.       set insideSlopRect to 1
  267.     end if
  268.     if insideSlopRect then
  269.       set newV to the mouseV - offsetV
  270.       if newV > botV then
  271.         set newV to botV
  272.       end if
  273.       if newV < topV then
  274.         set newV to topV
  275.       end if
  276.       set the locV of sprite the clickOn to newV
  277.       updateStage()
  278.     end if
  279.   end repeat
  280.   if insideSlopRect then
  281.     set the castNum of sprite the clickOn to clickOnCastNum
  282.     positionGraphic()
  283.   else
  284.     set the locV of sprite (qSprite + 3) to startV
  285.     updateStage()
  286.   end if
  287. end
  288.  
  289. on oldmoveGraphic
  290.   global graphicSprite, qSprite
  291.   set slopRect to 25
  292.   set offsetV to the mouseV - the locV of sprite the clickOn
  293.   set startV to the locV of sprite (qSprite + 3)
  294.   set topOff to the locV of sprite the clickOn - the top of sprite the clickOn
  295.   set topV to the top of sprite (qSprite + 2) + topOff
  296.   set botOff to the bottom of sprite the clickOn - the locV of sprite the clickOn
  297.   set botV to the bottom of sprite (qSprite + 2) - botOff
  298.   set firstTimeThrough to 1
  299.   set insideSlopRect to 1
  300.   set done to 0
  301.   repeat while the stillDown
  302.     if firstTimeThrough then
  303.       set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  304.       updateStage()
  305.       set firstTimeThrough to 0
  306.     end if
  307.     set rollOverQ to 0
  308.     if not rollOver(qSprite + 2) then
  309.       if (the mouseH > (the left of sprite (qSprite + 3) - slopRect)) and (the mouseH < (the right of sprite (qSprite + 3) + slopRect)) then
  310.         set rollOverQ to 1
  311.       end if
  312.     else
  313.       set rollOverQ to 1
  314.     end if
  315.     if insideSlopRect and not rollOverQ then
  316.       set the castNum of sprite the clickOn to the castNum of sprite the clickOn - 1
  317.       updateStage()
  318.       set insideSlopRect to 0
  319.     end if
  320.     if not insideSlopRect and rollOverQ then
  321.       set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  322.       updateStage()
  323.       set insideSlopRect to 1
  324.     end if
  325.     if insideSlopRect then
  326.       set newV to the mouseV - offsetV
  327.       if newV > botV then
  328.         set newV to botV
  329.       end if
  330.       if newV < topV then
  331.         set newV to topV
  332.       end if
  333.       set the locV of sprite the clickOn to newV
  334.       updateStage()
  335.     end if
  336.   end repeat
  337.   if insideSlopRect then
  338.     set the castNum of sprite the clickOn to the castNum of sprite the clickOn - 1
  339.     positionGraphic()
  340.   else
  341.     set the locV of sprite (qSprite + 3) to startV
  342.     updateStage()
  343.   end if
  344. end
  345.  
  346. on pageGraphic
  347.   global graphicSprite, qSprite
  348.   set firstTimeThrough to 1
  349.   set insideSlopRect to 1
  350.   set done to 0
  351.   repeat while the stillDown
  352.     if firstTimeThrough then
  353.       if the mouseV < the top of sprite (qSprite + 3) then
  354.         set upOrDown to "up"
  355.       else
  356.         if the mouseV > the top of sprite (qSprite + 3) then
  357.           set upOrDown to "down"
  358.         else
  359.           exit repeat
  360.         end if
  361.       end if
  362.       set increment to the bottom of sprite (qSprite + 1) - the top of sprite qSprite - 2
  363.       set firstTimeThrough to 0
  364.     end if
  365.     if upOrDown = "up" then
  366.       if the mouseV >= the top of sprite (qSprite + 3) then
  367.         set done to 1
  368.       else
  369.         set done to 0
  370.       end if
  371.     else
  372.       if upOrDown = "down" then
  373.         if the mouseV <= the top of sprite (qSprite + 3) then
  374.           set done to 1
  375.         else
  376.           set done to 0
  377.         end if
  378.       else
  379.         nothing()
  380.       end if
  381.     end if
  382.     if insideSlopRect and not rollOver(the clickOn) then
  383.       set insideSlopRect to 0
  384.     end if
  385.     if not insideSlopRect and rollOver(the clickOn) then
  386.       set insideSlopRect to 1
  387.     end if
  388.     if insideSlopRect then
  389.       if not done then
  390.         putGraphic(upOrDown, increment)
  391.         set done to the result
  392.         updateStage()
  393.         set time to the timer
  394.         repeat while the timer < (time + 15)
  395.           nothing()
  396.         end repeat
  397.       end if
  398.     end if
  399.   end repeat
  400. end
  401.  
  402. on putGraphic upOrDown, movePixels
  403.   global graphicSprite, qSprite, startV
  404.   set done to 0
  405.   if upOrDown = "down" then
  406.     set rem to the bottom of sprite graphicSprite - the bottom of sprite (qSprite + 1)
  407.     if rem > movePixels then
  408.       set the locV of sprite graphicSprite to the locV of sprite graphicSprite - movePixels
  409.     else
  410.       set the locV of sprite graphicSprite to the locV of sprite graphicSprite - rem
  411.       set done to 1
  412.     end if
  413.     updateStage()
  414.     positionThumbWheel()
  415.   end if
  416.   if upOrDown = "up" then
  417.     set rem to the top of sprite qSprite - the top of sprite graphicSprite
  418.     if rem > movePixels then
  419.       set the locV of sprite graphicSprite to the locV of sprite graphicSprite + movePixels
  420.     else
  421.       set the locV of sprite graphicSprite to the locV of sprite graphicSprite + rem
  422.       set done to 1
  423.     end if
  424.     updateStage()
  425.     positionThumbWheel()
  426.   end if
  427.   return done
  428. end
  429.  
  430. on positionThumbWheel
  431.   global graphicSprite, qSprite
  432.   set track to the height of sprite (qSprite + 2)
  433.   set thumb to the height of sprite (qSprite + 3)
  434.   set thumbOffset to the locV of sprite (qSprite + 3) - the top of sprite (qSprite + 3)
  435.   set freeTrack to track - thumb
  436.   set graphicShowing to the bottom of sprite (qSprite + 1) - the top of sprite qSprite
  437.   set excessGraphic to the height of sprite graphicSprite - graphicShowing
  438.   if (the top of sprite qSprite - the top of sprite graphicSprite) < excessGraphic then
  439.     set graphicPos to (the top of sprite qSprite - the top of sprite graphicSprite) / (excessGraphic * 1.0)
  440.   else
  441.     set graphicPos to 1.0
  442.   end if
  443.   set thumbV to the top of sprite (qSprite + 2) + (graphicPos * freeTrack)
  444.   set the locV of sprite (qSprite + 3) to thumbV + thumbOffset
  445.   updateStage()
  446. end
  447.  
  448. on positionGraphic
  449.   global graphicSprite, qSprite
  450.   set track to the height of sprite (qSprite + 2)
  451.   set thumb to the height of sprite (qSprite + 3)
  452.   set freeTrack to track - thumb
  453.   set graphicShowing to the bottom of sprite (qSprite + 1) - the top of sprite qSprite
  454.   set excessGraphic to the height of sprite graphicSprite - graphicShowing
  455.   set graphicOffset to the locV of sprite graphicSprite - the top of sprite graphicSprite
  456.   if (the top of sprite (qSprite + 3) - the top of sprite (qSprite + 2)) < freeTrack then
  457.     set thumbPos to (the top of sprite (qSprite + 3) - the top of sprite (qSprite + 2)) / (freeTrack * 1.0)
  458.   else
  459.     set thumbPos to 1.0
  460.   end if
  461.   set graphicV to the top of sprite qSprite - (thumbPos * excessGraphic)
  462.   set the locV of sprite graphicSprite to graphicV + graphicOffset
  463.   updateStage()
  464. end
  465.