home *** CD-ROM | disk | FTP | other *** search
/ Organic Chemistry (8th Edition) / Image.iso / pc / data1.cab / Program_Files / PC_IR_Tutor / INTERP03 / 00002.ls next >
Encoding:
Text File  |  2003-05-14  |  6.3 KB  |  270 lines

  1. on InitMenu
  2.   global leftArrow, rightArrow, retnKey, useKeys, expRegion
  3.   set leftArrow to 123
  4.   set rightArrow to 124
  5.   set retnKey to 36
  6.   installMenu(3)
  7.   set the checkMark of menuItem 3 of menu "Spectra" to 1
  8.   set the puppet of sprite 8 to 1
  9.   set the castNum of sprite 8 to 0
  10.   set the foreColor of sprite 8 to 243
  11.   set expRegion to 0
  12.   when keyDown then checkKey
  13. end
  14.  
  15. on checkKey
  16.   global leftArrow, rightArrow, retnKey, useKeys
  17.   if useKeys = 1 then
  18.     if the keyCode = retnKey then
  19.       doLeave()
  20.     else
  21.       exit
  22.       dontPassEvent()
  23.     end if
  24.   end if
  25.   if useKeys = 2 then
  26.     if the keyCode = retnKey then
  27.       when keyDown then nothing
  28.       set the puppet of sprite 8 to 0
  29.       installMenu(0)
  30.       quit()
  31.     else
  32.       exit
  33.       dontPassEvent()
  34.     end if
  35.   end if
  36.   if (the keyCode = leftArrow) and (useKeys <> 3) then
  37.     go(marker(-1))
  38.   else
  39.     if (the keyCode = rightArrow) and (useKeys <> 4) then
  40.       go(marker(1))
  41.     end if
  42.   end if
  43.   dontPassEvent()
  44. end
  45.  
  46. on checkButton
  47.   global useKeys
  48.   set posH to the mouseH
  49.   set posV to the mouseV
  50.   if (posV > 465) or (posV < 440) or (posH > 605) or (posH < 262) then
  51.     exit
  52.   end if
  53.   if (posH > 579) and (useKeys <> 4) then
  54.     go(marker(1))
  55.   end if
  56.   if (posH > 534) and (posH < 560) and (useKeys <> 3) then
  57.     go(marker(-1))
  58.   end if
  59.   if (posH > 459) and (posH < 500) then
  60.     doExit(0, "Quit")
  61.     exit
  62.   end if
  63.   if (posH > 384) and (posH < 425) then
  64.     doExit(0, "Help")
  65.     exit
  66.   end if
  67.   if posH < 350 then
  68.     doExit(1, "MainProg")
  69.     exit
  70.   end if
  71. end
  72.  
  73. on doExit whichFrame, whichMovie
  74.   global auxframePos, frameName, movieName, useKeys, auxoldUseKeys, expRegion
  75.   if useKeys < 3 then
  76.     exit
  77.   end if
  78.   set auxframePos to the frame
  79.   set auxoldUseKeys to useKeys
  80.   if whichFrame = 0 then
  81.     go(whichMovie & expRegion)
  82.     exit
  83.   else
  84.     go(1, whichMovie)
  85.   end if
  86. end
  87.  
  88. on doExpand whichOne
  89.   global framePos, useKeys, oldUseKeys, expRegion
  90.   if useKeys < 3 then
  91.     exit
  92.   end if
  93.   if the castNum of sprite 8 <> 0 then
  94.     set the castNum of sprite 8 to the castNum of sprite 8 + whichOne
  95.   end if
  96.   set expRegion to whichOne
  97.   set framePos to the frame
  98.   set oldUseKeys to useKeys
  99.   puppetTransition(5, 2, 10, 1)
  100.   installMenu(4)
  101.   set the checkMark of menuItem 3 of menu "Spectra" to 1
  102.   go("Exp" & expRegion)
  103. end
  104.  
  105. on doContract
  106.   global framePos, useKeys, oldUseKeys, expRegion
  107.   if useKeys < 3 then
  108.     exit
  109.   end if
  110.   if the castNum of sprite 5 <> 0 then
  111.     set the castNum of sprite 8 to the castNum of sprite 8 - expRegion
  112.   end if
  113.   set expRegion to 0
  114.   set useKeys to oldUseKeys
  115.   puppetTransition(6, 2, 10, 1)
  116.   installMenu(3)
  117.   set the checkMark of menuItem 3 of menu "Spectra" to 1
  118.   go(framePos)
  119. end
  120.  
  121. on doPeakClick
  122.   global expRegion, useKeys
  123.   set posH to the mouseH
  124.   if useKeys < 3 then
  125.     exit
  126.   end if
  127.   if (posH < 29) or (posH > 629) then
  128.     exit
  129.   end if
  130.   if expRegion = 0 then
  131.     set prefix to EMPTY
  132.     if posH < 221 then
  133.       set waveNum to 4000 - ((posH - 29) * 2000 / 192)
  134.     else
  135.       set waveNum to 2000 - ((posH - 221) * 1600 / 408)
  136.     end if
  137.   else
  138.     if expRegion = 1 then
  139.       set prefix to "Exp1 "
  140.       set waveNum to 3200 - ((posH - 44) * 600 / 571)
  141.     else
  142.       if expRegion = 2 then
  143.         set prefix to "Exp2 "
  144.         set waveNum to 1700 - ((posH - 44) * 700 / 570)
  145.       end if
  146.     end if
  147.   end if
  148.   if expRegion = 0 then
  149.     if (waveNum < 3063) and (waveNum > 3011) then
  150.       go("Vinyl Anti Str")
  151.     end if
  152.     if (waveNum < 2990) and (waveNum > 2917) then
  153.       go("Vinyl Sym Str")
  154.     end if
  155.     if (waveNum < 2917) and (waveNum > 2896) then
  156.       go("CH3 Anti Str")
  157.     end if
  158.     if (waveNum < 2896) and (waveNum > 2855) then
  159.       go("CH2 Anti Str")
  160.     end if
  161.     if (waveNum < 2855) and (waveNum > 2813) then
  162.       go("CH3 Sym Str")
  163.     end if
  164.     if (waveNum < 2813) and (waveNum > 2761) then
  165.       go("CH2 Sym Str")
  166.     end if
  167.     if (waveNum < 1836) and (waveNum > 1800) then
  168.       go("Overtone")
  169.     end if
  170.     if (waveNum < 1655) and (waveNum > 1628) then
  171.       go("CC Str")
  172.     end if
  173.     if (waveNum < 1455) and (waveNum > 1436) then
  174.       go("CH3 Asym Bend")
  175.     end if
  176.     if (waveNum < 1436) and (waveNum > 1416) then
  177.       go("CH2 Scis")
  178.     end if
  179.     if (waveNum < 1393) and (waveNum > 1357) then
  180.       go("CH3 Umbr")
  181.     end if
  182.     if (waveNum < 1357) and (waveNum > 1012) then
  183.       go("Finger")
  184.     end if
  185.     if (waveNum < 1012) and (waveNum > 969) then
  186.       go("OOP CC Bend A")
  187.     end if
  188.     if (waveNum < 942) and (waveNum > 875) then
  189.       go("OOP CC Bend B")
  190.     end if
  191.     if (waveNum < 875) and (waveNum > 400) then
  192.       go("Finger")
  193.     end if
  194.     exit
  195.   else
  196.     if expRegion = 1 then
  197.       if (waveNum < 3084) and (waveNum > 3059) then
  198.         go("Exp1 Vinyl Anti Str")
  199.       end if
  200.       if (waveNum < 3006) and (waveNum > 2986) then
  201.         go("Exp1 Vinyl Sym Str")
  202.       end if
  203.       if (waveNum < 2968) and (waveNum > 2951) then
  204.         go("Exp1 CH3 Anti Str")
  205.       end if
  206.       if (waveNum < 2938) and (waveNum > 2916) then
  207.         go("Exp1 CH2 Anti Str")
  208.       end if
  209.       if (waveNum < 2882) and (waveNum > 2871) then
  210.         go("Exp1 CH3 Sym Str")
  211.       end if
  212.       if (waveNum < 2871) and (waveNum > 2856) then
  213.         go("Exp1 CH2 Sym Str")
  214.       end if
  215.       exit
  216.     else
  217.       if (waveNum < 1637) and (waveNum > 1624) then
  218.         go("Exp2 CC Str")
  219.       end if
  220.       if (waveNum < 1473) and (waveNum > 1457) then
  221.         go("Exp2 CH3 Asym Bend")
  222.       end if
  223.       if (waveNum < 1457) and (waveNum > 1440) then
  224.         go("Exp2 CH2 Scis")
  225.       end if
  226.       if (waveNum < 1384) and (waveNum > 1370) then
  227.         go("Exp2 CH3 Umbr")
  228.       end if
  229.       if (waveNum < 1357) and (waveNum > 982) then
  230.         go("Exp2 Finger")
  231.       end if
  232.       exit
  233.     end if
  234.   end if
  235. end
  236.  
  237. on doOverlay whichCast
  238.   global expRegion, useKeys
  239.   if useKeys < 3 then
  240.     exit
  241.   end if
  242.   set dummy to whichCast + expRegion
  243.   if (whichCast = 0) or (the castNum of sprite 8 = dummy) then
  244.     set the castNum of sprite 8 to 0
  245.   else
  246.     set the castNum of sprite 8 to whichCast + expRegion
  247.   end if
  248.   puppetTransition(1, 2, 10, 0)
  249. end
  250.  
  251. on setUseKeys theCode
  252.   global useKeys
  253.   set useKeys to theCode
  254. end
  255.  
  256. on dontLeave
  257.   global auxframePos, useKeys, auxoldUseKeys
  258.   set useKeys to auxoldUseKeys
  259.   go(auxframePos)
  260. end
  261.  
  262. on doLeave
  263.   global frameName, movieName
  264.   when keyDown then nothing
  265.   set the puppet of sprite 8 to 0
  266.   installMenu(0)
  267.   updateStage()
  268.   go(frameName, movieName)
  269. end
  270.