So you've always wanted an 'If I receive [broadcast]' block, right? Well, there's no need for an update to Scratch- it can already be made very simply!
Here's the script:
Or:
When flag clicked set [variable] to 0 broadcast [name of broadcast] Forever If <[variable] = 1> do script end if end forever When I Receive [broadcast[ set [variable] to 1
Of course, it doesn't need to be 'change x by 1'- it can be anything.
Hope this helps
Last edited by Sunrise-Moon (2010-07-20 03:15:17)
Offline
Nice! Although it would still be nice to still have the <when I receive []> block/sensor because it is a bit complicated.
Offline
Dazachi wrote:
Nice! Although it would still be nice to still have the <when I receive []> block/sensor because it is a bit complicated.
Agreed.
Offline
scmb1 wrote:
I'm glad you made this. Lots of people want that block and don't know that they can do it this way.
Thank you .
Offline
Ive already said this ages ago!
Offline
johnnydean1 wrote:
Ive already said this ages ago!
I'm sorry, I didn't see your post.
melikecheese wrote:
Thank you. This will really help!
You're welcome
Last edited by Sunrise-Moon (2010-07-20 10:54:46)
Offline
This confuses me sometimes... Why place the variable at 0 if you're just going to broadcast it back to 1? I do see the target though, and I will probably use this in the future, just alternate it a little
Regards,
Ralphjos
Offline
johnnydean1 wrote:
Ive already said this ages ago!
I was probably either not there, or was so new to scratch that I didn't understand it at all.
Offline
Ralphjos wrote:
This confuses me sometimes... Why place the variable at 0 if you're just going to broadcast it back to 1? I do see the target though, and I will probably use this in the future, just alternate it a little
![]()
Regards,
Ralphjos
Normally, you won't make a project that immediately broadcasts that- that script was only an example. In reality, you'd probably make something trigger a broadcast, which triggers the fake 'if I receive'.
Offline
Sunrise-Moon wrote:
Ralphjos wrote:
This confuses me sometimes... Why place the variable at 0 if you're just going to broadcast it back to 1? I do see the target though, and I will probably use this in the future, just alternate it a little
![]()
Regards,
RalphjosNormally, you won't make a project that immediately broadcasts that- that script was only an example. In reality, you'd probably make something trigger a broadcast, which triggers the fake 'if I receive'.
And that *points to quote* makes more sence.
Regards,
Ralphjos
Offline
Good tip although I would name the variable something else cause it may confuse people. I refer to putting a sprite's scripting in a single block as "serial" and using multiple scripts as "parallel." The point is that the more parallel you go, the more you need triggers like these to make sure that everything gets done in order. Failure to do so will usually result in some of the weirdest errors you have ever seen, although that alone is often funny
ps..I have a tendency to avoid broadcasts if I can cause I heard they cause problems online, even though most of my stuff is for offline use lol.
Offline