(Event) Broadcast

Author Topic: (Event) Broadcast  (Read 975 times)

You know how in some scripting like scratch there are commands called "broadcast" which let you change a lot of things with just one click.

Ex.
(Button)
"When this sprite is clicked, broadcast this:"

(Sprite)
"When I receive this broadcast do this:"


onActivate -> [named brick] -> x

onActivate -> [named brick] -> x
The problem with this. I need different named bricks to do the same thing, but the game won't let me have 16 different onActivate's for each and every brick's function.

can you use relays for what you're doing? (named brick > fireRelay, use onRelay on the named brick to activate functionality) i feel like this kind of event might not necessarily be a good idea, tho i may not understand the behavior of a "broadcast" in this context

ya relays would be what you're looking for

Brick 1
onActivate » nb_BRICK 2 » fireRelay

Brick 2
onRelay » nb_BRICK 3 » fireRelay
onRelay » nb_BRICK 4 » fireRelay
onRelay » nb_BRICK 5 » fireRelay
onRelay » nb_BRICK n... » fireRelay

Brick 3, 4, 5, n...
onRelay » Self » [Whatever events you want to trigger]

Brick 1
onActivate » nb_BRICK 2 » fireRelay

Brick 2
onRelay » nb_BRICK 3 » fireRelay
onRelay » nb_BRICK 4 » fireRelay
onRelay » nb_BRICK 5 » fireRelay
onRelay » nb_BRICK n... » fireRelay

Brick 3, 4, 5, n...
onRelay » Self » [Whatever events you want to trigger]
why would you need brick one when you can just do self > relay

I guess this would work.
I'll try it out.
Thanks.

EDIT:
why would you need brick one when you can just do self > relay
I need all of them to do one function, so you don't have to click every button.
« Last Edit: January 11, 2017, 03:16:10 PM by Luigi609² »

why would you need brick one when you can just do self > relay
Because Brick 1 can be any event from any brick.  If you want a broadcast set to be triggered from one brick, then you can just use brick 2, but if you want it to be able to be triggered from multiple bricks, then having events on a Brick 2 allows you to trigger all of those events remotely using only one line from the brick that starts the relay chain.