home *** CD-ROM | disk | FTP | other *** search
/ GameStar 1998 November (Bonus) / GAMESTAR11B.ISO / ENCYC99 / MM / T012919A.DCR / 00067_ccTrackerMaker.ls < prev    next >
Encoding:
Text File  |  1998-06-09  |  1.5 KB  |  63 lines

  1. property soundPlaying, currentList, currentListCount, currentIndex, timeZero, theEndTime
  2. global ccInfo, ccTrue, soundDurations
  3.  
  4. on new me
  5.   set soundPlaying to 0
  6.   set the soundEnabled to 0
  7.   return me
  8. end
  9.  
  10. on ccOn me, xFrameSound
  11.   if ccTrue then
  12.     set timeZero to the ticks
  13.     set currentList to getProp(ccInfo, xFrameSound)
  14.     set currentListCount to count(currentList)
  15.     set theEndTime to timeZero + getProp(soundDurations, xFrameSound)
  16.     set currentIndex to 1
  17.     set soundPlaying to 1
  18.   end if
  19. end
  20.  
  21. on ccOff me
  22.   set soundPlaying to 0
  23. end
  24.  
  25. on ccCheck me
  26.   if ccTrue then
  27.     if soundPlaying then
  28.       set ticksPassed to the ticks - timeZero
  29.       if ticksPassed > getPropAt(currentList, currentIndex) then
  30.         set currentText to getAt(currentList, currentIndex)
  31.         set currentIndex to currentIndex + 1
  32.         if currentIndex > currentListCount then
  33.           ccOff(me)
  34.         end if
  35.         displayCC(me, currentText)
  36.       end if
  37.     end if
  38.   end if
  39. end
  40.  
  41. on displayCC me, xInt
  42.   set theString to line xInt - 1 of field "ccTextField"
  43.   repeat while theString = EMPTY
  44.     preloadMember("ccTextField")
  45.     set theString to line xInt - 1 of field "ccTextField"
  46.   end repeat
  47.   set theNarrator to word 1 of theString
  48.   delete word 1 of theString
  49.   externalEvent("caption:[" & theNarrator & "][" & theString & "]")
  50. end
  51.  
  52. on checkSoundBusy me
  53.   if ccTrue then
  54.     if the frameSound1 = 0 then
  55.       return 0
  56.     else
  57.       return the ticks < theEndTime
  58.     end if
  59.   else
  60.     return 0
  61.   end if
  62. end
  63.