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

#1 2011-06-14 10:18:20

EvanX3000
Scratcher
Registered: 2011-04-16
Posts: 3

broadcasts

when i recieve a random broadcast i cant put it somewhere else in the program. only the beginning. [<when I receive]

Offline

 

#2 2011-06-14 11:14:05

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

Re: broadcasts

There are only "when I receive" hat blocks, which seems to be what you were referring to. That is the purpose of a broadcast, to start a new script when an event is raised. (When a broadcast is, well, broadcasted)

Last edited by Harakou (2011-06-14 11:15:19)


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

 

#3 2011-06-14 12:32:56

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: broadcasts

I assume that need to have a broadcast change something in a running script (like inside a forever loop) or cause a loop to stop running (something that is pretty common to want to do). 

One technique is to have the recieving broadcast change a variable.  Your script could start with:

"repeat until" <somevariable=0>
(do stuff)

Then your broadcast "listening" script would be:

"When I recieve" (some message)
Set (somevariable) = 0

This will stop the other script.  The action of the variable that you change, could, of course, do something inside the other script instead of stopping a repeat until loop.

Offline

 

#4 2011-06-14 12:46:21

CloneCommando1
Scratcher
Registered: 2010-12-02
Posts: 500+

Re: broadcasts

Because its curved on the top and has no, lets call it connectability, on the top. You can only add programming underneath the block like so.

[blocks]<when I receive[
<move( 10 )steps>[/blocks]
As you can see, nothing can be added above it, but you can add whatever you wish to add below the block.

Last edited by CloneCommando1 (2011-06-14 12:50:14)


RANDOM THOUGHT: If the tomato is a fruit, doesn't that make ketchup a smoothie?

Offline

 

Board footer