Is there a "broadcast for x seconds" block?

I’d like to make a block that acts upon a broadcast for a set range of time, rather than one that just checks once and ends. Is there any existing one or way I can make one?

I don’t understand… What do you mean by that?
If you mean keep broadcasting the message:


But if you don’t, please elaborate further.


P.S, I believe there is a Snap! mod with a different broadcast structure:

broadcast [ V] $>

stop broadcast [ V] ::control

But I don’t remember which.

That’s the one, thanks.

You don’t need to use launch and create an extra thread. Instead, you can do something like this:

Here’s a little variation which allows you to change receiver, data, and message based on time elapsed:

untitled script pic (18)

Here’s an example:

I like the secs upvar, but I prefer

launch ({wait (...) seconds}$>) $>

over

current [time in milliseconds V]

. I think it’s a matter of preference.

Edit: I found out the secs upvar uses

current [time in milliseconds V]

so I think it’s good to use that.

Fair enough. It is easier to see what’s going on.

If you really get down in the nitty gritty of it, launching a wait does impact performance by starting an additional thread. It is like having dozens of different forever loops rather than just one. But bear in mind, this will only come into play if the block is used many times in a project and/or that project is already suffering from some degree of performance issues. So it’s a matter of preference… and sometimes performance.

Sorry, the words “preference” and “performance” were too similar to let the opportunity pass ;).

Edit: Woah, you edited while I wrote the post, now I’ll edit too.

There were other parts of the definition I had to change for the secs upvar to work, so I really feel that it doesn’t really matter which way you go with the original block. I kind of want to have my cake and eat it too by using the launch method’s clarity in conjunction with the (albeit possibly minute) performance benefits of the other method (kind of like how MAP et. al. have JavaScript performance but exposed definitions).

@redgeographysnap I think that thou talked about Snavanced!, or is not it? :upside_down_face:

That was the one!

What is this? How can I find these blocks?

Those blocks are part of a mod made by alessandrito123 called Snavanced!. The mod can be found here.