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

  1. on GoArticle
  2.   global gChapters, gTitles, gArticles, gDates, gCaptions, gCurCutting, gCurChap, gCurArticle, gName, mytext, gArticlePage, gFullCuttings, gFormattedText, gTextPages, gMaxLines, gCurIndex, gWorld, gSeenMaps, gPaperLoch, gMakerName, gHeadlocH, gNameLoch, gNameLocv, gMakerNum, gQTpath, gSoundpath, gNuggetTime, gNuggetDelay, gNameCastnum, gInAMap, gcurtype, gPrintHead, gCurPic, gNuggetOn
  3.   set gNuggetTime to the ticks
  4.   set gNuggetOn to 0
  5.   set the text of field "ArticleNumber" to gMakerNum & ":" && gCurChap & "." & gCurArticle
  6.   set type to getAt(getAt(gArticles, gCurChap), gCurArticle)
  7.   set gcurtype to type
  8.   set picsprite to 9
  9.   set cuttingsprite to 6
  10.   set titlesprite to 8
  11.   set papersprite to 11
  12.   set datesprite to 12
  13.   set captionsprite to 7
  14.   set forwardbutton to 20
  15.   set backbutton to 19
  16.   set headsprite to 10
  17.   set namesprite to 4
  18.   set headloch to gHeadlocH
  19.   set gInAMap to 0
  20.   set gPrintHead to EMPTY
  21.   puppetTempo(25)
  22.   sound playFile 1, gSoundpath & "S" & gMakerNum & "A" & gCurChap & gCurArticle
  23.   if not (the frameLabel contains "pict") then
  24.     set gCurPic to 0
  25.   end if
  26.   if (type <> "cutting") and (gWorld = "design") and (the frameLabel = "cutting") then
  27.     set the locH of sprite namesprite to 1000
  28.     set the castNum of sprite namesprite to gNameCastnum
  29.   end if
  30.   set the itemDelimiter to "."
  31.   set tmp to item 2 of the frameLabel
  32.   set the itemDelimiter to ","
  33.   if (tmp = "anim") or (the frameLabel = "qt") then
  34.     if the frameLabel = "qt" then
  35.       set the movieRate of sprite 16 to 0
  36.       updateStage()
  37.     end if
  38.     puppetSprite(47, 1)
  39.     set the castNum of sprite 47 to the number of cast "screenblank"
  40.     spriteBox(47, 0, 0, 640, 480)
  41.     updateStage()
  42.     puppetSprite(47, 0)
  43.   end if
  44.   if type = "pic" then
  45.     GoPictArticle()
  46.   else
  47.     if type = "animation" then
  48.       GoAnimArticle()
  49.     else
  50.       if type = "map" then
  51.         set gInAMap to 1
  52.         puppetSprite(forwardbutton, 0)
  53.         puppetSprite(backbutton, 0)
  54.         puppetSprite(papersprite, 0)
  55.         GetMapCap()
  56.         unpuppet("4,10")
  57.         go(gMakerName)
  58.         CleanMem()
  59.         puppetTempo(12)
  60.         set the visible of sprite 19 to 1
  61.         set the visible of sprite 20 to 1
  62.         set the locH of sprite headsprite to headloch
  63.       else
  64.         if type = "movie" then
  65.           set the locH of sprite headsprite to headloch
  66.           puppetSprite(forwardbutton, 0)
  67.           puppetSprite(backbutton, 0)
  68.           puppetSprite(papersprite, 0)
  69.           set the text of field "caption-qt" to " "
  70.           unpuppet("4,10")
  71.           set cnum to the number of cast "QTcast"
  72.           set the fileName of cast cnum to gQTpath & "BLACK.MOV"
  73.           set the name of cast cnum to "QTcast"
  74.           if gMakerNum = 119 then
  75.             go("QT.MAT")
  76.           else
  77.             go("QT")
  78.           end if
  79.           CleanMem()
  80.           UnloadMem()
  81.           if (gWorld = "Senses") or (gWorld = "Design") then
  82.             set the locH of sprite namesprite to gNameLoch
  83.             set the locV of sprite namesprite to gNameLocv
  84.           end if
  85.           puppetSprite(captionsprite, 1)
  86.           set captionloch to the locH of sprite captionsprite
  87.           set the castNum of sprite captionsprite to the number of cast "caption-qt"
  88.           set the locH of sprite captionsprite to 1000
  89.           set the locH of sprite picsprite to 1000
  90.           updateStage()
  91.           set tmpcap to GetCaption()
  92.           set the text of field "caption-qt" to tmpcap
  93.           if gWorld <> "Senses" then
  94.             set the textHeight of field "caption-qt" to 18
  95.           else
  96.             set the textHeight of field "caption-qt" to 25
  97.           end if
  98.           if gWorld = "Discover" then
  99.             set centerpoint to 250
  100.           else
  101.             set centerpoint to 280
  102.           end if
  103.           set caph to the height of cast "caption-qt"
  104.           if (gWorld <> "Senses") and (gWorld <> "Body") then
  105.             set the locV of sprite captionsprite to centerpoint - (caph / 2)
  106.           else
  107.             if gWorld = "Body" then
  108.               set the locV of sprite captionsprite to 112
  109.             end if
  110.           end if
  111.           set the locH of sprite captionsprite to captionloch
  112.           updateStage()
  113.           puppetSprite(11, 1)
  114.           set fname to gQTpath & "V" & gMakerNum & ".MOV"
  115.           put fname
  116.           set the fileName of cast cnum to fname
  117.           set the name of cast cnum to "QTcast"
  118.           set the movieTime of sprite 16 to 0
  119.           updateStage()
  120.           set the movieRate of sprite 16 to 1
  121.           updateStage()
  122.           SetVolume()
  123.         else
  124.           if type = "sound" then
  125.             GoSoundArticle()
  126.           else
  127.             if type = "cutting" then
  128.               puppetSprite(forwardbutton, 0)
  129.               puppetSprite(backbutton, 0)
  130.               if gWorld <> "mind" then
  131.                 set the locH of sprite headsprite to 1000
  132.               end if
  133.               if (gWorld = "senses") or (gWorld = "mind") then
  134.                 set gMaxLines to 16
  135.               else
  136.                 if gWorld = "Discover" then
  137.                   set gMaxLines to 15
  138.                 else
  139.                   set gMaxLines to 17
  140.                 end if
  141.               end if
  142.               if the frameLabel <> "cutting" then
  143.                 set the text of field "cutting" to " "
  144.                 set the textSize of field "cutting" to 18
  145.                 set the text of field "date" to " "
  146.                 set the text of field "caption" to " "
  147.                 set the text of field "title" to " "
  148.                 puppetSprite(picsprite, 1)
  149.                 set the locH of sprite picsprite to 1000
  150.                 if (gWorld = "Senses") or (gWorld = "Design") then
  151.                   set the locH of sprite namesprite to 1000
  152.                 end if
  153.                 unpuppet("4,10")
  154.                 if gMakerNum = 119 then
  155.                   go("cutting.MAT")
  156.                 else
  157.                   go("cutting")
  158.                 end if
  159.                 CleanMem()
  160.                 puppetSprite(papersprite, 1)
  161.                 set gPaperLoch to the locH of sprite papersprite
  162.                 set the locH of sprite papersprite to 1000
  163.               end if
  164.               cursor(4)
  165.               puppetSprite(cuttingsprite, 1)
  166.               puppetSprite(titlesprite, 1)
  167.               puppetSprite(papersprite, 1)
  168.               puppetSprite(datesprite, 1)
  169.               puppetSprite(captionsprite, 1)
  170.               set cuttingloch to the locH of sprite cuttingsprite
  171.               set titleloch to the locH of sprite titlesprite
  172.               set dateloch to the locH of sprite datesprite
  173.               set captionloch to the locH of sprite captionsprite
  174.               set the castNum of sprite captionsprite to the number of cast "caption"
  175.               set the locH of sprite cuttingsprite to 1000
  176.               set the locH of sprite captionsprite to 1000
  177.               set the locH of sprite datesprite to 1000
  178.               set the locH of sprite titlesprite to 1000
  179.               updateStage()
  180.               set tmpdate to getAt(getAt(gDates, gCurChap), gCurArticle)
  181.               set the itemDelimiter to "@"
  182.               set tmpcap to item gCurChap of gTitles
  183.               set the itemDelimiter to "#"
  184.               set the text of field "title" to item gCurArticle of tmpcap
  185.               set the itemDelimiter to ","
  186.               set tmpcap to GetCaption()
  187.               set the text of field "caption" to tmpcap
  188.               if not stringp(title) then
  189.                 set title to " "
  190.               end if
  191.               if not stringp(date) then
  192.                 set date to " "
  193.               end if
  194.               set the textHeight of field "caption" to 18
  195.               set tmpnum to charToNum(char 1 of tmpdate)
  196.               set paper to item 1 of tmpdate
  197.               delete item 1 of tmpdate
  198.               set paper to word 1 to the number of words in paper of paper
  199.               if word 1 of paper = "The" then
  200.                 delete word 1 of paper
  201.               end if
  202.               if paper = "Time" then
  203.                 set paper to "Times"
  204.               else
  205.                 if paper = "Sunday Time" then
  206.                   set paper to "Sunday Times"
  207.                 else
  208.                   if paper = "Times Literary Supplement" then
  209.                     set paper to "tls"
  210.                   end if
  211.                 end if
  212.               end if
  213.               if gMakerNum = 119 then
  214.                 set the castNum of sprite papersprite to the number of cast (paper & ".logo.MAT")
  215.               else
  216.                 set the castNum of sprite papersprite to the number of cast (paper & ".logo")
  217.               end if
  218.               if char 1 of tmpdate = " " then
  219.                 delete char 1 of tmpdate
  220.               end if
  221.               set the text of field "date" to tmpdate
  222.               set gPrintHead to item gCurChap of gTitles & RETURN
  223.               if paper = "Times" then
  224.                 put "The Times" & RETURN after gPrintHead
  225.               else
  226.                 if paper = "Sunday Times" then
  227.                   put "Sunday Times" & RETURN after gPrintHead
  228.                 else
  229.                   if paper = "tls" then
  230.                     put "Times Literary Supplement" & RETURN after gPrintHead
  231.                   else
  232.                     put paper & RETURN after gPrintHead
  233.                   end if
  234.                 end if
  235.               end if
  236.               put tmpdate & RETURN after gPrintHead
  237.               set gArticlePage to 1
  238.               set art to gCurChap & "." & gCurArticle
  239.               set num to the number of items in gCurIndex
  240.               set index to -1
  241.               repeat with i = 2 to num
  242.                 set tmp to item i of gCurIndex
  243.                 set tmp2 to item i + 1 of gCurIndex
  244.                 if art = char 1 to 3 of tmp then
  245.                   set the itemDelimiter to ":"
  246.                   set index to value(item 2 of tmp)
  247.                   set nextindex to value(item 2 of tmp2)
  248.                   set the itemDelimiter to ","
  249.                   exit repeat
  250.                 end if
  251.               end repeat
  252.               if index <> -1 then
  253.                 if (nextindex <> EMPTY) and (nextindex <> 0) then
  254.                   if index > 0 then
  255.                     set gCurCutting to char index to nextindex of gFullCuttings
  256.                   else
  257.                     set gCurCutting to char 1 to nextindex of gFullCuttings
  258.                   end if
  259.                 else
  260.                   if index > 0 then
  261.                     set gCurCutting to char index to the number of chars in gFullCuttings of gFullCuttings
  262.                   else
  263.                     set gCurCutting to char 1 to the number of chars in gFullCuttings of gFullCuttings
  264.                   end if
  265.                 end if
  266.                 delete line 1 to 2 of gCurCutting
  267.                 if gWorld = "Discover" then
  268.                   set gFormattedText to FillText(gCurCutting, "Times", 18, 400)
  269.                 else
  270.                   set gFormattedText to FillText(gCurCutting, "Times", 18, 440)
  271.                 end if
  272.                 delete line the number of lines in gFormattedText of gFormattedText
  273.                 set the text of field "cutting" to line 1 to gMaxLines of gFormattedText
  274.                 set the textHeight of field "cutting" to 21
  275.                 set tmplines to the number of lines in gFormattedText
  276.                 set gTextPages to tmplines / gMaxLines
  277.                 if (gTextPages * gMaxLines) < tmplines then
  278.                   set gTextPages to gTextPages + 1
  279.                 end if
  280.               end if
  281.               if gTextPages = 1 then
  282.                 set the visible of sprite forwardbutton to 0
  283.               else
  284.                 set the visible of sprite forwardbutton to 1
  285.               end if
  286.               set the visible of sprite backbutton to 0
  287.               if gWorld = "Power" then
  288.                 set centerpoint to 277
  289.               else
  290.                 if gWorld = "Design" then
  291.                   set centerpoint to 295
  292.                 else
  293.                   if gWorld = "Senses" then
  294.                     set centerpoint to 295
  295.                   else
  296.                     if gWorld = "Mind" then
  297.                       set centerpoint to 282
  298.                     else
  299.                       if gWorld = "Body" then
  300.                         set centerpoint to 275
  301.                       else
  302.                         if gWorld = "Discover" then
  303.                           set centerpoint to 267
  304.                         end if
  305.                       end if
  306.                     end if
  307.                   end if
  308.                 end if
  309.               end if
  310.               set caph to the height of cast "caption"
  311.               set the locV of sprite captionsprite to centerpoint - (caph / 2)
  312.               set the locH of sprite cuttingsprite to cuttingloch
  313.               set the locH of sprite titlesprite to titleloch
  314.               set the locH of sprite datesprite to dateloch
  315.               set the locH of sprite papersprite to gPaperLoch
  316.               set the locH of sprite captionsprite to captionloch
  317.               if gWorld = "Senses" then
  318.                 set the locH of sprite namesprite to 95
  319.                 set the locV of sprite namesprite to 25
  320.               else
  321.                 if gWorld = "Design" then
  322.                   set the castNum of sprite namesprite to the number of cast (gMakerNum & ".name2")
  323.                   set the locH of sprite namesprite to 92
  324.                   set the locV of sprite namesprite to 48
  325.                 end if
  326.               end if
  327.               updateStage()
  328.               cursor(0)
  329.             else
  330.               if (type = "partwork") or (type = "Partwork") then
  331.                 if gCurChap = 1 then
  332.                   if gWorld = "senses" then
  333.                     set gMaxLines to 20
  334.                   else
  335.                     if gWorld = "mind" then
  336.                       set gMaxLines to 17
  337.                     else
  338.                       if gWorld = "body" then
  339.                         set gMaxLines to 17
  340.                       else
  341.                         if gWorld = "discover" then
  342.                           set gMaxLines to 15
  343.                         else
  344.                           set gMaxLines to 15
  345.                         end if
  346.                       end if
  347.                     end if
  348.                   end if
  349.                 else
  350.                   if gWorld = "senses" then
  351.                     set gMaxLines to 11
  352.                   else
  353.                     if gWorld = "mind" then
  354.                       set gMaxLines to 8
  355.                     else
  356.                       if gWorld = "discover" then
  357.                         set gMaxLines to 8
  358.                       else
  359.                         if gWorld = "design" then
  360.                           set gMaxLines to 7
  361.                         else
  362.                           if gWorld = "power" then
  363.                             set gMaxLines to 9
  364.                           else
  365.                             if gWorld = "body" then
  366.                               set gMaxLines to 11
  367.                             else
  368.                               set gMaxLines to 15
  369.                             end if
  370.                           end if
  371.                         end if
  372.                       end if
  373.                     end if
  374.                   end if
  375.                 end if
  376.                 set the locH of sprite headsprite to headloch
  377.                 set the locH of sprite picsprite to 1000
  378.                 puppetSprite(papersprite, 0)
  379.                 set the text of field "caption-partwork" to " "
  380.                 if gWorld = "senses" then
  381.                   set the textHeight of field "caption-partwork" to 25
  382.                 else
  383.                   set the textHeight of field "caption-partwork" to 18
  384.                 end if
  385.                 set the text of field "partwork" to " "
  386.                 set the text of field "partwork2" to " "
  387.                 set the textSize of field "partwork" to 14
  388.                 set the textSize of field "partwork2" to 14
  389.                 unpuppet("4,10")
  390.                 if gCurChap > 1 then
  391.                   if gMakerNum = 119 then
  392.                     go("innerpartwork.MAT")
  393.                   else
  394.                     go("innerpartwork")
  395.                   end if
  396.                   puppetSprite(picsprite, 1)
  397.                   set the locH of sprite picsprite to 1000
  398.                 else
  399.                   if gWorld = "Power" then
  400.                     go("partwork")
  401.                     puppetSprite(picsprite, 1)
  402.                     set the locH of sprite picsprite to 1000
  403.                   else
  404.                     if gMakerNum = 119 then
  405.                       go("partwork2.MAT")
  406.                     else
  407.                       go("partwork2")
  408.                     end if
  409.                   end if
  410.                 end if
  411.                 CleanMem()
  412.                 puppetSprite(cuttingsprite, 1)
  413.                 set cuttingloch to the locH of sprite cuttingsprite
  414.                 set the locH of sprite cuttingsprite to 1000
  415.                 puppetSprite(captionsprite, 1)
  416.                 set captionloch to the locH of sprite captionsprite
  417.                 set the locH of sprite captionsprite to 1000
  418.                 updateStage()
  419.                 if (gWorld = "Senses") or (gWorld = "Design") then
  420.                   set the locH of sprite namesprite to gNameLoch
  421.                   set the locV of sprite namesprite to gNameLocv
  422.                 end if
  423.                 set gArticlePage to 1
  424.                 set tmpcap to GetCaption()
  425.                 set the text of field "caption-partwork" to tmpcap
  426.                 set num to the number of items in gCurIndex
  427.                 set index to -1
  428.                 set art to gCurChap & "." & gCurArticle
  429.                 repeat with i = 2 to num
  430.                   set tmp to item i of gCurIndex
  431.                   set tmp2 to item i + 1 of gCurIndex
  432.                   if (art = char 1 to 3 of tmp) or ((gCurChap = 1) and (char 1 of tmp = "1")) then
  433.                     set the itemDelimiter to ":"
  434.                     set index to value(item 2 of tmp)
  435.                     set nextindex to value(item 2 of tmp2)
  436.                     set the itemDelimiter to ","
  437.                     exit repeat
  438.                   end if
  439.                 end repeat
  440.                 put "index = " && index && "nextindex = " && nextindex
  441.                 if index <> -1 then
  442.                   if (nextindex <> EMPTY) and (nextindex <> 0) then
  443.                     if index > 0 then
  444.                       set gCurCutting to char index to nextindex of gFullCuttings
  445.                     else
  446.                       set gCurCutting to char 1 to nextindex of gFullCuttings
  447.                     end if
  448.                   else
  449.                     if index > 0 then
  450.                       set gCurCutting to char index to the number of chars in gFullCuttings of gFullCuttings
  451.                     else
  452.                       set gCurCutting to char 1 to the number of chars in gFullCuttings of gFullCuttings
  453.                     end if
  454.                   end if
  455.                   if index = 0 then
  456.                     delete line 1 of gCurCutting
  457.                   else
  458.                     delete line 1 to 2 of gCurCutting
  459.                   end if
  460.                   if gWorld = "senses" then
  461.                     set cuttingwidth to 360
  462.                   else
  463.                     if gWorld = "discover" then
  464.                       set cuttingwidth to 440
  465.                     else
  466.                       if gWorld = "body" then
  467.                         set cuttingwidth to 440
  468.                       else
  469.                         set cuttingwidth to 440
  470.                       end if
  471.                     end if
  472.                   end if
  473.                   if (gWorld = "Power") and (gCurChap = 1) then
  474.                     set gFormattedText to FillText(gCurCutting, "Geneva", 14, 170)
  475.                     delete line the number of lines in gFormattedText of gFormattedText
  476.                     set the text of field "partwork" to line 1 to gMaxLines of gFormattedText
  477.                     set the textHeight of field "partwork" to 20
  478.                     set the textHeight of field "partwork2" to 20
  479.                     set gFormattedText to line 1 to gMaxLines of gFormattedText
  480.                     set tmpnum to the number of words in gFormattedText
  481.                     delete word 1 to tmpnum of gCurCutting
  482.                     set tmptext to FillText(gCurCutting, "Geneva", 14, cuttingwidth)
  483.                     put RETURN & tmptext after gFormattedText
  484.                     delete line the number of lines in gFormattedText of gFormattedText
  485.                     set tmplines to the number of lines in gFormattedText
  486.                     set tmpchar to the number of chars in gFormattedText
  487.                     if char tmpchar of gFormattedText = RETURN then
  488.                       put "." into char tmpchar of gFormattedText
  489.                     else
  490.                       put "." into char tmpchar + 1 of gFormattedText
  491.                     end if
  492.                   else
  493.                     set gFormattedText to FillText(gCurCutting, "Geneva", 14, cuttingwidth)
  494.                     delete line the number of lines in gFormattedText of gFormattedText
  495.                     set tmplines to the number of lines in gFormattedText
  496.                     set tmpchar to the number of chars in gFormattedText
  497.                     if char tmpchar of gFormattedText = RETURN then
  498.                       put "." into char tmpchar of gFormattedText
  499.                     else
  500.                       put "." into char tmpchar + 1 of gFormattedText
  501.                     end if
  502.                     set the text of field "partwork2" to " "
  503.                     set the textHeight of field "partwork2" to 20
  504.                     set the text of field "partwork2" to line 1 to gMaxLines of gFormattedText
  505.                   end if
  506.                   set gTextPages to tmplines / gMaxLines
  507.                   if (gTextPages * gMaxLines) < tmplines then
  508.                     set gTextPages to gTextPages + 1
  509.                   end if
  510.                   if gTextPages = 1 then
  511.                     set the visible of sprite forwardbutton to 0
  512.                   else
  513.                     set the visible of sprite forwardbutton to 1
  514.                   end if
  515.                 end if
  516.                 set the visible of sprite backbutton to 0
  517.                 updateStage()
  518.                 if gCurChap > 1 then
  519.                   set piccast to the number of cast (gMakerNum & "-" & gCurChap & "." & gCurArticle)
  520.                   put gMakerNum & "-" & gCurChap & "." & gCurArticle
  521.                   if piccast > 0 then
  522.                     set the stretch of sprite picsprite to 0
  523.                     set the castNum of sprite picsprite to piccast
  524.                     set w to 1.0 * the width of cast piccast / 2
  525.                     set h to 1.0 * the height of cast piccast / 2
  526.                     if gWorld = "senses" then
  527.                       set the locH of sprite picsprite to 210 + w
  528.                       set the locV of sprite picsprite to 50 + h
  529.                     else
  530.                       if gWorld = "Design" then
  531.                         set the locH of sprite picsprite to 125 + w
  532.                         set the locV of sprite picsprite to 132 + h
  533.                       else
  534.                         if gWorld = "power" then
  535.                           set the locH of sprite picsprite to 223 + w
  536.                           set the locV of sprite picsprite to 48 + h
  537.                         else
  538.                           if gWorld = "Mind" then
  539.                             set the locH of sprite picsprite to 38 + w
  540.                             set the locV of sprite picsprite to 132 + h
  541.                           else
  542.                             if gWorld = "body" then
  543.                               set the locH of sprite picsprite to 140 + w
  544.                               set the locV of sprite picsprite to 95 + h
  545.                             else
  546.                               set the locH of sprite picsprite to 70 + w
  547.                               set the locV of sprite picsprite to 70 + h
  548.                             end if
  549.                           end if
  550.                         end if
  551.                       end if
  552.                     end if
  553.                   end if
  554.                 else
  555.                   if gWorld = "Power" then
  556.                     puppetTempo(2)
  557.                     if label(gMakerNum & ".map") then
  558.                       go(gMakerNum & ".map")
  559.                     end if
  560.                     set gSeenMaps to 1
  561.                   end if
  562.                 end if
  563.                 set the locH of sprite cuttingsprite to cuttingloch
  564.                 puppetSprite(cuttingsprite, 0)
  565.                 set the locH of sprite captionsprite to cuttingloch
  566.                 puppetSprite(captionsprite, 0)
  567.               end if
  568.             end if
  569.           end if
  570.         end if
  571.       end if
  572.     end if
  573.   end if
  574.   NavButtonUpdate()
  575.   EndTrapMouse()
  576. end
  577.  
  578. on CheckPrint
  579.   global gPrintHead, gCurCutting, gMakerNum
  580. end
  581.