home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 256 / DR_BRAIN.BIN / SHARED.DIR / 02000_Script_FatLips
Text File  |  1997-01-16  |  15KB  |  472 lines

  1. -- ChannelVoice(channel for mouth,  --> ##** ##00 Sprite to Center on / ** Channel for Mouth
  2. --               castname of Mouths, --> Ex: "Clown" would cause "AClown" to be the A Mouth Cast 
  3. --               sound castname,     --> This is the cast name of the Sound to sinc.
  4. --               speach string,      --> Use only lower case letters for the matching string
  5. --               sampling rate)      --> Enter 11 for 11mHz / 22 for 22mHz
  6. -- PuppetVoice(channel,castname,sound castname,speach string,sampling rate) ***See Above***
  7. -- VoiceUpKeep     ***Global Var: VoiceState 0=Quiet/1=Talking***
  8. -- VoicePreset(castname)
  9. -- NoVoice     (Which Channels 2=stop both channels)
  10. --             ***Call this to shut-up VoiceState2 and call from the StopMovie***
  11.  
  12. -- ChannelVoice2(channel,castname,sound castname,speach string,sampling rate) ***See Above***
  13. -- PuppetVoice2(channel,castname,sound castname,speach string,sampling rate) ***See Above***
  14. -- VoiceUpKeep2    ***Global Var: VoiceState2 0=Quiet/1=Talking***
  15. -- VoicePreset2(castname)
  16. -- NoVoice2    (Which Channels 2=stop both channels)
  17. --             ***Call this to shut-up VoiceState2 and call from the StopMovie***
  18.  
  19. -- ClearVoices     ***Call this in your StartMovie***
  20.  
  21. On ChannelVoice where,who,saywhat,what,sample
  22.   global voicestate,mouthoff,voicegraph,soundgraph,voicestring,voicelength,voicespot,voicestep
  23.   global oldtime,oldmouth,oldface,facespot,oldxface,oldyface,lastvoice
  24.   
  25.   if sample=11 then
  26.     set sample = 11025
  27.   end if
  28.   if sample=22 then
  29.     set sample = 22050
  30.   end if
  31.   set voicestate = 1
  32.   if lastvoice<>who then
  33.     set mouthindex = [2,8,6,11,3,10,6,11,2,5,6,9,8,6,4,8,7,6,6,11,5,10,7,3,6,6,1]
  34.     set stuffumouth = ["","A","E","O","U","C","W","M","L","F"]
  35.     set tempmouth = [0,0,0,0,0,0,0,0,0,0]
  36.     repeat with xxx = 1 to 10
  37.       set bbb = getat(stuffumouth,xxx)&who
  38.       set bee = the number of cast bbb
  39.       preloadcast(bee)
  40.       setat tempmouth,xxx,bee
  41.     end repeat
  42.     set voicegraph = []
  43.     repeat with xxx = 1 to 27
  44.       set aaa = getat(mouthindex,xxx)
  45.       if aaa = 11 then
  46.         set ccc = 0 
  47.       else
  48.         set ccc = getat(tempmouth,aaa)
  49.       end if
  50.       append voicegraph,ccc
  51.     end repeat
  52.     set lastvoice=who
  53.   end if
  54.   set soundgraph = the number of cast saywhat
  55.   set voicestring = what
  56.   set oldxface = -2000
  57.   set oldyface = -2000
  58.   set facespot = integer(where/100)
  59.   set voicespot = where-(facespot*100)
  60.   set ddd = getat(voicegraph,27)
  61.   if soundgraph = 0 or ddd = 0 then
  62.     set voicestate = 0
  63.     exit
  64.   end if
  65.   puppetsprite voicespot,1
  66.   set voicelength = THE SIZE OF CAST SOUNDGRAPH + .01
  67.   SET VOICEstep = float((VOICELENGTH*60)/SAMPLE)/float(LENGTH(WHAT))
  68.   set voicelength = float(voicelength/sample)*60.00001
  69.   set oldtime = mouthoff
  70.   set oldmouth = 20000
  71.   set oldface = ddd
  72.   set mouthoff = the timer
  73.   voiceupkeep
  74. End ChannelVoice
  75.  
  76. On PuppetVoice where,who,saywhat,what,sample
  77.   global voicestate,mouthoff,voicegraph,soundgraph,voicestring,voicelength,voicespot,voicestep
  78.   global oldtime,oldmouth,oldface,facespot,oldxface,oldyface,lastvoice,jellyjam
  79.   
  80.   if sample=11 then
  81.     set sample = 11025
  82.   end if
  83.   if sample=22 then
  84.     set sample = 22050
  85.   end if
  86.   set voicestate = 1
  87.   if lastvoice<>who or lastvoice=jellyjam then
  88.     set mouthindex = [2,8,6,11,3,10,6,11,2,5,6,9,8,6,4,8,7,6,6,11,5,10,7,3,6,6,1]
  89.     set stuffumouth = ["","A","E","O","U","C","W","M","L","F"]
  90.     set tempmouth = [0,0,0,0,0,0,0,0,0,0]
  91.     repeat with xxx = 1 to 10
  92.       set bbb = getat(stuffumouth,xxx)&who
  93.       set bee = the number of cast bbb
  94.       preloadcast(bee)
  95.       setat tempmouth,xxx,bee
  96.     end repeat
  97.     set voicegraph = []
  98.     repeat with xxx = 1 to 27
  99.       set aaa = getat(mouthindex,xxx)
  100.       if aaa = 11 then
  101.         set ccc = 0 
  102.       else
  103.         set ccc = getat(tempmouth,aaa)
  104.       end if
  105.       append voicegraph,ccc
  106.     end repeat
  107.     set lastvoice=who
  108.   end if
  109.   set soundgraph = the number of cast saywhat
  110.   set voicestring = what
  111.   set oldxface = -2000
  112.   set oldyface = -2000
  113.   set facespot = integer(where/100)
  114.   set voicespot = where-(facespot*100)
  115.   set ddd = getat(voicegraph,27)
  116.   if soundgraph = -1 or ddd = 0 then
  117.     set voicestate = 0
  118.     
  119.     exit
  120.   end if
  121.   puppetsprite voicespot,1
  122.   set voicelength = THE SIZE OF CAST SOUNDGRAPH + .01
  123.   SET VOICEstep = float((VOICELENGTH*60)/SAMPLE)/float(LENGTH(WHAT))
  124.   set voicelength = float(voicelength/sample)*60.00001
  125.   set oldtime = mouthoff
  126.   set oldmouth = 20000
  127.   set oldface = ddd
  128.   puppetsound saywhat
  129.   updatestage
  130.   --  if the machinetype = 256 then
  131.   --    set temp = the timer
  132.   --    repeat while the timer < (temp + 15) 
  133.   --      updatestage
  134.   --    end repeat
  135.   --  end if
  136.   set mouthoff = the timer
  137.   VoiceUpKeep
  138. End PuppetVoice
  139.  
  140. On VoiceUpKeep
  141.   global voicestate,mouthoff,voicegraph,soundgraph,voicestring,voicelength,voicespot,voicestep
  142.   global oldtime,oldmouth,oldface,facespot,oldxface,oldyface
  143.   
  144.   if voicestate = 1 then
  145.     if facespot > 0 then
  146.       set xxx = the loch of sprite facespot
  147.       set yyy = the locv of sprite facespot
  148.       if xxx <> oldxface or yyy <> oldyface then
  149.         set the loch of sprite voicespot = xxx
  150.         set the locv of sprite voicespot = yyy
  151.         set oldxface = xxx
  152.         set oldyface = yyy
  153.       end if
  154.     end if
  155.     set timefor = the timer
  156.     set ack = timefor - mouthoff
  157.     if ack < 0 then
  158.       set mouthoff = mouthoff - oldtime
  159.       set ack = timefor - mouthoff
  160.     end if
  161.     if ack > voicelength then
  162.       novoice
  163.       exit
  164.     end if
  165.     set oldtime = timefor
  166.     set pbsst = integer(ack / voicestep)+1
  167.     if pbsst = oldmouth then
  168.       exit
  169.     end if
  170.     set oldmouth = pbsst
  171.     set inchar = char pbsst of voicestring
  172.     set invalue = chartonum(inchar)
  173.     set newface = 0
  174.     if inchar = " " then
  175.       set newface = getat(voicegraph,27)
  176.     else
  177.       if invalue >64 and invalue < 91 then 
  178.         set newface = getat(voicegraph,(invalue-64))
  179.       else
  180.         if invalue > 96 and invalue < 124 then
  181.           set newface = getat(voicegraph,(invalue-96))
  182.         end if
  183.       end if
  184.     end if
  185.     if newface = 0 then
  186.       set pink = random(13)
  187.       if pink = 11 then
  188.         set newface = getat(voicegraph,3)
  189.       else
  190.         if pink > 11 then
  191.           set newface = getat(voicegraph,12)
  192.         else
  193.           set newface = getat(voicegraph,9)
  194.         end if
  195.       end if
  196.     end if
  197.     if newface = 0 or newface = oldface then
  198.       exit
  199.     end if
  200.     set the castnum of sprite voicespot = newface
  201.     set oldface = newface
  202.   end if
  203. End VoiceUpKeep
  204.  
  205. On ClearVoices
  206.   global lastvoice,lastvoice2
  207.   
  208.   set lastvoice = "Illbedamned"
  209.   set lastvoice2 = "Illbedamned"
  210.   
  211. End ClearVoices
  212.  
  213. On VoicePreset who
  214.   global lastvoice,voicegraph  
  215.   
  216.   if lastvoice<>who then
  217.     set mouthindex = [2,8,6,11,3,10,6,11,2,5,6,9,8,6,4,8,7,6,6,11,5,10,7,3,6,6,1]
  218.     set stuffumouth = ["","A","E","O","U","C","W","M","L","F"]
  219.     set tempmouth = [0,0,0,0,0,0,0,0,0,0]
  220.     repeat with xxx = 1 to 10
  221.       set bbb = getat(stuffumouth,xxx)&who
  222.       set bee = the number of cast bbb
  223.       preloadcast(bee)
  224.       setat tempmouth,xxx,bee
  225.     end repeat
  226.     set voicegraph = []
  227.     repeat with xxx = 1 to 27
  228.       set aaa = getat(mouthindex,xxx)
  229.       if aaa = 11 then
  230.         set ccc = 0 
  231.       else
  232.         set ccc = getat(tempmouth,aaa)
  233.       end if
  234.       append voicegraph,ccc
  235.     end repeat
  236.     set lastvoice=who
  237.   end if
  238. End VoicePreset
  239.  
  240. On NoVoice Channel
  241.   global voicestate,voicespot,voicegraph
  242.   
  243.   if voicestate > 0 then
  244.     set the castnum of sprite voicespot = getat(voicegraph,27)
  245.     set voicestate=0
  246.     if channel = 2 then
  247.       sound STOP 2
  248.     end if
  249.     
  250.     puppetsound 0
  251.     puppetsprite voicespot,0  
  252.   end if
  253.   puppetsprite voicespot,0  
  254.   
  255. End NoVoice
  256.  
  257. On ChannelVoice2 where2,who2,saywhat2,what2,sample2
  258.   global voicestate2,mouthoff2,voicegraph2,soundgraph2,voicestring2,voicelength2,voicespot2,voicestep2
  259.   global oldtime2,oldmouth2,oldface2,facespot2,oldxface2,oldyface2,lastvoice2
  260.   
  261.   if sample2=11 then
  262.     set sample2 = 11025
  263.   end if
  264.   if sample2=22 then
  265.     set sample2 = 22050
  266.   end if
  267.   set voicestate2 = 1
  268.   if lastvoice2<>who2 then
  269.     set mouthindex2 = [2,8,6,11,3,10,6,11,2,5,6,9,8,6,4,8,7,6,6,11,5,10,7,3,6,6,1]
  270.     set stuffumouth2 = ["","A","E","O","U","C","W","M","L","F"]
  271.     set tempmouth2 = [0,0,0,0,0,0,0,0,0,0]
  272.     repeat with xxx2 = 1 to 10
  273.       set bbb2 = getat(stuffumouth2,xxx2)&who2
  274.       set bee2 = the number of cast bbb2
  275.       preloadcast(bee2)
  276.       setat tempmouth2,xxx2,bee2
  277.     end repeat
  278.     set voicegraph2 = []
  279.     repeat with xxx2 = 1 to 27
  280.       set aaa2 = getat(mouthindex2,xxx2)
  281.       if aaa2 = 11 then
  282.         set ccc2 = 0 
  283.       else
  284.         set ccc2 = getat(tempmouth2,aaa2)
  285.       end if
  286.       append voicegraph2,ccc2
  287.     end repeat
  288.     set lastvoice2=who2
  289.   end if
  290.   set soundgraph2 = the number of cast saywhat2
  291.   set voicestring2 = what2
  292.   set oldxface2 = -2000
  293.   set oldyface2 = -2000
  294.   set facespot2 = integer(where2/100)
  295.   set voicespot2 = where2-(facespot2*100)
  296.   set ddd2 = getat(voicegraph2,27)
  297.   if soundgraph2 = 0 or ddd2 = 0 then
  298.     set voicestate2 = 0
  299.     exit
  300.   end if
  301.   puppetsprite voicespot2,1
  302.   set voicelength2 = THE SIZE OF CAST SOUNDGRAPH2 + .01
  303.   SET VOICEstep2 = float((VOICELENGTH2*60)/SAMPLE2)/float(LENGTH(WHAT2))
  304.   set voicelength2 = float(voicelength2/sample2)*60.00001
  305.   set oldtime2 = mouthoff2
  306.   set oldmouth2 = 20000
  307.   set oldface2 = ddd2
  308.   set mouthoff2 = the timer
  309.   voiceupkeep2
  310. End ChannelVoice2
  311.  
  312. On PuppetVoice2 where2,who2,saywhat2,what2,sample2
  313.   global voicestate2,mouthoff2,voicegraph2,soundgraph2,voicestring2,voicelength2,voicespot2,voicestep2
  314.   global oldtime2,oldmouth2,oldface2,facespot2,oldxface2,oldyface2,lastvoice2
  315.   
  316.   if sample2=11 then
  317.     set sample2 = 11025
  318.   end if
  319.   if sample2=22 then
  320.     set sample2 = 22050
  321.   end if
  322.   set voicestate2 = 1
  323.   if lastvoice2<>who2 then
  324.     set mouthindex2 = [2,8,6,11,3,10,6,11,2,5,6,9,8,6,4,8,7,6,6,11,5,10,7,3,6,6,1]
  325.     set stuffumouth2 = ["","A","E","O","U","C","W","M","L","F"]
  326.     set tempmouth2 = [0,0,0,0,0,0,0,0,0,0]
  327.     repeat with xxx2 = 1 to 10
  328.       set bbb2 = getat(stuffumouth2,xxx2)&who2
  329.       set bee2 = the number of cast bbb2
  330.       preloadcast(bee2)
  331.       setat tempmouth2,xxx2,bee2
  332.     end repeat
  333.     set voicegraph2 = []
  334.     repeat with xxx2 = 1 to 27
  335.       set aaa2 = getat(mouthindex2,xxx2)
  336.       if aaa2 = 11 then
  337.         set ccc2 = 0 
  338.       else
  339.         set ccc2 = getat(tempmouth2,aaa2)
  340.       end if
  341.       append voicegraph2,ccc2
  342.     end repeat
  343.     set lastvoice2=who2
  344.   end if
  345.   set soundgraph2 = the number of cast saywhat2
  346.   set voicestring2 = what2
  347.   set oldxface2 = -2000
  348.   set oldyface2 = -2000
  349.   set facespot2 = integer(where2/100)
  350.   set voicespot2 = where2-(facespot2*100)
  351.   set ddd2 = getat(voicegraph2,27)
  352.   if soundgraph2 = 0 or ddd2 = 0 then
  353.     novoice2
  354.     exit
  355.   end if
  356.   puppetsprite voicespot2,1
  357.   set voicelength2 = THE SIZE OF CAST SOUNDGRAPH2 + .01
  358.   SET VOICEstep2 = float((VOICELENGTH2*60)/SAMPLE2)/float(LENGTH(WHAT2))
  359.   set voicelength2 = float(voicelength2/sample2)*60.00001
  360.   set oldtime2 = mouthoff2
  361.   set oldmouth2 = 20000
  362.   set oldface2 = ddd2
  363.   puppetsound saywhat2
  364.   set mouthoff2 = the timer
  365.   VoiceUpKeep2
  366. End PuppetVoice2
  367.  
  368. On VoiceUpKeep2
  369.   global voicestate2,mouthoff2,voicegraph2,soundgraph2,voicestring2,voicelength2,voicespot2,voicestep2
  370.   global oldtime2,oldmouth2,oldface2,facespot2,oldxface2,oldyface2
  371.   
  372.   if voicestate2 = 1 then
  373.     if facespot2 > 0 then
  374.       set xxx2 = the loch of sprite facespot2
  375.       set yyy2 = the locv of sprite facespot2
  376.       if xxx2 <> oldxface2 or yyy2 <> oldyface2 then
  377.         set the loch of sprite voicespot2 = xxx2
  378.         set the locv of sprite voicespot2 = yyy2
  379.         set oldxface2 = xxx2
  380.         set oldyface2 = yyy2
  381.       end if
  382.     end if
  383.     set timefor2 = the timer
  384.     set ack2 = timefor2 - mouthoff2
  385.     if ack2 < 0 then
  386.       set mouthoff2 = mouthoff2 - oldtime2
  387.       set ack2 = timefor2 - mouthoff2
  388.     end if
  389.     if ack2 > voicelength2 then
  390.       novoice2
  391.       exit
  392.     end if
  393.     set oldtime2 = timefor2
  394.     set pbsst2 = integer(ack2 / voicestep2)+1
  395.     if pbsst2 = oldmouth2 then
  396.       exit
  397.     end if
  398.     set oldmouth2 = pbsst2
  399.     set inchar2 = char pbsst2 of voicestring2
  400.     set invalue2 = chartonum(inchar2)
  401.     set newface2 = 0
  402.     if inchar2 = " " then
  403.       set newface2 = getat(voicegraph2,27)
  404.     else
  405.       if invalue2 >64 and invalue2 < 91 then 
  406.         set newface2 = getat(voicegraph2,(invalue2-64))
  407.       else
  408.         if invalue2 > 96 and invalue2 < 124 then
  409.           set newface2 = getat(voicegraph2,(invalue2-96))
  410.         end if
  411.       end if
  412.     end if
  413.     if newface2 = 0 then
  414.       set pink2 = random(13)
  415.       if pink2 = 11 then
  416.         set newface2 = getat(voicegraph2,3)
  417.       else
  418.         if pink2 > 11 then
  419.           set newface2 = getat(voicegraph2,12)
  420.         else
  421.           set newface2 = getat(voicegraph2,9)
  422.         end if
  423.       end if
  424.     end if
  425.     if newface2 = 0 or newface2 = oldface2 then
  426.       exit
  427.     end if
  428.     set the castnum of sprite voicespot2 = newface2
  429.     set oldface2 = newface2
  430.   end if
  431. End VoiceUpKeep2
  432.  
  433. On VoicePreset2 who2
  434.   global lastvoice2,voicegraph2 
  435.   
  436.   if lastvoice2<>who2 then
  437.     set mouthindex2 = [2,8,6,11,3,10,6,11,2,5,6,9,8,6,4,8,7,6,6,11,5,10,7,3,6,6,1]
  438.     set stuffumouth2 = ["","A","E","O","U","C","W","M","L","F"]
  439.     set tempmouth2 = [0,0,0,0,0,0,0,0,0,0]
  440.     repeat with xxx2 = 1 to 10
  441.       set bbb2 = getat(stuffumouth2,xxx2)&who2
  442.       set bee2 = the number of cast bbb2
  443.       preloadcast(bee2)
  444.       setat tempmouth2,xxx2,bee2
  445.     end repeat
  446.     set voicegraph2 = []
  447.     repeat with xxx2 = 1 to 27
  448.       set aaa2 = getat(mouthindex2,xxx2)
  449.       if aaa2 = 11 then
  450.         set ccc2 = 0 
  451.       else
  452.         set ccc2 = getat(tempmouth2,aaa2)
  453.       end if
  454.       append voicegraph2,ccc2
  455.     end repeat
  456.     set lastvoice2=who2
  457.   end if
  458. End VoicePreset2
  459.  
  460. On NoVoice2 Channel2
  461.   global voicestate2,voicespot2,voicegraph2
  462.   
  463.   if voicestate2 > 0 then
  464.     set the castnum of sprite voicespot2 = getat(voicegraph2,27)
  465.     set voicestate2=0
  466.     if channel2 = 2 then
  467.       sound STOP 2
  468.     end if
  469.     puppetsound 0
  470.     puppetsprite voicespot2,0  
  471.   end if
  472. End NoVoice2