Discuss Scratch

Tommy200721
Scratcher
1 post

How do I use "When I Receive" blocks?

I need help using those blocks so please help me!
asivi
Scratcher
1000+ posts

How do I use "When I Receive" blocks?

I hope that some scratcher make some reliable and detailed tutorial project about broadcast and its applications.
In the meanwhile:
https://wiki.scratch.mit.edu/wiki/Broadcast

footsocktoe
Scratcher
1000+ posts

How do I use "When I Receive" blocks?

Tommy200721 wrote:

I need help using those blocks so please help me!

All the hat blocks are the same. They start a script.

Some ways to start a script…

green flag
key press
broadcast message
click on sprite
backdrop switches

When I receive starts the script when a sprite sends that message

Last edited by footsocktoe (June 17, 2017 02:43:50)

WeirdoStary12IsBack
Scratcher
7 posts

How do I use "When I Receive" blocks?

first do “Brodcast Message 1” Then Click on another sprite Then pu the When i recive block



Example:
whenthisspriteclickedscratchblocksbroadcast/scratchblocksAndscratchblockswhenIreceive/scratchblocksscratchblocksplaysound auntildone
enigmaworks
Scratcher
24 posts

How do I use "When I Receive" blocks?

The hat when I receive {message} is activated when a sprite, clone, or even the backdrop(itself or another in the project) broadcasts the message selected.

For example, something in the project could broadcast the message “Next Slide” when the space key is clicked, or “RickRoll” you when it is clicked, like this:
whenspacekeypressedbroadcastNext SlidewhenthisspriteclickedbroadcastRickRoll

Then something else(sprite, clone or the backdrop) could receive those messages and change the Slide Variable, or rick roll you.
whenIreceiveNext SlidechangeSlideby1whenIreceiveRickRollsayNever Gonna Give You Up....

Since the are different messages, they will only activate when I receive{message} hats with the correct message selected, when it is broadcasted. The hat can also be used multiple times to do different things at the broadcast of the same message, for example also playing a dance animation and music when it is rickrolling you.

Last edited by enigmaworks (Jan. 24, 2021 15:58:07)

Carsvroomboi
Scratcher
20 posts

How do I use "When I Receive" blocks?

The message blocks are to transfer code across sprites.
SpectrumPenguin
New Scratcher
46 posts

How do I use "When I Receive" blocks?

If you wanna use the “When I receive ()” block, please go to the Events

whenIreceivemessage1
BionicBoy554
Scratcher
1000+ posts

How do I use "When I Receive" blocks?

Broadcasts and “when I receive” blocks are basically just throwing stuff across sprites.
kinosaurs515
Scratcher
1000+ posts

How do I use "When I Receive" blocks?

The broadcast block

broadcastsomething

connects to the “When I Recieve” block.

whenIreceivesomethingDosomething

I hope this helps!
kexy321
Scratcher
45 posts

How do I use "When I Receive" blocks?

The “When I Receive” block is like a type of function that is global to the entire project. So you can use them. Here's an example:

From a sprite:

whenclickedbroadcastFoo

From another sprite:

whenIreceiveFoosayThis was a test!

The broadcast block executes the receive block that contains “Foo”

Also, one thing that broadcast and receive blocks do is that they can create multiple threads. And they also do not prevent a yield from happening. (Prevent a stop in the code from happening.)

If you wanted to stop code when a broadcast happens, simply use a “Broadcast and Wait” block

broadcastFooandwait

Let's add a broadcast and then a “Ask and Wait” block

whenclickedbroadcastFooaskHello! How are you today?andwait

The broadcast will not stop the script on it's place. It continues it.
Also, clones that contain the “When I Receive” block will also be executed. So make sure to take note of that.
I hope it taught you about broadcasts and receive blocks!

Last edited by kexy321 (March 27, 2022 05:32:41)

Powered by DjangoBB