XFIRV39VMpami:*YEK **SACfniC FCRD XtcLSREVSREVSREVSREV! lcc& lcc) lccSREV lccFCRDTT::>Jeremy Parker>tSAC //////37Eglobal gKeysArePronounced -- pronounce each key pressed on preparemovie initiateSound() initiateKeyboard() initiateFireGame() initiateMainMenu() initiateHelpMenu() gKeysArePronounced = true (the stage).bgcolor = rgb(0, 0, 80) endglobalPrepareMovie,j,>>$Jeremy Parker>tSAC@ 2zglobal gInitialSystemLevel on stopmovie -- restore user's sound level setting setMasterVolume(gInitialSystemLevel) endglobalStopMovie,>>Jeremy ParkertSAC 2BBBBVVVVVVjjjjjjnron exitFrame me sound(1).play(member("doc")) endfirstMovieFramew--,>>)Jeremy ParkerXtcL ` 18#,@,k4)#,#,#+%#+'#+(#+0 lccpamFSREV  knujFCRDTT::Q>Jeremy ParkertSAC  111111EEEEEEIM[global gKeysArePronounced -- pronounce each key pressed on preparemovie initiateSound() initiateKeyboard() initiateFireGame() initiateMainMenu() initiateHelpMenu() initiateWordEntry() gKeysArePronounced = true (the stage).bgcolor = rgb(0, 0, 80) endglobalPrepareMovie,j,>>dJeremy ParkerrtSAC@ 2zglobal gInitialSystemLevel on stopmovie -- restore user's sound level setting setMasterVolume(gInitialSystemLevel) endglobalStopMovie,>>Jeremy ParkertSAC" [llllglobal tutor_mode, loneSound on enterFrame playQueuedSpeech() -- Restart sounds when lone sound is done if loneSound <> -1 and not soundBusy(loneSound) then repeat with c = 1 to 8 if sound(c).status = 4 then sound(c).play() end repeat loneSound = -1 end if if(tutor_mode = 1) then moveFlame() end if endglobalEnterFrameyvnCC,>>} Jeremy ParkertSACn `global tutor_mode on giveControl toWhom if(toWhom = "main_menu") then tutor_mode = 0 else if(toWhom = "fire_game") then tutor_mode = 1 else if(toWhom = "help") then tutor_mode = 2 else if(toWhom = "nothing") then tutor_mode = -1 end if end on mainMenuHasControl if(tutor_mode = 0) then return true else return false end if end on fireGameHasControl if(tutor_mode = 1) then return true else return false end if end on helpHasControl if(tutor_mode = 2) then return true else return false end if end on nothingHasControl if(tutor_mode = -1) then return true else return false end if endglobalControlScriptyvn,>>|Jeremy ParkertSAC" [llllglobal tutor_mode, loneSound on enterFrame playQueuedSpeech() -- Restart sounds when lone sound is done if loneSound <> -1 and not soundBusy(loneSound) then repeat with c = 1 to 8 if sound(c).status = 4 then sound(c).play() end repeat loneSound = -1 end if if(tutor_mode = 1) then moveFlame() end if endglobalEnterFrameyvnCC,>>} Jeremy Parkerknuj,>>} Jeremy ParkertSAC 2BBBBVVVVVVjjjjjjnron exitFrame me sound(1).play(member("doc")) endfirstMovieFramew--,>>)Jeremy ParkerXtcL ` 18#,v1###%#'#(#x0rcsL\v\\^ )HBW BW BW6BWxBW|BWAO_=APCW>b? rcsL\$r\\^ %HBW BW BW6BWxBW|AO_=APCW>b? rcsL\\\^,}DXXX X~Zrttt!vC y#OCVDCW(!BgIKOCVDCW(!BgjIKOI OCVDCW(!BgjIBW5DCV BWs  ScoreBoardYour Current Score is knuj\\^ !HBW BW BW6BWxAO_=APCW>b? knuj&W BW BW6AO_=APCW>b?BWG rcsLTTT\oxT\\^2"7@:D~! A'BC!FT)KD O7.KD AO7KD AO7KDA O7DI7 ABW5BW5 I7A ABW5BW5 I7A ABW5BW5 I7A  ABW5BW5 & main_menu fire_gamehelpnothingrcsL\\\`4<CfRLaRI LBWI LBWLdAIOe knuj\$\\^ %HBW BW BW6BWxBW|AO_=APCW>b? rcsL \ \\| *D J$% !"#HIp pI! :&```S.`:d6e7<6"XZ\ X\7d bM !n RXZZ Zhprrrt :K&L!7M@XZ^^N'dlO_ P6  > @ D DQ< J   R  & 0 8  8SW F  &2K o(   0% w " ( ( (0 (OOAOACWIbACWbACWIbACWIbBV A\OABVAOAOAOAO O!O"O#DCDCCO$DCCO%A OHCOICOp   ACWI$ICg&ACg&b'ACWI$ICg&ACg&CW(Bg)IAOACWI%ICg&ACg&b'ACWI%ICg&ACg&CW(Bg)IAOI ABV ABVI ABV ABVI! ABV ABVI" ABV ABVI# ABV ABV     KCWa'RLAc KCWLAb'KCWLAb'KBV*+  KCWa'RLAc KCWLAb'KCWLAb'KBV*+  KA OAKA O 3KA O!%KA O"KA O# DBW*KA AOEKA AO 6KA AO!'KA AO"KA AO# DBW*KA],Cf-KRLCf- BW.T/0 ARLA LCWKb'LART+J ARLA LCWT LBW5ALRTU  CV RLCWKCW(BgVLCWBg)WX CV RARLKCgY "LCWKLCg&CW(BgVALRT)LCWBg)WXZ ABVCV RLCWKCW(BgVLCWBg)WX A OHCV RARKARLRLA LCWT LCWBg[ALRT"LCWKCW(BgVLCWBg)LOHW\X]U   ARKARLRLA LCWT LCWBg^ALRT"_]U  CV RLCWKCW(BgVLCWKb'LCWAdKbLCWBg)Wa`X  CV RLCWKCW(BgVLCWKb'LCWAdKbLCWBg)LCWTPLCWabKCW(acRKKKLRKKKLRLCWLb'LCWAdLAdbTTWa`edXhgf   ARLKCgY IKLCg&RKIILCg&ILCWa'KRLAd &LCWLCWa'LAdb'IILABgi LCWLb'DLCWa'KRLAd%LCWLCWa'LAdb'IILBgi LCWLb'IILCg&AHLCWa'KRLAd&LCWLCWa'LAdb'IILABgi LCWLb'DLCWa'KRLAd%LCWLCWa'LAdb'IILBgi LCWLb'LAROkjJ*l             IpaY!CWqErIpACg&BWsIpABgt COp&doc gametime ready2Playincorrect channel numberrcsL\oLd\\\y ACWDCW(Bg)zdoctSACn `global tutor_mode on giveControl toWhom if(toWhom = "main_menu") then tutor_mode = 0 else if(toWhom = "fire_game") then tutor_mode = 1 else if(toWhom = "help") then tutor_mode = 2 else if(toWhom = "nothing") then tutor_mode = -1 end if end on mainMenuHasControl if(tutor_mode = 0) then return true else return false end if end on fireGameHasControl if(tutor_mode = 1) then return true else return false end if end on helpHasControl if(tutor_mode = 2) then return true else return false end if end on nothingHasControl if(tutor_mode = -1) then return true else return false end if endglobalControlScriptyvn,>>|Jeremy ParkertSACt f-- -- Script: ScoreKeeper -- Keeps track of the user's points throughout -- the simulation global currentScore -- initialize the score on initializeScore currentScore = 0 put getScore() into member("ScoreBoard") end -- increase score on scoreIncrease howmuch currentScore = currentScore + howmuch put getScore() into member("ScoreBoard") end -- decrease score on scoreDecrease howmuch currentScore = currentScore - howmuch if(currentScore < 0) then currentScore = 0 end if put getScore() into member("ScoreBoard") end -- retrieve score on getScore return currentScore end -- read score on scoreRead() voiceSpeak("Your Current Score is "& getScore()) end ScoreKeeper,>L>LJeremy ParkermanLkeyDownkeyput charToNumgKeyboardIsShowing highlightKeygKeysArePronounced pronounceKey currKeyNumcurrKey prepareMovie initiateSoundinitiateKeyboardplay1play2 autoPanSounds panSoundUp panSoundDown setDecreasing setIncreasingsetMasterVolumewait setStereoPan gVoiceVolume gMusicVolume gPanIncrementsoundvolumegInitialSystemLevel gSound1Number gSound2NumberChannel1PanIncreasingchannel2PanIncreasingchannel3PanIncreasingchannel4PanIncreasingchannel5PanIncreasinggChannel1SoundsgChannel2SoundsgetAtpanmemberplay channelNumpanValue masterLevelticksnothinghowLongendTime stopMovievaluecastLibnumberreturninitiateFireGame tutor_mode enterFramemoveFire moveFlamevoidintegerstagergbbgColor giveControlmainMenuHasControlfireGameHasControlhelpHasControltoWhomtoggleMainMenunothingHasControl showMainMenu loneSound soundIsBehindigetClearChannel playSound queueAndPlaykillAndPlaySoundplaySoundAlone killSound play2Dstatic play2DmovingpanSoundsFromKeyboard soundBusycqueuewhich clear_channelcountxpause boolPauseNarr the_startstopkillNarrsDsX currentTimedurationfDfXcurDcurXpercentsetAthowMuchlistOfChannelsincrementAmountstatus _soundXtraplayQueuedSpeech speechQueue voiceStateplaying voiceSpeakdeleteAtspeekCurrentWordLetterByLetterspeakCurrentWordLetterByLetterclearSpeechQueueinitiateMainMenu exitFramemegetPropinitiateHelpMenuinitializeScore scoreIncrease scoreDecreasegetScore scoreRead currentScore setContentspauseNarration pauseQuizstringinitiateWordEntryknujXFIRHpami #pamm<>#*YEK,tSAC/(tSAC`tSAC1tSAC@&tSAC"FCRDT0knuj /knujnXtcLnknuj knuj 4fniCkSREV F manL28eerf 2knujKknuj> rcsLJknujT  tSACn@1rcsL#knuj&knuj6 knuj" eerf eerf tSACt4rcsL #knuj@$knuj,knuj 1knuj.knuj1jPrcsL knuj/ "rcsLTrcsLh0*SAC knujR tSACnrcsL*"knuj(Z  knuj Cknuj#rcsLknujk eerf knujR*knuj3tSACt f-- -- Script: ScoreKeeper -- Keeps track of the user's points throughout -- the simulation global currentScore -- initialize the score on initializeScore currentScore = 0 put getScore() into member("ScoreBoard") end -- increase score on scoreIncrease howmuch currentScore = currentScore + howmuch put getScore() into member("ScoreBoard") end -- decrease score on scoreDecrease howmuch currentScore = currentScore - howmuch if(currentScore < 0) then currentScore = 0 end if put getScore() into member("ScoreBoard") end -- retrieve score on getScore return currentScore end -- read score on scoreRead() voiceSpeak("Your Current Score is "& getScore()) end ScoreKeeper,>L>LJeremy ParkerrcsL\\\^,}DXXX X~Zrttt!vC y#OCVDCW(!BgIKOCVDCW(!BgjIKOI OCVDCW(!BgjIBW5DCV BWs  ScoreBoardYour Current Score is knujVclearSpeechQueueinitiateMainMenu exitFramemegetPropeknujund queueAndPlaykillAndPlaySoundplaySoundAlone killSound play2Dstatic play2DmovingpanSoundsFromKeyboard soundBusycqueuewhich clear_channelcountxpause boolPauseNarr the_startstopkillNarrsDsX currentTimedurationfDfXcurDcurXpercentsetAthowMuchlistOfChannelsincrementAmountstatus _soundXtraplayQueuedSpeech speechQueue voiceStateplaying voiceSpeakdeleteAtspeekCurrentWordLetterByLetterspeakCurrentWordLetterByLetterclearSpeechQueueknujDdoc gametime ready2Playincorrect channel numberrcsL\ \\^1 'IBWtSAC1 1011111111111,1,1,1,1,1,10141Bglobal gChannel1Sounds, gChannel2Sounds, gSound1Number, gSound2Number global Channel1PanIncreasing, Channel2PanIncreasing, Channel3PanIncreasing, Channel4PanIncreasing, Channel5PanIncreasing global gVoiceVolume, gMusicVolume, gPanIncrement global gInitialSystemLevel, loneSound, soundIsBehind global speechQueue on initiateSound -- initialize volumes. Values for volumes range from 1-255. gVoiceVolume = 150 gMusicVolume = 150 gPanIncrement = 5 -- queue sounds here. -- this needs to be done so sounds are loaded -- into the sound objects and ready to play with no latency. -- set volumes sound(1).volume = gMusicVolume sound(2).volume = 257 sound(3).volume = gVoiceVolume sound(4).volume = gVoiceVolume -- set the pan to center (full left = -100, center = 0, full right = 100) setStereoPan 0 -- save the user's sound level setting so it can be restored when the movie stops gInitialSystemLevel = the soundLevel -- initialize the system level = 0, silence (system volume ranges from 0 to 7) setMasterVolume(5) gSound1Number = 1 gSound2Number = 1 channel1PanIncreasing = 1 channel2PanIncreasing = 1 channel3PanIncreasing = 0 channel4PanIncreasing = 0 channel5PanIncreasing = 0 gChannel1Sounds = [ ["doc", 0], ["gametime", 0]] gChannel2Sounds = [ ["ready2Play", 0] ] loneSound = -1 soundIsBehind = [false, false, false, false, false, false, false] speechQueue = [ ] end --------------------------------------- ---plays the next sound in the two-dimensional array for channel 1 sounds --------------------------------------- on play1 sound(1).pan = gChannel1Sounds[gSound1Number][2] sound(1).play(member(gChannel1Sounds[gSound1Number][1])) gSound1Number = gSound1Number + 1 end --------------------------------------- ---plays the next sound in the two-dimensional array for channel 2 sounds --------------------------------------- on play2 sound(2).pan = gChannel2Sounds[gSound2Number][2] sound(2).play(member(gChannel2Sounds[gSound2Number][1])) gSound1Number = gSound2Number + 1 end --- on autoPanSounds if(channel1PanIncreasing) then panSoundUp 1 else panSoundDown 1 end if if(channel2PanIncreasing) then panSoundUp 2 else panSoundDown 2 end if if(channel3PanIncreasing) then panSoundUp 3 else panSoundDown 3 end if if(channel4PanIncreasing) then panSoundUp 4 else panSoundDown 4 end if if(channel5PanIncreasing) then panSoundUp 5 else panSoundDown 5 end if end --- on panSoundUp channelNum panValue = sound(channelNum).pan if panValue < 99 then sound(channelNum).pan = panValue + 1 else sound(channelNum).pan = panValue - 1 setDecreasing channelNum end if end --- on panSoundDown channelNum panValue = sound(channelNum).pan if panValue > -99 then sound(channelNum).pan = panValue - 1 else sound(channelNum).pan = panValue + 1 setIncreasing channelNum end if end ------------------------------------ --- used for panning the sound ------------------------------------ on setDecreasing channelNum if channelNum = 1 then channel1PanIncreasing = 0 else if channelNum = 2 then channel2PanIncreasing = 0 else if channelNum = 3 then channel3PanIncreasing = 0 else if channelNum = 4 then channel4PanIncreasing = 0 else if channelNum = 5 then channel5PanIncreasing = 0 else put "incorrect channel number" end if end ---------------------------------- --- used for panning the sound ---------------------------------- on setIncreasing channelNum if channelNum = 1 then channel1PanIncreasing = 1 else if channelNum = 2 then channel2PanIncreasing = 1 else if channelNum = 3 then channel3PanIncreasing = 1 else if channelNum = 4 then channel4PanIncreasing = 1 else if channelNum = 5 then channel5PanIncreasing = 1 else put "incorrect channel number" end if end --- on setMasterVolume masterLevel the soundLevel = masterLevel --- on wait howLong endTime = the ticks + howLong repeat while endTime > the ticks nothing end repeat end --- on setStereoPan panValue i = 1 repeat while(i < 9) sound(i).pan = panValue i = i+1 end repeat end --- ------------------------------------------- -- Function: getClearChannel -- -- Param: [NONE] -- -- Returns: number of first free channel-- -- Desc: Checks non-narration sound -- -- channels for unused one -- ------------------------------------------- on getClearChannel repeat with c = 2 to 8 if not soundBusy(c) then return c end if end repeat end getClearChannel ----------------------------------------- -- Function: playSound -- -- Param: which = member to play -- -- Desc: Plays sound member -- ----------------------------------------- on playSound which clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).play() end playSound ------------------------------------------------ -- Function: queueAndPlay -- -- Param: which = array of members to play -- -- Desc: Queues and plays members -- ------------------------------------------------ on queueAndPlay which clear_channel = getClearChannel() repeat with x = 1 to which.count() sound(clear_channel).queue(member(which[x])) end repeat sound(clear_channel).play() end queueAndPlay which ----------------------------------------- -- Function: killAndPlaySound -- Param: which = member to play -- Desc: kills alls sound and plays member ----------------------------------------- on killAndPlaySound which killSound(true) clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).play() end playSound ---------------------------------------------------------- -- Function: playSoundAlone -- -- Param: which = member to play -- -- boolPauseNarr = should narration be paused -- -- Desc: Pauses all current sounds, plays 'which', -- -- and sounds restarted by enter frame script -- ---------------------------------------------------------- on playSoundAlone which, boolPauseNarr loneSound = -1 clear_channel = getClearChannel() the_start = 2 if boolPauseNarr then the_start = 1 repeat with c = the_start to 8 if soundBusy(c) then sound(c).pause() end repeat sound(clear_channel).queue(member(which)) sound(clear_channel).play() loneSound = clear_channel end getClearChannel -------------------------------------------------- -- Function: killSound -- -- Param: killNarr = should narration stop -- -- Desc: Stops all currently playing sounds -- -------------------------------------------------- on killSound killNarr the_start = 2 if killNarr then the_start = 1 repeat with c = the_start to 8 if soundBusy(c) then sound(c).stop() end repeat end killSound ------------------------------------------------------------------ -- Method: play2Dstatic -- -- Param: which = name of cast member to play -- -- sX = left-right static pan value [-100(L),100(R)] -- -- sD = near-far static volume value [0(N),100(F)] -- -- Desc: Plays stationary sound relative to observer -- ------------------------------------------------------------------ on play2Dstatic which, sX, sD clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).pan = sX sound(clear_channel).volume = (100-sD) * 255 sound(clear_channel).play() end play2Dstatic -------------------------------------------------------------------- -- Method: play2Dmoving -- -- Param: which = name of cast member to play -- -- sX = starting left-right pan value [-100(L),100(R)] -- -- sD = starting near-far volume value [0(N),100(F)] -- -- fX = finishing left-right pan value[-100(L),100(R)] -- -- fD = finishing near-far volume value [0(N),100(F)] -- -------------------------------------------------------------------- on play2Dmoving which, sX, sD, fX, fD clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).pan = sX sound(clear_channel).volume = (100-sD) * 255 sound(clear_channel).play() -- May cause problem since freezes at frame -- While sound active, change pan & volume to match parameters over duration repeat while soundBusy(clear_channel) percent = sound(clear_channel).currentTime / member(which).duration curX = sX + (fX-sX)*percent curD = sD + (fD-sD)*percent sound(clear_channel).pan = curX sound(clear_channel).volume = (100-curD)/100 * 255 end repeat end play2Dmoving -------------------------------------------------- -- panSoundsFromKeyboard -- -- this thing allows a little more complexity -- -- than is actually used, since I had a little -- -- more functionality in mind when I created it -- -- But, we can use it's features if need be. -- -- They're commented out now, so we won't take -- -- any performance hits. -- paramaters: -- -- listOfChannels: those chanels that should-- -- be panned -- -- howMuch: duh... if this value is -- -- negative, the player is rotating-- -- to the left, right otherwise -- -- much of the functionality is commented out -- -- for now. -- -------------------------------------------------- on panSoundsFromKeyboard listOfChannels, howMuch i = 1 repeat while(i<=listOfChannels.count()) channelNum = listOfChannels[i] if (howMuch > 0) then -- rotate to the right -- if the sound is in front of our user, it will fade left -- otherwise, it will fade right (use the soundRelativePos variable) -- in front of the user is defined as between 0 and 100 -- behind is -100 to 0 if(soundIsBehind[channelNum] = false) then -- in front of user, so fade left incrementAmount = sound(channelNum).pan - howMuch -- threshold check: if (incrementAmount < -100) then --sound(channelNum).pan = -100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = true else sound(channelNum).pan = incrementAmount end if else -- behind user, so fade right incrementAmount = sound(channelNum).pan + howMuch --threshold check if (incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan - (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum). pan = incrementAmount end if end if else -- rotate to the left if(soundIsBehind[channelNum] = true) then -- behind of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if (incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan - (incrementAmount mod 100)) soundIsBehind[channelNum] = true else sound(channelNum).pan = incrementAmount end if else -- in front of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if(incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum).pan = incrementAmount end if end if end if i = i+1 end repeat end panSoundsFromKeyboard on playQueuedSpeech if(speechQueue.count <> 0) then if(voiceState() <> #playing) then voiceSpeak(speechQueue[1]) speechQueue.deleteAt(1) end if end if end --- on clearSpeechQueue speechQueue = [] end --- globalAudioss,>>Jeremy ParkermanLkeyDownkeyput charToNumgKeyboardIsShowing highlightKeygKeysArePronounced pronounceKey currKeyNumcurrKey prepareMovie initiateSoundinitiateKeyboardplay1play2 autoPanSounds panSoundUp panSoundDown setDecreasing setIncreasingsetMasterVolumewait setStereoPan gVoiceVolume gMusicVolume gPanIncrementsoundvolumegInitialSystemLevel gSound1Number gSound2NumberChannel1PanIncreasingchannel2PanIncreasingchannel3PanIncreasingchannel4PanIncreasingchannel5PanIncreasinggChannel1SoundsgChannel2SoundsgetAtpanmemberplay channelNumpanValue masterLevelticksnothinghowLongendTime stopMovievaluecastLibnumberreturninitiateFireGame tutor_mode enterFramemoveFire moveFlamevoidintegerstagergbbgColor giveControlmainMenuHasControlfireGameHasControlhelpHasControltoWhomtoggleMainMenunothingHasControl showMainMenu loneSound soundIsBehindigetClearChannel playSound queueAndPlaykillAndPlaySoundplaySoundAlone killSound play2Dstatic play2DmovingpanSoundsFromKeyboard soundBusycqueuewhich clear_channelcountxpause boolPauseNarr the_startstopkillNarrsDsX currentTimedurationfDfXcurDcurXpercentsetAthowMuchlistOfChannelsincrementAmountstatus _soundXtraplayQueuedSpeech speechQueue voiceStateplaying voiceSpeakdeleteAtspeekCurrentWordLetterByLetterspeakCurrentWordLetterByLetterclearSpeechQueueinitiateMainMenu exitFramemegetPropinitiateHelpMenuinitializeScore scoreIncrease scoreDecreasegetScore scoreRead currentScore setContentspauseNarration pauseQuizstringinitiateWordEntrytSAC1 1011111111111,1,1,1,1,1,10141Bglobal gChannel1Sounds, gChannel2Sounds, gSound1Number, gSound2Number global Channel1PanIncreasing, Channel2PanIncreasing, Channel3PanIncreasing, Channel4PanIncreasing, Channel5PanIncreasing global gVoiceVolume, gMusicVolume, gPanIncrement global gInitialSystemLevel, loneSound, soundIsBehind global speechQueue on initiateSound -- initialize volumes. Values for volumes range from 1-255. gVoiceVolume = 150 gMusicVolume = 150 gPanIncrement = 5 -- queue sounds here. -- this needs to be done so sounds are loaded -- into the sound objects and ready to play with no latency. -- set volumes sound(1).volume = gMusicVolume sound(2).volume = 257 sound(3).volume = gVoiceVolume sound(4).volume = gVoiceVolume -- set the pan to center (full left = -100, center = 0, full right = 100) setStereoPan 0 -- save the user's sound level setting so it can be restored when the movie stops gInitialSystemLevel = the soundLevel -- initialize the system level = 0, silence (system volume ranges from 0 to 7) setMasterVolume(5) gSound1Number = 1 gSound2Number = 1 channel1PanIncreasing = 1 channel2PanIncreasing = 1 channel3PanIncreasing = 0 channel4PanIncreasing = 0 channel5PanIncreasing = 0 gChannel1Sounds = [ ["doc", 0], ["gametime", 0]] gChannel2Sounds = [ ["ready2Play", 0] ] loneSound = -1 soundIsBehind = [false, false, false, false, false, false, false] speechQueue = [ ] end --------------------------------------- ---plays the next sound in the two-dimensional array for channel 1 sounds --------------------------------------- on play1 sound(1).pan = gChannel1Sounds[gSound1Number][2] sound(1).play(member(gChannel1Sounds[gSound1Number][1])) gSound1Number = gSound1Number + 1 end --------------------------------------- ---plays the next sound in the two-dimensional array for channel 2 sounds --------------------------------------- on play2 sound(2).pan = gChannel2Sounds[gSound2Number][2] sound(2).play(member(gChannel2Sounds[gSound2Number][1])) gSound1Number = gSound2Number + 1 end --- on autoPanSounds if(channel1PanIncreasing) then panSoundUp 1 else panSoundDown 1 end if if(channel2PanIncreasing) then panSoundUp 2 else panSoundDown 2 end if if(channel3PanIncreasing) then panSoundUp 3 else panSoundDown 3 end if if(channel4PanIncreasing) then panSoundUp 4 else panSoundDown 4 end if if(channel5PanIncreasing) then panSoundUp 5 else panSoundDown 5 end if end --- on panSoundUp channelNum panValue = sound(channelNum).pan if panValue < 99 then sound(channelNum).pan = panValue + 1 else sound(channelNum).pan = panValue - 1 setDecreasing channelNum end if end --- on panSoundDown channelNum panValue = sound(channelNum).pan if panValue > -99 then sound(channelNum).pan = panValue - 1 else sound(channelNum).pan = panValue + 1 setIncreasing channelNum end if end ------------------------------------ --- used for panning the sound ------------------------------------ on setDecreasing channelNum if channelNum = 1 then channel1PanIncreasing = 0 else if channelNum = 2 then channel2PanIncreasing = 0 else if channelNum = 3 then channel3PanIncreasing = 0 else if channelNum = 4 then channel4PanIncreasing = 0 else if channelNum = 5 then channel5PanIncreasing = 0 else put "incorrect channel number" end if end ---------------------------------- --- used for panning the sound ---------------------------------- on setIncreasing channelNum if channelNum = 1 then channel1PanIncreasing = 1 else if channelNum = 2 then channel2PanIncreasing = 1 else if channelNum = 3 then channel3PanIncreasing = 1 else if channelNum = 4 then channel4PanIncreasing = 1 else if channelNum = 5 then channel5PanIncreasing = 1 else put "incorrect channel number" end if end --- on setMasterVolume masterLevel the soundLevel = masterLevel --- on wait howLong endTime = the ticks + howLong repeat while endTime > the ticks nothing end repeat end --- on setStereoPan panValue i = 1 repeat while(i < 9) sound(i).pan = panValue i = i+1 end repeat end --- ------------------------------------------- -- Function: getClearChannel -- -- Param: [NONE] -- -- Returns: number of first free channel-- -- Desc: Checks non-narration sound -- -- channels for unused one -- ------------------------------------------- on getClearChannel repeat with c = 2 to 8 if not soundBusy(c) then return c end if end repeat end getClearChannel ----------------------------------------- -- Function: playSound -- -- Param: which = member to play -- -- Desc: Plays sound member -- ----------------------------------------- on playSound which clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).play() end playSound ------------------------------------------------ -- Function: queueAndPlay -- -- Param: which = array of members to play -- -- Desc: Queues and plays members -- ------------------------------------------------ on queueAndPlay which clear_channel = getClearChannel() repeat with x = 1 to which.count() sound(clear_channel).queue(member(which[x])) end repeat sound(clear_channel).play() end queueAndPlay which ----------------------------------------- -- Function: killAndPlaySound -- Param: which = member to play -- Desc: kills alls sound and plays member ----------------------------------------- on killAndPlaySound which killSound(true) clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).play() end playSound ---------------------------------------------------------- -- Function: playSoundAlone -- -- Param: which = member to play -- -- boolPauseNarr = should narration be paused -- -- Desc: Pauses all current sounds, plays 'which', -- -- and sounds restarted by enter frame script -- ---------------------------------------------------------- on playSoundAlone which, boolPauseNarr loneSound = -1 clear_channel = getClearChannel() the_start = 2 if boolPauseNarr then the_start = 1 repeat with c = the_start to 8 if soundBusy(c) then sound(c).pause() end repeat sound(clear_channel).queue(member(which)) sound(clear_channel).play() loneSound = clear_channel end getClearChannel -------------------------------------------------- -- Function: killSound -- -- Param: killNarr = should narration stop -- -- Desc: Stops all currently playing sounds -- -------------------------------------------------- on killSound killNarr the_start = 2 if killNarr then the_start = 1 repeat with c = the_start to 8 if soundBusy(c) then sound(c).stop() end repeat end killSound ------------------------------------------------------------------ -- Method: play2Dstatic -- -- Param: which = name of cast member to play -- -- sX = left-right static pan value [-100(L),100(R)] -- -- sD = near-far static volume value [0(N),100(F)] -- -- Desc: Plays stationary sound relative to observer -- ------------------------------------------------------------------ on play2Dstatic which, sX, sD clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).pan = sX sound(clear_channel).volume = (100-sD) * 255 sound(clear_channel).play() end play2Dstatic -------------------------------------------------------------------- -- Method: play2Dmoving -- -- Param: which = name of cast member to play -- -- sX = starting left-right pan value [-100(L),100(R)] -- -- sD = starting near-far volume value [0(N),100(F)] -- -- fX = finishing left-right pan value[-100(L),100(R)] -- -- fD = finishing near-far volume value [0(N),100(F)] -- -------------------------------------------------------------------- on play2Dmoving which, sX, sD, fX, fD clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).pan = sX sound(clear_channel).volume = (100-sD) * 255 sound(clear_channel).play() -- May cause problem since freezes at frame -- While sound active, change pan & volume to match parameters over duration repeat while soundBusy(clear_channel) percent = sound(clear_channel).currentTime / member(which).duration curX = sX + (fX-sX)*percent curD = sD + (fD-sD)*percent sound(clear_channel).pan = curX sound(clear_channel).volume = (100-curD)/100 * 255 end repeat end play2Dmoving -------------------------------------------------- -- panSoundsFromKeyboard -- -- this thing allows a little more complexity -- -- than is actually used, since I had a little -- -- more functionality in mind when I created it -- -- But, we can use it's features if need be. -- -- They're commented out now, so we won't take -- -- any performance hits. -- paramaters: -- -- listOfChannels: those chanels that should-- -- be panned -- -- howMuch: duh... if this value is -- -- negative, the player is rotating-- -- to the left, right otherwise -- -- much of the functionality is commented out -- -- for now. -- -------------------------------------------------- on panSoundsFromKeyboard listOfChannels, howMuch i = 1 repeat while(i<=listOfChannels.count()) channelNum = listOfChannels[i] if (howMuch > 0) then -- rotate to the right -- if the sound is in front of our user, it will fade left -- otherwise, it will fade right (use the soundRelativePos variable) -- in front of the user is defined as between 0 and 100 -- behind is -100 to 0 if(soundIsBehind[channelNum] = false) then -- in front of user, so fade left incrementAmount = sound(channelNum).pan - howMuch -- threshold check: if (incrementAmount < -100) then --sound(channelNum).pan = -100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = true else sound(channelNum).pan = incrementAmount end if else -- behind user, so fade right incrementAmount = sound(channelNum).pan + howMuch --threshold check if (incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan - (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum). pan = incrementAmount end if end if else -- rotate to the left if(soundIsBehind[channelNum] = true) then -- behind of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if (incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan - (incrementAmount mod 100)) soundIsBehind[channelNum] = true else sound(channelNum).pan = incrementAmount end if else -- in front of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if(incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum).pan = incrementAmount end if end if end if i = i+1 end repeat end panSoundsFromKeyboard on playQueuedSpeech if(speechQueue.count <> 0) then if(voiceState() <> #playing) then voiceSpeak(speechQueue[1]) speechQueue.deleteAt(1) end if end if end --- on clearSpeechQueue speechQueue = [] end --- globalAudioss,>>Jeremy Parkerknuj|nnelNum).pan = incrementAmount end if else -- in front of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if(incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum).pan = incrementAmount end if end if end if i = i+1 end repeat end panSoundsFromKeyboard on playQueuedSpeech if(speechQueue.count <> 0) then if(voiceState() <> #playing) then voiceSpeak(speechQueue[1]) speechQueue.deleteAt(1) end if end if end --- on clearSpeechQueue speechQueue = [] end --- globalAudioss,>>Jeremy Parkerpamm<5" XFIRpami #pamm #*YEK tSAC/ tSACtSAC1KtSAC@tSAC"FCRDTZ knuj> knuj1XtcLeerf knuj~/fniCk SREV manL\}knujnknuj|xeerf rcsLJknuj6 -tSACnknuj#knujT0&knujn4knuj` knuj282knujt4tSACt CrcsL #knuj/()knujkknuj<> knuj.*SAC rcsL knuj,rcsLTrcsLh0knuj !knuj"3tSACrcsL*"knuj F knujVHknujd#rcsLFrcsLknujknuj@& knujn@1*pamm<6 &XFIRVpami 8/#pamm\.#*YEK,tSAC/tSACHtSAC1xtSAC@tSAC"~FCRDT0knujN knujTZ XtcLVknujFknuj/fniCSSREV : manL28knuj@knuj|:knuj\} rcsLJknuj-tSACn@1knuj#"knuj2 !knuj4knuj 1knuj2knuj1KtSACt4rcsL #knujknuj* 5knujN>.knuj"knuj 3rcsL eerf rcsLTrcsLh0rcsLd*SAC tSACVrcsL*"knujt CknujVHknuj"rcsL&knujknujn#knujk  knuj/ $knuj  gInitialSystemLevel = the soundLevel -- initialize the system level = 0, silence (system volume ranges from 0 to 7) setMasterVolume(5) gSound1Number = 1 gSound2Number = 1 channel1PanIncreasing = 1 channel2PanIncreasing = 1 channel3PanIncreasing = 0 channel4PanIncreasing = 0 channel5PanIncreasing = 0 gChannel1Sounds = [ ["doc", 0], ["gametime", 0]] gChannel2Sounds = [ ["ready2Play", 0] ] loneSound = -1 soundIsBehind = [false, false, false, false, false, false, false] end --------------------------------------- ---plays the next sound in the two-dimensional array for channel 1 sounds --------------------------------------- on play1 sound(1).pan = gChannel1Sounds[gSound1Number][2] sound(1).play(member(gChannel1Sounds[gSound1Number][1])) gSound1Number = gSound1Number + 1 end --------------------------------------- ---plays the next sound in the two-dimensional array for channel 2 sounds --------------------------------------- on play2 sound(2).pan = gChannel2Sounds[gSound2Number][2] sound(2).play(member(gChannel2Sounds[gSound2Number][1])) gSound1Number = gSound2Number + 1 end --- on autoPanSounds if(channel1PanIncreasing) then panSoundUp 1 else panSoundDown 1 end if if(channel2PanIncreasing) then panSoundUp 2 else panSoundDown 2 end if if(channel3PanIncreasing) then panSoundUp 3 else panSoundDown 3 end if if(channel4PanIncreasing) then panSoundUp 4 else panSoundDown 4 end if if(channel5PanIncreasing) then panSoundUp 5 else panSoundDown 5 end if end --- on panSoundUp channelNum panValue = sound(channelNum).pan if panValue < 99 then sound(channelNum).pan = panValue + 1 else sound(channelNum).pan = panValue - 1 setDecreasing channelNum end if end --- on panSoundDown channelNum panValue = sound(channelNum).pan if panValue > -99 then sound(channelNum).pan = panValue - 1 else sound(channelNum).pan = panValue + 1 setIncreasing channelNum end if end ------------------------------------ --- used for panning the sound ------------------------------------ on setDecreasing channelNum if channelNum = 1 then channel1PanIncreasing = 0 else if channelNum = 2 then channel2PanIncreasing = 0 else if channelNum = 3 then channel3PanIncreasing = 0 else if channelNum = 4 then channel4PanIncreasing = 0 else if channelNum = 5 then channel5PanIncreasing = 0 else put "incorrect channel number" end if end ---------------------------------- --- used for panning the sound ---------------------------------- on setIncreasing channelNum if channelNum = 1 then channel1PanIncreasing = 1 else if channelNum = 2 then channel2PanIncreasing = 1 else if channelNum = 3 then channel3PanIncreasing = 1 else if channelNum = 4 then channel4PanIncreasing = 1 else if channelNum = 5 then channel5PanIncreasing = 1 else put "incorrect channel number" end if end --- on setMasterVolume masterLevel the soundLevel = masterLevel --- on wait howLong endTime = the ticks + howLong repeat while endTime > the ticks nothing end repeat end --- on setStereoPan panValue i = 1 repeat while(i < 9) sound(i).pan = panValue i = i+1 end repeat end --- ------------------------------------------- -- Function: getClearChannel -- -- Param: [NONE] -- -- Returns: number of first free channel-- -- Desc: Checks non-narration sound -- -- channels for unused one -- ------------------------------------------- on getClearChannel repeat with c = 2 to 8 if not soundBusy(c) then return c end if end repeat end getClearChannel ----------------------------------------- -- Function: playSound -- -- Param: which = member to play -- -- Desc: Plays sound member -- ----------------------------------------- on playSound which clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).play() end playSound ------------------------------------------------ -- Function: queueAndPlay -- -- Param: which = array of members to play -- -- Desc: Queues and plays members -- ------------------------------------------------ on queueAndPlay which clear_channel = getClearChannel() repeat with x = 1 to which.count() sound(clear_channel).queue(member(which[x])) end repeat sound(clear_channel).play() end queueAndPlay which ----------------------------------------- -- Function: killAndPlaySound -- Param: which = member to play -- Desc: kills alls sound and plays member ----------------------------------------- on killAndPlaySound which killSound(true) clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).play() end playSound ---------------------------------------------------------- -- Function: playSoundAlone -- -- Param: which = member to play -- -- boolPauseNarr = should narration be paused -- -- Desc: Pauses all current sounds, plays 'which', -- -- and sounds restarted by enter frame script -- ---------------------------------------------------------- on playSoundAlone which, boolPauseNarr loneSound = -1 clear_channel = getClearChannel() the_start = 2 if boolPauseNarr then the_start = 1 repeat with c = the_start to 8 if soundBusy(c) then sound(c).pause() end repeat sound(clear_channel).queue(member(which)) sound(clear_channel).play() loneSound = clear_channel end getClearChannel -------------------------------------------------- -- Function: killSound -- -- Param: killNarr = should narration stop -- -- Desc: Stops all currently playing sounds -- -------------------------------------------------- on killSound killNarr the_start = 2 if killNarr then the_start = 1 repeat with c = the_start to 8 if soundBusy(c) then sound(c).stop() end repeat end killSound ------------------------------------------------------------------ -- Method: play2Dstatic -- -- Param: which = name of cast member to play -- -- sX = left-right static pan value [-100(L),100(R)] -- -- sD = near-far static volume value [0(N),100(F)] -- -- Desc: Plays stationary sound relative to observer -- ------------------------------------------------------------------ on play2Dstatic which, sX, sD clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).pan = sX sound(clear_channel).volume = (100-sD) * 255 sound(clear_channel).play() end play2Dstatic -------------------------------------------------------------------- -- Method: play2Dmoving -- -- Param: which = name of cast member to play -- -- sX = starting left-right pan value [-100(L),100(R)] -- -- sD = starting near-far volume value [0(N),100(F)] -- -- fX = finishing left-right pan value[-100(L),100(R)] -- -- fD = finishing near-far volume value [0(N),100(F)] -- -------------------------------------------------------------------- on play2Dmoving which, sX, sD, fX, fD clear_channel = getClearChannel() sound(clear_channel).queue(member(which)) sound(clear_channel).pan = sX sound(clear_channel).volume = (100-sD) * 255 sound(clear_channel).play() -- May cause problem since freezes at frame -- While sound active, change pan & volume to match parameters over duration repeat while soundBusy(clear_channel) percent = sound(clear_channel).currentTime / member(which).duration curX = sX + (fX-sX)*percent curD = sD + (fD-sD)*percent sound(clear_channel).pan = curX sound(clear_channel).volume = (100-curD)/100 * 255 end repeat end play2Dmoving -------------------------------------------------- -- panSoundsFromKeyboard -- -- this thing allows a little more complexity -- -- than is actually used, since I had a little -- -- more functionality in mind when I created it -- -- But, we can use it's features if need be. -- -- They're commented out now, so we won't take -- -- any performance hits. -- paramaters: -- -- listOfChannels: those chanels that should-- -- be panned -- -- howMuch: duh... if this value is -- -- negative, the player is rotating-- -- to the left, right otherwise -- -- much of the functionality is commented out -- -- for now. -- -------------------------------------------------- on panSoundsFromKeyboard listOfChannels, howMuch i = 1 repeat while(i<=listOfChannels.count()) channelNum = listOfChannels[i] if (howMuch > 0) then -- rotate to the right -- if the sound is in front of our user, it will fade left -- otherwise, it will fade right (use the soundRelativePos variable) -- in front of the user is defined as between 0 and 100 -- behind is -100 to 0 if(soundIsBehind[channelNum] = false) then -- in front of user, so fade left incrementAmount = sound(channelNum).pan - howMuch -- threshold check: if (incrementAmount < -100) then --sound(channelNum).pan = -100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = true else sound(channelNum).pan = incrementAmount end if else -- behind user, so fade right incrementAmount = sound(channelNum).pan + howMuch --threshold check if (incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan - (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum). pan = incrementAmount end if end if else -- rotate to the left if(soundIsBehind[channelNum] = true) then -- behind of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if (incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan - (incrementAmount mod 100)) soundIsBehind[channelNum] = true else sound(channelNum).pan = incrementAmount end if else -- in front of user, so fade right incrementAmount = sound(channelNum).pan - howMuch -- threshold check if(incrementAmount > 100) then --sound(channelNum).pan = 100 sound(channelNum).pan = (sound(channelNum).pan + (incrementAmount mod 100)) soundIsBehind[channelNum] = false else sound(channelNum).pan = incrementAmount end if end if end if i = i+1 end repeat end panSoundsFromKeyboard on playQueuedSpeech if(speechQueue.count <> 0) then if(voiceState() <> #playing) then voiceSpeak(speechQueue[1]) speechQueue.deleteAt(1) end if end if end globalAudioyvn77,>>|Jeremy Parker