wait with messages...
Scott Rossi
scott at tactilemedia.com
Wed Feb 4 17:08:19 EST 2004
Recently, "Chipp Walters" <chipp at chipp.com> wrote:
> Can you provide an example where you would use one and not the other or
> not 'send'?
Chipp -- I didn't see too many other responses here so I'll chime in...
One thing I recently started using "wait with messages" for is queuing a set
of sounds for playback. I was a staunch advocate for using "send in" to
monitor the status of media using all sorts of custom timers and what-not.
But then it occurred to me that "wait with messages" should achieve the same
result, and it seems to work great. As a simple example:
on playQueue pList
repeat with N = 1 to number of items of pList
play audioClip N
wait until the sound is done with messages
wait 500 milliseconds with messages
end repeat
end playQueue
The above handler will play a list of audioClips sent to it with a 1/2
second delay between each clip. Now playing audio by itself is not very
overwhelming until you realize that the above repeat loop will run virtually
asynchronously while other scripts are running: mouse tracking, button
clicks, hiding/showing images, pretty much anything. Another way to use
"wait with messages" is card or stack initialization for any set of events
that take time to process (such as setting fileNames of players and starting
playback).
I've only just started getting into this technique but so far it involves
less scripting and maintenance than "send in" and it virtually eliminates
stray message loops winding up in the pendingMessages. My impression is
that "wait with messages" is pretty much the same as "send in" but without
control or access to the messages being sent by the engine. I'd like to see
Scott Raney chime on this from a technical level to know what the real
differences are, if any.
Anyway, while some folks on the list may be put off by the lack of real
"external" message threading, the "internal" threading within Rev is pretty
phenomenal once you start to play around with it.
Regards,
Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com
More information about the use-livecode
mailing list