This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-06-05 11:15:48

rpfredlund
New Scratcher
Registered: 2011-06-05
Posts: 1

"OR" blocks for broadcasts

There should be an "OR" block that allows for multiple recievings of broadcasts. (   When I receive <broadcast or broadcast2 >   )   It would make the scripts a lot more organized, instead of duplicating everything for a single changed variable.

Offline

 

#2 2011-06-05 11:23:41

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: "OR" blocks for broadcasts

I see how this could be useful...
Rather than having two identical scripts that start on different broadcasts, you only need one.  smile

Offline

 

#3 2011-06-05 13:50:42

spuspu
Scratcher
Registered: 2011-02-10
Posts: 26

Re: "OR" blocks for broadcasts

I know how to broadcast one of two things, if that helps.  Here is an example.<when green flag clicked><broadcast[ <pick randon(1)to(2)> ]and wait c>

Offline

 

#4 2011-06-05 13:59:14

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: "OR" blocks for broadcasts

I could see how this could be useful, like if you had a broadcast script that needed to be carried out under two different circumstances, but there were other, separate actions for those same broadcasts.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2011-07-30 16:22:47

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: "OR" blocks for broadcasts

I know:
{When anything recived, save the broadcast in [variable dropdown] and run:}
or instead of the dropdown it could be an upvar like in BYOB


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#6 2011-07-30 16:28:09

ElectricSparx
Scratcher
Registered: 2008-02-16
Posts: 100+

Re: "OR" blocks for broadcasts

Don't they already have an OR block in the Operators category?


Lead Developer for Scratch Adventure

Offline

 

#7 2011-07-30 16:29:23

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: "OR" blocks for broadcasts

ElectricSparx wrote:

Don't they already have an OR block in the Operators category?

You can't put use it in a broadcast hat block, though.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#8 2011-07-30 16:36:31

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: "OR" blocks for broadcasts

You can easily reproduce the functionality of that block like this:

[blocks]
<when I receive[ action!
do stuff

<when I receive[ action2!
<broadcast[ action ]and wait c>

[/blocks]

Then you can use action! and action2! to achieve the same thing, without duplicating the code.

Offline

 

#9 2011-07-31 00:11:53

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: "OR" blocks for broadcasts

LS97 wrote:

You can easily reproduce the functionality of that block like this:

[blocks]
<when I receive[ action!
do stuff

<when I receive[ action2!
<broadcast[ action ]and wait c>

[/blocks]

Then you can use action! and action2! to achieve the same thing, without duplicating the code.

This is what I'm doing!

Offline

 

Board footer