home *** CD-ROM | disk | FTP | other *** search
/ Organic Chemistry (8th Edition) / Image.iso / pc / data1.cab / Program_Files / PC_IR_Tutor / INTERP02 / 00002.ls next >
Encoding:
Text File  |  2003-05-14  |  4.4 KB  |  199 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 2 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.       go("Leave")
  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, 0)
  100.   installMenu(4)
  101.   set the checkMark of menuItem 2 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, 0)
  116.   installMenu(3)
  117.   set the checkMark of menuItem 2 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.       set prefix to "Exp2 "
  143.       set waveNum to 1700 - ((posH - 44) * 700 / 570)
  144.     end if
  145.   end if
  146.   if (waveNum < 2990) and (waveNum > 2905) then
  147.     go(prefix & "CH3 Anti Str")
  148.   end if
  149.   if (waveNum < 2906) and (waveNum > 2813) then
  150.     go(prefix & "CH3 Sym Str")
  151.   end if
  152.   if (waveNum < 1469) and (waveNum > 1450) then
  153.     go(prefix & "CH3 Asym Bend")
  154.   end if
  155.   if (waveNum < 1388) and (waveNum > 1373) then
  156.     go(prefix & "CH3 UmbrA")
  157.   end if
  158.   if (waveNum < 1374) and (waveNum > 1356) then
  159.     go(prefix & "CH3 UmbrS")
  160.   end if
  161.   if (waveNum < 1326) and (waveNum > 828) then
  162.     go(prefix & "Finger")
  163.   end if
  164. end
  165.  
  166. on doOverlay whichCast
  167.   global expRegion, useKeys
  168.   if useKeys < 3 then
  169.     exit
  170.   end if
  171.   set dummy to whichCast + expRegion
  172.   if (whichCast = 0) or (the castNum of sprite 8 = dummy) then
  173.     set the castNum of sprite 8 to 0
  174.   else
  175.     set the castNum of sprite 8 to whichCast + expRegion
  176.   end if
  177.   puppetTransition(1, 2, 10, 0)
  178. end
  179.  
  180. on setUseKeys theCode
  181.   global useKeys
  182.   set useKeys to theCode
  183. end
  184.  
  185. on dontLeave
  186.   global auxframePos, useKeys, auxoldUseKeys
  187.   set useKeys to auxoldUseKeys
  188.   go(auxframePos)
  189. end
  190.  
  191. on doLeave
  192.   global frameName, movieName
  193.   when keyDown then nothing
  194.   set the puppet of sprite 8 to 0
  195.   installMenu(0)
  196.   updateStage()
  197.   go(frameName, movieName)
  198. end
  199.