Page 1 of 1

Sequencing the playing of sounds via players

Posted: Sun Feb 14, 2010 8:12 pm
by DougN
Hello,

I'm trying to upgrade some simple code to get rid of the evil "wait" command, and I thought I'd use it to learn about using the "send" system.

My old code:

Code: Select all

global knockResponse -- set with a pull-down menu on the card
on mouseup
   start player "knock"
   wait 2 seconds
   start player "knockAgain"
   wait 4 seconds
   start player knockResponse -- where knockResponse is a variable
end mouseup
My new approach, using the send command, looks like this:

Code: Select all

global knockResponse -- set with a pull-down menu on the card
on mouseup
   start player "knock"
   send "start player knockAgain" to me in 2 seconds
   send "start player knockResponse" to me in 6 seconds -- where knockResponse is a variable
end mouseup
This works great for the first two players ("knock" and "knockAgain"), but it doesn't work for the variable knockResponse (no sound plays) -- presumably because Rev is looking for a player that's actually named "knockResponse."

So my questions:

1) Am I approaching this in a good way, using the send command? Are there better ways to approach the sequencing of player playback?

2) Are there different ways to send the "start player" message? I tried -- send "start" to player "knock" -- but that didn't work.

3) Is there a way to include / use the variable name in the send command, so that I can vary the knockResponse sound that actually gets played, based on the value of the button?

Thanks, as always!
DougN

Re: Sequencing the playing of sounds via players

Posted: Sun Feb 14, 2010 9:12 pm
by DougN
OK, I think I found a way around this one:
3) Is there a way to include / use the variable name in the send command, so that I can vary the knockResponse sound that actually gets played, based on the value of the button?
Instead of using different players on the card, I'm going to use one player for the knockResponse, and change the file that it plays using the "set the filename of player knockResponse" command. I'll have the button where the user chooses the response set the filename.

I'd still be interested to know whether I can include a variable in a "send" command.

Re: Sequencing the playing of sounds via players

Posted: Mon Feb 15, 2010 11:45 am
by bn
Hi DougN,
try:

Code: Select all

 send "start player" && knockResponse to me in 6 seconds -- where knockResponse is a variable
this way you send the content of the variable knockResponse along with the send command and you can choose the player with the variable. Everything that is within quotes Rev takes literally and has no idea about the variable. If you take your variablename out of the quote Rev uses the content of the variable.
regards
Bernd

Re: Sequencing the playing of sounds via players

Posted: Tue Feb 16, 2010 12:04 am
by DougN
Bernd,

Thanks! That's a great tip that I'll use in other situations as well.

Best,
Doug