home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 July / macformat-039.iso / DATABASE / SHARED.DIR / 01039.ls < prev    next >
Encoding:
Text File  |  1996-03-14  |  5.1 KB  |  203 lines

  1. on ChapterClick
  2.   global gcurtype, gQTstatus
  3.   if (gcurtype = "qt") or ((gcurtype = "movie") and (the frameLabel = "qt")) then
  4.     if the movieRate of sprite 16 then
  5.       set gQTstatus to 1
  6.     else
  7.       set gQTstatus to 0
  8.     end if
  9.     set the movieRate of sprite 16 to 0
  10.     puppetSprite(16, 1)
  11.     set the locH of sprite 16 to 1000
  12.   end if
  13.   ClickSnd()
  14.   updateStage()
  15.   NavButtonWindow()
  16.   EndTrapMouse()
  17. end
  18.  
  19. on NavButtonClose
  20.   global gcurtype
  21.   if not rollOver(33) then
  22.     if the puppet of sprite 33 then
  23.       set the locH of sprite 33 to 1000
  24.       set the locH of sprite 34 to 1000
  25.       updateStage()
  26.       puppetSprite(33, 0)
  27.       puppetSprite(34, 0)
  28.     end if
  29.   end if
  30.   if ((the frameLabel = "qt") and (gcurtype = "movie")) or (gcurtype = "qt") then
  31.     puppetSprite(16, 0)
  32.   end if
  33. end
  34.  
  35. on NavButtonWindow
  36.   global gWorld
  37.   puppetSprite(33, 1)
  38.   puppetSprite(34, 1)
  39.   if gWorld = "senses" then
  40.     set the locH of sprite 33 to 428
  41.     set the locH of sprite 34 to 433
  42.   else
  43.     if gWorld = "body" then
  44.       set the locH of sprite 33 to 358
  45.       set the locH of sprite 34 to 361
  46.     else
  47.       if gWorld = "design" then
  48.         set the locH of sprite 33 to 352
  49.         set the locH of sprite 34 to 355
  50.       else
  51.         if gWorld = "power" then
  52.           set the locH of sprite 33 to 327
  53.           set the locH of sprite 34 to 330
  54.         else
  55.           if gWorld = "discover" then
  56.             set the locH of sprite 33 to 439
  57.             set the locH of sprite 34 to 442
  58.           else
  59.             if gWorld = "mind" then
  60.               set the locH of sprite 33 to 431
  61.               set the locH of sprite 34 to 433
  62.             end if
  63.           end if
  64.         end if
  65.       end if
  66.     end if
  67.   end if
  68.   set the height of sprite 33 to the height of cast "chaptertitles" + 10
  69. end
  70.  
  71. on NavButtonUpdate
  72.   global gCurChap, gCurArticle, gArticles
  73.   set numarticles to count(getAt(gArticles, gCurChap))
  74.   set the text of field "CurrentChapter" to line gCurChap of field "chaptertitles"
  75.   set the text of field "CurrentArticle" to gCurArticle && "of" && numarticles
  76.   if numarticles = 1 then
  77.     set the visible of sprite 35 to 0
  78.     set the visible of sprite 36 to 0
  79.   else
  80.     set the visible of sprite 35 to 1
  81.     set the visible of sprite 36 to 1
  82.   end if
  83. end
  84.  
  85. on DoNugget
  86.   global gNuggetTime, gNuggetDelay, gNuggetOn, gWhichNugget, gMaxNuggets, gStartNuggetCast, gInAMap
  87.   if gInAMap then
  88.     exit
  89.   end if
  90.   if gWhichNugget < 0 then
  91.     exit
  92.   end if
  93.   if the frameLabel = "qt" then
  94.     exit
  95.   end if
  96.   if the frameLabel = "facts" then
  97.     exit
  98.   end if
  99.   set the itemDelimiter to "."
  100.   set tmp to item 2 of the frameLabel
  101.   set the itemDelimiter to ","
  102.   if tmp = "anim" then
  103.     exit
  104.   end if
  105.   if not gNuggetOn then
  106.     if (the ticks - gNuggetTime) > gNuggetDelay then
  107.       set gNuggetOn to 1
  108.     else
  109.       exit
  110.     end if
  111.   end if
  112.   set nsp to 47
  113.   set speed to 5
  114.   if not (the puppet of sprite 47) then
  115.     set gStartNuggetCast to the castNum of sprite 47
  116.     puppetSprite(47, 1)
  117.     set the locH of sprite 47 to 635
  118.     set the locV of sprite 47 to 100 + random(200)
  119.   else
  120.     set tmp to the castNum of sprite 47
  121.     if the name of cast tmp = "nugget6" then
  122.       set tmp to gStartNuggetCast
  123.     else
  124.       set tmp to tmp + 1
  125.     end if
  126.     set the castNum of sprite 47 to tmp
  127.     set the locH of sprite 47 to the locH of sprite 47 - speed
  128.     if the locH of sprite 47 < 0 then
  129.       set gNuggetOn to 0
  130.       set gNuggetTime to the ticks
  131.       puppetSprite(47, 0)
  132.     end if
  133.   end if
  134. end
  135.  
  136. on ShowNugget
  137.   global gWhichNugget, gnuggets, gMaxNuggets, gNuggetOn, gNuggetTime, gNuggetList
  138.   ClickSnd()
  139.   updateStage()
  140.   if gNuggetOn = 2 then
  141.     exit
  142.   end if
  143.   set gNuggetOn to 2
  144.   set nsb to 46
  145.   set nsp to 47
  146.   set nspt to 48
  147.   set the itemDelimiter to "#"
  148.   set the text of field "nuggettext" to item gWhichNugget of gnuggets
  149.   set the itemDelimiter to ","
  150.   set h to the height of cast "nuggettext"
  151.   set w to the width of cast "nuggettext"
  152.   set x to the locH of sprite nsp
  153.   set y to the locV of sprite nsp
  154.   put x && y
  155.   if x < 50 then
  156.     set x to 50
  157.   else
  158.     if x > 350 then
  159.       set x to 350
  160.     end if
  161.   end if
  162.   if y < 50 then
  163.     set y to 50
  164.   else
  165.     if y > 400 then
  166.       set y to 400
  167.     end if
  168.   end if
  169.   put x && y
  170.   set the castNum of sprite nsp to the number of cast "nuggetback"
  171.   spriteBox(nsp, x - 15, y - 15, x + w + 15, y + h + 15)
  172.   set the locH of sprite nspt to x
  173.   set the locV of sprite nspt to y
  174.   set temptime to the ticks
  175.   repeat while the mouseDown
  176.     updateStage()
  177.   end repeat
  178.   repeat while (the ticks - temptime) < 30
  179.     updateStage()
  180.   end repeat
  181.   repeat while not (the mouseDown)
  182.     updateStage()
  183.   end repeat
  184.   set gNuggetOn to 0
  185.   set gNuggetTime to the ticks
  186.   set the locH of sprite nsp to 1000
  187.   set the locH of sprite nspt to 1000
  188.   updateStage()
  189.   puppetSprite(nsp, 0)
  190.   puppetSprite(nspt, 0)
  191.   set gWhichNugget to random(gMaxNuggets)
  192.   set tmp to count(gNuggetList)
  193.   if tmp >= gMaxNuggets then
  194.     set gWhichNugget to -1
  195.   else
  196.     repeat while getPos(gNuggetList, gWhichNugget)
  197.       set gWhichNugget to random(gMaxNuggets)
  198.     end repeat
  199.     add(gNuggetList, gWhichNugget)
  200.   end if
  201.   EndTrapMouse()
  202. end
  203.