home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / resource / earshot / eardemo.dir / 00179.ls < prev    next >
Encoding:
Text File  |  1996-05-17  |  8.2 KB  |  248 lines

  1. global gNullCastNum, gLHiliteList, gRHiliteList, gLeftGoToList, gRightGoToList, gPictInAStringL, gPictInAStringR, gLastRollover, gLastPiePiece, printer, gPropFont, gMonoFont, gXObjFile
  2.  
  3. on startMovie
  4.   set the centerStage to 1
  5.   setGlobals()
  6.   if the machineType = 256 then
  7.     set gPropFont to "arial"
  8.     set gMonoFont to "courier new"
  9.     set gXObjFile to "pmatic.dll"
  10.   else
  11.     set gPropFont to "helvetica"
  12.     set gMonoFont to "courier"
  13.     set gXObjFile to "pmatic.xobj"
  14.   end if
  15.   if not objectp(printer) then
  16.     openXLib(gXObjFile)
  17.     set printer to PrintOMatic(mnew)
  18.   end if
  19.   if not objectp(printer) then
  20.     alert("There is no printer currently selected. Printing features are disabled.")
  21.   else
  22.   end if
  23. end
  24.  
  25. on stopMovie
  26.   PupsOff()
  27.   if objectp(printer) then
  28.     printer(mdispose)
  29.   end if
  30.   closeXLib(gXObjFile)
  31. end
  32.  
  33. on setGlobals
  34.   set gPictInAStringL to the text of cast "Left Mask Text"
  35.   set gPictInAStringR to the text of cast "Right Mask Text"
  36.   set gLHiliteList to []
  37.   set gRHiliteList to []
  38.   repeat with x = 1 to 18
  39.     add(gLHiliteList, the number of cast ("Left Hilite" && string(x)))
  40.     add(gRHiliteList, the number of cast ("Right Hilite" && string(x)))
  41.   end repeat
  42.   add(gLHiliteList, the number of cast "Null Hilite")
  43.   add(gRHiliteList, the number of cast "Null Hilite")
  44.   set gNullCastNum to the number of cast "Null Hilite"
  45.   set gLeftGoToList to ["Phones", "Sci-Fi", "Human", "Swishes", "Industrial", "Vehicles", "Water", "Weather", "Whooshes", "Textures", "Household", "Squeaks", "Impacts", "Switches", "Liquids", "Media", "Monsters", "Office", "RightChoice"]
  46.   set gRightGoToList to ["Creaks", "Comedy", "Crowds", "Computers", "Doors", "Electrics", "Animals", "Fire", "Explosions", "Bells", "Alarms", "Ambience", "Beeps", "Arcade", "Guns", "Camera", "Buttons", "Gore", "LeftChoice"]
  47.   set gLastPiePiece to 0
  48. end
  49.  
  50. on GrayMatterPrint
  51.   global printer
  52.   if not objectp(printer) then
  53.     alert("There is no printer currently selected. Printing features are disabled.")
  54.   else
  55.     cursor(4)
  56.     printer(mReset)
  57.     set m to (printer(mGetPaperWidth) - 330) / 2
  58.     printer(mSetMargins, m, 48, 48, 48)
  59.     printer(mNewPage)
  60.     printer(mPicture, the picture of cast "Logo", 0, 12, 330, 70)
  61.     printer(mTextBox, 0, 48, 330, 70, 0)
  62.     printer(mSetTextJust, "center")
  63.     AppendStyledText(printer, the number of cast "header", 0)
  64.     printer(mSetTextJust, "left")
  65.     printer(mTextBox, 0, 70, printer(mGetPageWidth), 220, 0)
  66.     AppendStyledText(printer, the number of cast "name&address", 0)
  67.     printer(mTextBox, 0, 220, printer(mGetPageWidth), 450, 0)
  68.     AppendStyledText(printer, the number of cast "productCol", 0)
  69.     set r to rect(212, 220, 322, 450)
  70.     set vLine to the left of r + 60
  71.     set hLine to the top of r + 34
  72.     set leading to 15
  73.     printer(mTextBox, the left of r, the top of r, printer(mGetPageWidth), the bottom of r + 10, 0)
  74.     AppendStyledText(printer, the number of cast "priceCol", 0)
  75.     printer(mTextBox, vLine + 5, the top of r, printer(mGetPageWidth), the bottom of r + 10, 0)
  76.     AppendStyledText(printer, the number of cast "quantityCol", 0)
  77.     printer(mLine, vLine, the top of r, vLine, the bottom of r)
  78.     repeat with cnt = 1 to the number of lines in field "productCol" - 2
  79.       printer(mLine, the left of r, hLine, the right of r, hLine)
  80.       set hLine to hLine + leading
  81.     end repeat
  82.     TotalField(rect(242, 450, 322, 470), "subtotalField", 1)
  83.     TotalField(rect(242, 473, 322, 493), "taxField", 1)
  84.     set the top of r to 500
  85.     set the bottom of r to 560
  86.     set hLine to the top of r + 30
  87.     set leading to 15
  88.     printer(mTextBox, the left of r - 60, the top of r, the right of r, the bottom of r + 20, 0)
  89.     AppendStyledText(printer, the number of cast "shipCol1", 0)
  90.     printer(mTextBox, the left of r, the top of r, the right of r, the bottom of r + 10, 0)
  91.     AppendStyledText(printer, the number of cast "shipCol2", 0)
  92.     printer(mTextBox, vLine + 5, the top of r, printer(mGetPageWidth), the bottom of r + 10, 0)
  93.     AppendStyledText(printer, the number of cast "shipCol3", 0)
  94.     printer(mLine, vLine, the top of r, vLine, the bottom of r)
  95.     repeat with cnt = 1 to the number of lines in field "shipCol2" - 2
  96.       printer(mLine, the left of r, hLine, the right of r, hLine)
  97.       set hLine to hLine + leading
  98.     end repeat
  99.     printer(mTextBox, 0, 460, the left of r - 70, 622, 0)
  100.     AppendStyledText(printer, the number of cast "instructions", 0)
  101.     TotalField(rect(242, 580, 322, 600), "shippingField", 1)
  102.     TotalField(rect(242, 603, 322, 623), "totalField", 2)
  103.     printer(mTextBox, 0, 632, the right of r, printer(mgetpageheight), 0)
  104.     printer(mSetTextJust, "center")
  105.     AppendStyledText(printer, the number of cast "footer", 0)
  106.     if printer(mDoJobSetup) = 1 then
  107.       updateStage()
  108.       printer(mPrint)
  109.     end if
  110.     cursor(-1)
  111.   end if
  112. end
  113.  
  114. on TotalField r, txtCast, wt
  115.   global printer
  116.   printer(mSetPenSize, wt, wt)
  117.   printer(mStrokedRoundRect, the left of r, the top of r, the right of r, the bottom of r, (the bottom of r - the top of r) / 2)
  118.   printer(mSetTextFont, the textFont of char 1 of cast txtCast)
  119.   printer(mSetTextSize, the textSize of char 1 of cast txtCast)
  120.   printer(mSetTextStyle, the textStyle of char 1 of cast txtCast)
  121.   printer(mSetTextJust, "right")
  122.   printer(mDrawText, the text of field txtCast, the left of r - 6, the bottom of r - 5)
  123.   printer(mSetTextJust, "left")
  124. end
  125.  
  126. on initText
  127.   set gLastRollover to 48
  128.   repeat with channel = 10 to 14
  129.     puppetSprite(channel, 1)
  130.   end repeat
  131. end
  132.  
  133. on PupsOff
  134.   puppetSound(0)
  135.   repeat with channel = 10 to 21
  136.     puppetSprite(channel, 0)
  137.   end repeat
  138.   updateStage()
  139. end
  140.  
  141. on checkRoll
  142.   repeat with spriteCounter = 10 to 14
  143.     set gLastRollover to 48
  144.     if rollOver(spriteCounter) and (spriteCounter <> gLastRollover) then
  145.       set gLastRollover to spriteCounter
  146.       puppetSound(0)
  147.       if not soundBusy(1) then
  148.         set theSound to "word" & spriteCounter
  149.         puppetSound(theSound)
  150.       end if
  151.       set the castNum of sprite spriteCounter to the number of cast (spriteCounter & "hi")
  152.       updateStage()
  153.       repeat while rollOver(spriteCounter) and the mouseUp
  154.       end repeat
  155.       set the castNum of sprite spriteCounter to the number of cast (gLastRollover & "or")
  156.       updateStage()
  157.     end if
  158.   end repeat
  159. end
  160.  
  161. on LeftSide
  162.   set whichOne to FindColorOfPixelUnderCursorL()
  163.   if whichOne <> gLastPiePiece then
  164.     if whichOne = 0 then
  165.       set the castNum of sprite 2 to gNullCastNum
  166.     else
  167.       if whichOne = 19 then
  168.         set the castNum of sprite 2 to gNullCastNum
  169.         updateStage()
  170.         go(getAt(gLeftGoToList, whichOne))
  171.       else
  172.         puppetSound("click1.aif")
  173.         set the castNum of sprite 2 to getAt(gLHiliteList, whichOne)
  174.         set gLastPiePiece to whichOne
  175.         updateStage()
  176.       end if
  177.     end if
  178.   end if
  179. end
  180.  
  181. on RightSide
  182.   set whichOne to FindColorOfPixelUnderCursorR()
  183.   if whichOne <> gLastPiePiece then
  184.     if whichOne = 0 then
  185.       set the castNum of sprite 2 to gNullCastNum
  186.     else
  187.       if whichOne = 19 then
  188.         set the castNum of sprite 2 to gNullCastNum
  189.         updateStage()
  190.         go(getAt(gRightGoToList, whichOne))
  191.       else
  192.         puppetSound("click1.aif")
  193.         set the castNum of sprite 2 to getAt(gRHiliteList, whichOne)
  194.         set gLastPiePiece to whichOne
  195.         updateStage()
  196.       end if
  197.     end if
  198.   end if
  199. end
  200.  
  201. on LaunchLeftChoice
  202.   set whichOne to FindColorOfPixelUnderCursorL()
  203.   if whichOne = 0 then
  204.     exit
  205.   else
  206.     if whichOne <> 19 then
  207.       set the loc of sprite 2 to point(-1000, -1000)
  208.     end if
  209.     go(getAt(gLeftGoToList, whichOne))
  210.   end if
  211. end
  212.  
  213. on LauchRightChoice
  214.   set whichOne to FindColorOfPixelUnderCursorR()
  215.   if whichOne = 0 then
  216.     exit
  217.   else
  218.     if whichOne <> 19 then
  219.       set the loc of sprite 2 to point(-1000, -1000)
  220.     end if
  221.     go(getAt(gRightGoToList, whichOne))
  222.   end if
  223. end
  224.  
  225. on initRollOvers
  226.   puppetSprite(2, 1)
  227. end
  228.  
  229. on LoadRawPictIntoString
  230.   if objectp(myObj) then
  231.     myObj(mdispose)
  232.   end if
  233. end
  234.  
  235. on FindColorOfPixelUnderCursorL
  236.   set x to the mouseH / 4
  237.   set y to the mouseV / 4
  238.   set locOfPixelInString to (y * 160) + x + 1
  239.   return charToNum(char locOfPixelInString of gPictInAStringL)
  240. end
  241.  
  242. on FindColorOfPixelUnderCursorR
  243.   set x to the mouseH / 4
  244.   set y to the mouseV / 4
  245.   set locOfPixelInString to (y * 160) + x + 1
  246.   return charToNum(char locOfPixelInString of gPictInAStringR)
  247. end
  248.