home *** CD-ROM | disk | FTP | other *** search
/ Organic Chemistry (8th Edition) / Image.iso / pc / data1.cab / Program_Files / PC_IR_Tutor / INTERP07 / 00002.ls next >
Encoding:
Text File  |  2003-05-14  |  5.1 KB  |  224 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 7 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 7 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 7 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 < 26) or (posH > 624) then
  128.     exit
  129.   end if
  130.   if expRegion = 0 then
  131.     set prefix to EMPTY
  132.     if posH < 224 then
  133.       set waveNum to 4000 - ((posH - 26) * 2000 / 199)
  134.     else
  135.       set waveNum to 2000 - ((posH - 224) * 1600 / 400)
  136.     end if
  137.   else
  138.     set prefix to "Exp1 "
  139.     set waveNum to 3200 - ((posH - 44) * 600 / 571)
  140.   end if
  141.   if (waveNum < 3500) and (waveNum > 3090) then
  142.     go(prefix & "OH Str")
  143.   end if
  144.   if (waveNum < 2998) and (waveNum > 2964) then
  145.     go(prefix & "CH3 Anti Str")
  146.   end if
  147.   if (waveNum < 2964) and (waveNum > 2909) then
  148.     go(prefix & "CH2 Anti Str")
  149.   end if
  150.   if (waveNum < 2909) and (waveNum > 2888) then
  151.     go(prefix & "CH3 Sym Str")
  152.   end if
  153.   if (waveNum < 2888) and (waveNum > 2843) then
  154.     go(prefix & "CH2 Sym Str")
  155.   end if
  156.   if (waveNum < 1476) and (waveNum > 1456) then
  157.     go(prefix & "CH3 Asym Bend")
  158.   end if
  159.   if (waveNum < 1456) and (waveNum > 1445) then
  160.     go(prefix & "CH2 Scis")
  161.   end if
  162.   if (waveNum < 1445) and (waveNum > 1392) then
  163.     go(prefix & "OH Bend")
  164.   end if
  165.   if (waveNum < 1382) and (waveNum > 1356) then
  166.     go(prefix & "CH3 Umbr")
  167.   end if
  168.   if (waveNum < 1356) and (waveNum > 1090) then
  169.     go(prefix & "Finger")
  170.   end if
  171.   if (waveNum < 1090) and (waveNum > 1010) then
  172.     go(prefix & "C-O Str")
  173.   end if
  174.   if (waveNum < 1010) and (waveNum > 840) then
  175.     go(prefix & "Finger")
  176.   end if
  177.   if (waveNum < 840) and (waveNum > 740) then
  178.     go(prefix & "OH Twist")
  179.   end if
  180.   if (waveNum < 740) and (waveNum > 720) then
  181.     go(prefix & "CH2 Wag")
  182.   end if
  183.   if (waveNum < 720) and (waveNum > 550) then
  184.     go(prefix & "OH Twist")
  185.   end if
  186.   if (waveNum < 550) and (waveNum > 400) then
  187.     go(prefix & "Finger")
  188.   end if
  189. end
  190.  
  191. on doOverlay whichCast
  192.   global expRegion, useKeys
  193.   if useKeys < 3 then
  194.     exit
  195.   end if
  196.   set dummy to whichCast + expRegion
  197.   if (whichCast = 0) or (the castNum of sprite 8 = dummy) then
  198.     set the castNum of sprite 8 to 0
  199.   else
  200.     set the castNum of sprite 8 to whichCast + expRegion
  201.   end if
  202.   puppetTransition(1, 2, 10, 0)
  203. end
  204.  
  205. on setUseKeys theCode
  206.   global useKeys
  207.   set useKeys to theCode
  208. end
  209.  
  210. on dontLeave
  211.   global auxframePos, useKeys, auxoldUseKeys
  212.   set useKeys to auxoldUseKeys
  213.   go(auxframePos)
  214. end
  215.  
  216. on doLeave
  217.   global frameName, movieName
  218.   when keyDown then nothing
  219.   set the puppet of sprite 8 to 0
  220.   installMenu(0)
  221.   updateStage()
  222.   go(frameName, movieName)
  223. end
  224.