home *** CD-ROM | disk | FTP | other *** search
/ Fischer's Erotic Encyclopedia / Eros.mdf / SHARED.DXR / 02101_RunTimeScripts.ls next >
Encoding:
Text File  |  1996-11-11  |  16.1 KB  |  656 lines

  1. on startMovie
  2.   CustomCursor()
  3. end
  4.  
  5. on initGlobals
  6.   global section, subsect, page, hotColor, transitionFlag, voiceOnFlag, voicePlaying, VoxTimer, special, linkReturn, thePal
  7.   setUpColour()
  8.   setUpFilePathDelimiter()
  9.   set hotColor to 4
  10.   set section to "Temple"
  11.   set subsect to 0
  12.   set page to 0
  13.   set transitionFlag to 0
  14.   set voiceOnFlag to 1
  15.   set voicePlaying to 0
  16.   set VoxTimer to 0
  17.   set special to 0
  18.   set linkReturn to []
  19.   set thePal to 1001
  20. end
  21.  
  22. on setUpColour
  23.   global PriorMonitorDepth
  24.   set PriorMonitorDepth to the colorDepth
  25.   if the machineType = 256 then
  26.     if the colorDepth <> 8 then
  27.       alert("Fischer's Erotic Encyclopedia requires that the number of colors be set to 256 colors. Refer to your Windows documentation to change the number of colors.")
  28.       quit()
  29.     end if
  30.   else
  31.     if the colorDepth <> 8 then
  32.       set the colorDepth to 8
  33.     end if
  34.   end if
  35. end
  36.  
  37. on setUpFilePathDelimiter
  38.   global filePathDelimiter
  39.   if the machineType = 256 then
  40.     set filePathDelimiter to "\"
  41.   else
  42.     set filePathDelimiter to ":"
  43.   end if
  44. end
  45.  
  46. on CustomCursor alt
  47.   global colorcrsr, gFakeWin
  48.   if (the machineType = 256) or gFakeWin then
  49.     if not alt then
  50.       cursor([the number of cast "Cursor icon", the number of cast "Cursor icon Mask"])
  51.     else
  52.       cursor([the number of cast "Cursor noMask"])
  53.     end if
  54.   else
  55.     if not objectp(colorcrsr) then
  56.       openXLib(the pathName & "ColourCursor-XObj")
  57.       set colorcrsr to ColorCursor(mnew)
  58.     end if
  59.     colorcrsr(mGetSetCursor, 9003)
  60.   end if
  61. end
  62.  
  63. on UnCustomCursor
  64.   global colorcrsr, gFakeWin
  65.   if (the machineType = 256) or gFakeWin then
  66.     cursor(0)
  67.   else
  68.     if objectp(colorcrsr) then
  69.       colorcrsr(mReleaseCursor)
  70.       colorcrsr(mdispose)
  71.     end if
  72.     cursor(0)
  73.   end if
  74. end
  75.  
  76. on doHotLink
  77.   global section, subsect, page, linkReturn
  78.   set linkReturn to list(section, subsect, page)
  79.   set parseMe to word 2 of line page of field subsect
  80.   set section to char 1 of parseMe
  81.   set subsect to value(char 3 of parseMe)
  82.   set page to value(char 5 to 7 of parseMe)
  83.   sound stop 1
  84.   fadeMusicOutSlow()
  85.   sound stop 2
  86.   repeat with s = 13 to 18
  87.     set the visible of sprite s to 0
  88.   end repeat
  89.   go(the frame + 1)
  90.   go(1, section & "section")
  91. end
  92.  
  93. on doHotLinkReturn
  94.   global section, subsect, page, linkReturn
  95.   set section to getAt(linkReturn, 1)
  96.   set subsect to getAt(linkReturn, 2)
  97.   set page to getAt(linkReturn, 3)
  98.   sound stop 1
  99.   fadeMusicOutSlow()
  100.   sound stop 2
  101.   repeat with s = 13 to 18
  102.     set the visible of sprite s to 0
  103.   end repeat
  104.   set the visible of sprite 27 to 0
  105.   puppetSprite(27, 0)
  106.   set linkReturn to []
  107.   go(the frame + 1)
  108.   go(1, section & "section")
  109. end
  110.  
  111. on HandleRollover destCast, theScript
  112.   set scrCast to the castNum of sprite the clickOn
  113.   set the castNum of sprite the clickOn to the number of cast destCast
  114.   set isFlashed to 1
  115.   updateStage()
  116.   repeat while the mouseDown
  117.     if isFlashed and not rollOver(the clickOn) then
  118.       set isFlashed to 0
  119.       set the castNum of sprite the clickOn to scrCast
  120.     end if
  121.     if not isFlashed and rollOver(the clickOn) then
  122.       set isFlashed to 1
  123.       set the castNum of sprite the clickOn to the number of cast destCast
  124.     end if
  125.     updateStage()
  126.   end repeat
  127.   set the castNum of sprite the clickOn to scrCast
  128.   updateStage()
  129.   if isFlashed then
  130.     do(theScript)
  131.   end if
  132. end
  133.  
  134. on PrevSectKlikt
  135.   global subsect, page
  136.   if subsect > 0 then
  137.     set subsect to subsect - 1
  138.   end if
  139.   set page to 0
  140.   sound stop 1
  141.   fadeMusicOutSlow()
  142.   sound stop 2
  143.   goPage()
  144. end
  145.  
  146. on PrevPageKlikt
  147.   global page
  148.   if page > 0 then
  149.     set page to page - 1
  150.   end if
  151.   sound stop 1
  152.   goPage()
  153. end
  154.  
  155. on NextPageKlikt
  156.   global page, subsect
  157.   if page < the number of lines in field subsect then
  158.     set page to page + 1
  159.   end if
  160.   sound stop 1
  161.   goPage()
  162. end
  163.  
  164. on NextSectKlikt
  165.   global subsect, page, linkReturn, gNumSubSections
  166.   if subsect < gNumSubSections then
  167.     set subsect to subsect + 1
  168.   end if
  169.   set linkReturn to []
  170.   set page to 0
  171.   sound stop 1
  172.   fadeMusicOutSlow()
  173.   sound stop 2
  174.   goPage()
  175. end
  176.  
  177. on MoonKlikt
  178.   global subsect, page, linkReturn
  179.   set linkReturn to []
  180.   set subsect to 0
  181.   set page to 0
  182.   sound stop 1
  183.   fadeMusicOutSlow()
  184.   sound stop 2
  185.   goPage()
  186. end
  187.  
  188. on TempleKlikt
  189.   global section, subsect, page.linkReturn
  190.   set linkReturn to []
  191.   set section to "Temple"
  192.   set subsect to "0"
  193.   set page to "0"
  194.   sound stop 1
  195.   fadeMusicOutSlow()
  196.   sound stop 2
  197.   repeat with s = 13 to 18
  198.     set the visible of sprite s to 0
  199.   end repeat
  200.   go(the frame + 1)
  201.   go("Buttons", "Temple")
  202. end
  203.  
  204. on i_buttonKlikt
  205.   global section, subsect, page, linkReturn
  206.   set linkReturn to []
  207.   sound stop 1
  208.   fadeMusicOutSlow()
  209.   sound stop 2
  210.   repeat with s = 13 to 18
  211.     set the visible of sprite s to 0
  212.   end repeat
  213.   go(the frame + 1)
  214.   go("Menu", "Temple")
  215. end
  216.  
  217. on q_buttonKlikt
  218.   global section, subsect, page, linkReturn
  219.   set linkReturn to []
  220.   set section to "Temple"
  221.   set subsect to "0"
  222.   set page to "0"
  223.   sound stop 1
  224.   fadeMusicOutSlow()
  225.   sound stop 2
  226.   repeat with s = 13 to 18
  227.     set the visible of sprite s to 0
  228.   end repeat
  229.   go(the frame + 1)
  230.   go("Credits", "Temple")
  231. end
  232.  
  233. on subButton1Klikt
  234.   global subsect, page
  235.   set subsect to 1
  236.   set page to 0
  237.   goPage()
  238. end
  239.  
  240. on subButton2Klikt
  241.   global subsect, page
  242.   set subsect to 2
  243.   set page to 0
  244.   goPage()
  245. end
  246.  
  247. on subButton3Klikt
  248.   global subsect, page
  249.   set subsect to 3
  250.   set page to 0
  251.   goPage()
  252. end
  253.  
  254. on subButton4Klikt
  255.   global subsect, page
  256.   set subsect to 4
  257.   set page to 0
  258.   goPage()
  259. end
  260.  
  261. on subButton5Klikt
  262.   global subsect, page
  263.   set subsect to 5
  264.   set page to 0
  265.   goPage()
  266. end
  267.  
  268. on subButton6Klikt
  269.   global subsect, page
  270.   set subsect to 6
  271.   set page to 0
  272.   goPage()
  273. end
  274.  
  275. on subButton7Klikt
  276.   global subsect, page
  277.   set subsect to 7
  278.   set page to 0
  279.   goPage()
  280. end
  281.  
  282. on subButton8Klikt
  283.   global subsect, page
  284.   set subsect to 8
  285.   set page to 0
  286.   goPage()
  287. end
  288.  
  289. on subButton9Klikt
  290.   global subsect, page
  291.   set subsect to 9
  292.   set page to 0
  293.   goPage()
  294. end
  295.  
  296. on setUpBannersAndTitlePuppets
  297.   global gNumSubSections
  298.   set endVal to gNumSubSections + 2
  299.   repeat with X = 1 to endVal
  300.     puppetSprite(X, 1)
  301.   end repeat
  302. end
  303.  
  304. on setUpBannersAndTitleContent
  305.   global subsect, gNumSubSections
  306.   set bannerTitleBaseNum to 60 + (subsect * 2)
  307.   set the castNum of sprite 1 to bannerTitleBaseNum - 1
  308.   puppetSprite(2, 0)
  309.   puppetSprite(2, 1)
  310.   set the castNum of sprite 2 to bannerTitleBaseNum
  311.   set endVal to gNumSubSections + 2
  312.   repeat with X = 3 to endVal
  313.     set the castNum of sprite X to 90 + (X - 2)
  314.     set the visible of sprite X to 0
  315.   end repeat
  316. end
  317.  
  318. on goPage
  319.   global subsect, page, voiceOnFlag
  320.   if subsect > 0 then
  321.     if the puppet of sprite 1 = 0 then
  322.       setUpBannersAndTitlePuppets()
  323.     end if
  324.     if page > 0 then
  325.       doPageStuff()
  326.     else
  327.       doTitlePageStuff()
  328.     end if
  329.   else
  330.     doSectMenuPageStuff()
  331.   end if
  332.   if (page > 0) and (voiceOnFlag = 1) then
  333.     doSound()
  334.   end if
  335. end
  336.  
  337. on QTFix thePicName
  338.   global gQTFix, gLastQT, gFakeWin
  339.   if (the machineType < 256) and not gFakeWin then
  340.     exit
  341.   end if
  342.   if gLastQT = thePicName then
  343.     exit
  344.   end if
  345.   if thePicName contains ".mov" then
  346.     set gLastQT to thePicName
  347.     set puppetList to []
  348.     repeat with I = 1 to 48
  349.       setAt(puppetList, I, the puppet of sprite I)
  350.     end repeat
  351.     set VisibleList to []
  352.     repeat with I = 1 to 48
  353.       setAt(VisibleList, I, the visible of sprite I)
  354.     end repeat
  355.     set SpriteList to []
  356.     repeat with I = 1 to 48
  357.       setAt(SpriteList, I, the castNum of sprite I)
  358.     end repeat
  359.     setAt(puppetList, 13, 0)
  360.     set myFrame to the frame
  361.     set myMovie to the movieName
  362.     set gQTFix to 1
  363.     set the castNum of sprite 13 to 23
  364.     set the puppet of sprite 31 to 1
  365.     set the locH of sprite 31 to 320
  366.     updateStage()
  367.     go(myFrame, myMovie)
  368.     set gQTFix to 0
  369.     repeat with I = 1 to 48
  370.       if getAt(puppetList, I) then
  371.         set the puppet of sprite I to 1
  372.         set the castNum of sprite I to getAt(SpriteList, I)
  373.       end if
  374.       set the visible of sprite I to getAt(VisibleList, I)
  375.     end repeat
  376.     set the puppet of sprite 13 to 1
  377.     set the stretch of sprite 13 to 0
  378.     set the puppet of sprite 31 to 1
  379.     set the locH of sprite 31 to 1000
  380.     CustomCursor()
  381.   end if
  382. end
  383.  
  384. on doPageStuff
  385.   global subsect, page, special, transitionFlag, thePal, section, gOldSubSection
  386.   set oldPal to thePal
  387.   set theText to (subsect * 100) + page
  388.   set thePicName to word 4 to the number of words in line page of field subsect of line page of field subsect
  389.   set thePic to the number of cast thePicName
  390.   if thePic = -1 then
  391.     alert("NO picture found for page " & page)
  392.     set thePic to 1002
  393.   end if
  394.   QTFix(thePicName)
  395.   set thePal to the palette of cast thePic
  396.   if thePal = 0 then
  397.     set thePal to thePic - 1
  398.   end if
  399.   puppetPalette(0)
  400.   puppetPalette(oldPal)
  401.   if special = 0 then
  402.     if line 1 of field the castNum of sprite 15 <> line 1 of field theText then
  403.       set the castNum of sprite 15 to the number of cast "TextBox"
  404.     end if
  405.     if the name of cast the castNum of sprite 13 <> thePicName then
  406.       set the visible of sprite 13 to 0
  407.       set the castNum of sprite 16 to the number of cast "BlankBox"
  408.     end if
  409.   else
  410.     if special = 1 then
  411.       if line 1 of field the castNum of sprite 17 <> line 1 of field theText then
  412.         set the castNum of sprite 17 to the number of cast "AltTextBox"
  413.       end if
  414.       if the name of cast the castNum of sprite 14 <> thePicName then
  415.         set the visible of sprite 14 to 0
  416.         set the castNum of sprite 18 to the number of cast "BlankBox"
  417.       end if
  418.     else
  419.       alert("Bad special flag = " & special)
  420.     end if
  421.   end if
  422.   updateStage()
  423.   if gOldSubSection = 0 then
  424.     setUpBannersAndTitleContent()
  425.     set the visible of sprite 12 to 0
  426.   end if
  427.   go("1")
  428.   puppetPalette(thePal)
  429.   set special to word 3 of line page of field subsect
  430.   if special = 0 then
  431.     set the castNum of sprite 15 to theText
  432.     set the textHeight of field theText to 16
  433.     set the castNum of sprite 13 to thePic
  434.     put line page of field (subsect + 10) into field "CreditsBox"
  435.     set the foreColor of cast "CreditsBox" to 24
  436.     set the textSize of cast "CreditsBox" to 9
  437.     set the textStyle of cast "CreditsBox" to "Italic"
  438.     set the castNum of sprite 16 to the number of cast "CreditsBox"
  439.     set the visible of sprite 13 to 1
  440.     set the visible of sprite 15 to 1
  441.     set the visible of sprite 16 to 1
  442.     set the visible of sprite 14 to 0
  443.     set the visible of sprite 17 to 0
  444.     set the visible of sprite 18 to 0
  445.   else
  446.     set the castNum of sprite 17 to theText
  447.     set the textHeight of field theText to 16
  448.     set the castNum of sprite 14 to thePic
  449.     put line page of field (subsect + 10) into field "AltCreditsBox"
  450.     set the foreColor of cast "AltCreditsBox" to 24
  451.     set the textSize of cast "AltCreditsBox" to 9
  452.     set the textStyle of cast "AltCreditsBox" to "Italic"
  453.     set the castNum of sprite 18 to the number of cast "AltCreditsBox"
  454.     set the visible of sprite 13 to 0
  455.     set the visible of sprite 15 to 0
  456.     set the visible of sprite 16 to 0
  457.     set the visible of sprite 14 to 1
  458.     set the visible of sprite 17 to 1
  459.     set the visible of sprite 18 to 1
  460.   end if
  461.   doTitleState()
  462.   doButtonState()
  463.   updateStage()
  464.   if subsect <> gOldSubSection then
  465.     fadeMusicOutSlow()
  466.     sound stop 2
  467.     set the volume of sound 2 to 255
  468.     sound playFile 2, the pathName & section & ":MUSIC:" & the name of cast (2000 + subsect)
  469.     set gOldSubSection to subsect
  470.   end if
  471. end
  472.  
  473. on doTitlePageStuff
  474.   global subsect, thePal, section, gOldSubSection
  475.   fadeMusicOutSlow()
  476.   set oldPal to thePal
  477.   set thePic to (subsect * 2) + 1000
  478.   QTFix(the name of cast thePic)
  479.   set thePal to thePic - 1
  480.   puppetPalette(0)
  481.   puppetPalette(oldPal)
  482.   set the castNum of sprite 15 to the number of cast "TextBox"
  483.   set the castNum of sprite 13 to the number of cast "PictBlank"
  484.   set the castNum of sprite 14 to the number of cast "AltPictBlank"
  485.   set the visible of sprite 13 to 0
  486.   set the visible of sprite 14 to 0
  487.   set the castNum of sprite 16 to the number of cast "BlankBox"
  488.   updateStage()
  489.   setUpBannersAndTitleContent()
  490.   go("1")
  491.   puppetPalette(thePal)
  492.   set the volume of sound 2 to 255
  493.   set the castNum of sprite 13 to thePic
  494.   set the visible of sprite 13 to 1
  495.   set the visible of sprite 15 to 1
  496.   set the visible of sprite 14 to 0
  497.   set the visible of sprite 16 to 0
  498.   set the visible of sprite 17 to 0
  499.   set the visible of sprite 18 to 0
  500.   doTitleState()
  501.   doButtonState()
  502.   if subsect <> gOldSubSection then
  503.     sound stop 2
  504.     sound playFile 2, the pathName & section & ":MUSIC:" & the name of cast (2000 + subsect)
  505.     set gOldSubSection to subsect
  506.   end if
  507. end
  508.  
  509. on doSectMenuPageStuff
  510.   global subsect, transitionFlag, thePal, gOldSubSection, gNumSubSections
  511.   set oldPal to thePal
  512.   set thePic to 1000
  513.   QTFix(the name of cast thePic)
  514.   set thePal to 59
  515.   if transitionFlag = 1 then
  516.     puppetTransition(50, 2, 8, 1)
  517.   end if
  518.   puppetPalette(0)
  519.   puppetPalette(oldPal)
  520.   set the castNum of sprite 15 to the number of cast "TextBox"
  521.   set the castNum of sprite 13 to the number of cast "PictBlank"
  522.   set the castNum of sprite 16 to the number of cast "BlankBox"
  523.   set endVal to gNumSubSections + 2
  524.   repeat with X = 1 to endVal
  525.     puppetSprite(X, 0)
  526.   end repeat
  527.   set the volume of sound 2 to 255
  528.   go(string(subsect))
  529.   puppetPalette(thePal)
  530.   set the castNum of sprite 13 to thePic
  531.   repeat with s = 14 to 18
  532.     set the visible of sprite s to 0
  533.   end repeat
  534.   set the visible of sprite 13 to 1
  535.   repeat with X = 1 to endVal
  536.     set the visible of sprite X to 1
  537.   end repeat
  538.   doTitleState()
  539.   doButtonState()
  540.   if transitionFlag = 1 then
  541.     puppetTransition(50, 2, 8, 1)
  542.   end if
  543.   set gOldSubSection to 0
  544. end
  545.  
  546. on doTitleState
  547.   global subsect, page
  548.   if page > 0 then
  549.     set the visible of sprite 2 to 0
  550.   else
  551.     set the visible of sprite 2 to 1
  552.   end if
  553.   set currentSubSectionTitleSprite to subsect + 2
  554.   if (subsect > 0) and (page > 0) then
  555.     set the visible of sprite currentSubSectionTitleSprite to 0
  556.     set the visible of sprite 12 to 0
  557.   else
  558.     set the visible of sprite currentSubSectionTitleSprite to 1
  559.     set the visible of sprite 12 to 1
  560.   end if
  561.   if subsect = 0 then
  562.     set the visible of sprite 2 to 0
  563.   end if
  564. end
  565.  
  566. on doButtonState
  567.   global section, subsect, page, linkReturn, gNumSubSections
  568.   if subsect = 0 then
  569.     repeat with SpriteNum = 19 to 23
  570.       set the visible of sprite SpriteNum to 0
  571.     end repeat
  572.   else
  573.     if subsect < gNumSubSections then
  574.       set the visible of sprite 19 to 1
  575.       set the visible of sprite 22 to 1
  576.       set the visible of sprite 23 to 1
  577.     else
  578.       set the visible of sprite 19 to 1
  579.       set the visible of sprite 22 to 0
  580.       set the visible of sprite 23 to 1
  581.     end if
  582.   end if
  583.   if subsect > 0 then
  584.     if page > 0 then
  585.       set the visible of sprite 20 to 1
  586.     else
  587.       set the visible of sprite 20 to 0
  588.     end if
  589.     if page < the number of lines in field subsect then
  590.       set the visible of sprite 21 to 1
  591.     else
  592.       set the visible of sprite 21 to 0
  593.     end if
  594.   end if
  595.   if count(linkReturn) = 0 then
  596.     set the visible of sprite 27 to 0
  597.   else
  598.     set the visible of sprite 27 to 1
  599.   end if
  600. end
  601.  
  602. on doSound
  603.   global section, subsect, page, voicePlaying, VoxTimer
  604.   set locPage to page
  605.   if locPage < 10 then
  606.     put "0" before locPage
  607.   end if
  608.   set theSound to section & "." & subsect & "." & locPage
  609.   if the number of cast theSound > 0 then
  610.     puppetSound(theSound)
  611.     set VoxTimer to the ticks
  612.     fadeMusicDown()
  613.     set voicePlaying to 1
  614.   end if
  615. end
  616.  
  617. on fadeMusicDown
  618.   set newVolume to the volume of sound 2
  619.   repeat while newVolume > 84
  620.     set newVolume to newVolume - 4
  621.     set the volume of sound 2 to newVolume
  622.     delay(1)
  623.     updateStage()
  624.   end repeat
  625. end
  626.  
  627. on fadeMusicOut
  628.   set newVolume to the volume of sound 2
  629.   repeat while newVolume > 0
  630.     set newVolume to newVolume - 6
  631.     set the volume of sound 2 to newVolume
  632.     delay(1)
  633.     updateStage()
  634.   end repeat
  635. end
  636.  
  637. on fadeMusicOutSlow
  638.   set newVolume to the volume of sound 2
  639.   repeat while newVolume > 0
  640.     set newVolume to newVolume - 4
  641.     set the volume of sound 2 to newVolume
  642.     delay(1)
  643.     updateStage()
  644.   end repeat
  645. end
  646.  
  647. on fadeMusicUp
  648.   set newVolume to the volume of sound 2
  649.   repeat while newVolume < 255
  650.     set newVolume to newVolume + 1
  651.     set the volume of sound 2 to newVolume
  652.     delay(1)
  653.     updateStage()
  654.   end repeat
  655. end
  656.