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

#1 2010-07-20 03:14:23

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

'When I Receive' Made Easy!

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:
http://i821.photobucket.com/albums/zz140/Sunrisemoon/WhenIreceive.gif

Or:

Code:

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  smile

Last edited by Sunrise-Moon (2010-07-20 03:15:17)


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#2 2010-07-20 06:48:01

Dazachi
Retired Community Moderator
Registered: 2009-09-12
Posts: 1000+

Re: 'When I Receive' Made Easy!

Nice! Although it would still be nice to still have the <when I receive []> block/sensor because it is a bit complicated.


Dazachi, Retired Community Moderator
May also know me as OJACheung.

Offline

 

#3 2010-07-20 10:32:19

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: 'When I Receive' Made Easy!

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.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#4 2010-07-20 10:36:16

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: 'When I Receive' Made Easy!

I'm glad you made this. Lots of people want that block and don't know that they can do it this way.


http://i48.tinypic.com/2z5pqad.png

Offline

 

#5 2010-07-20 10:37:46

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: 'When I Receive' Made Easy!

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  smile .


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#6 2010-07-20 10:46:50

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: 'When I Receive' Made Easy!

Thank you. This will really help!


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#7 2010-07-20 10:48:46

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: 'When I Receive' Made Easy!

Ive already said this ages ago!


You can now reach me on Twitter @johnnydean1_

Offline

 

#8 2010-07-20 10:54:01

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: 'When I Receive' Made Easy!

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  smile

Last edited by Sunrise-Moon (2010-07-20 10:54:46)


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#9 2010-07-20 11:03:45

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: 'When I Receive' Made Easy!

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  tongue

Regards,
   Ralphjos


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#10 2010-07-20 11:06:51

melikecheese
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: 'When I Receive' Made Easy!

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.


http://i51.tinypic.com/987rb5.jpg
I am Dave! Yognaught.

Offline

 

#11 2010-07-20 11:10:46

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: 'When I Receive' Made Easy!

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  tongue

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'.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#12 2010-07-20 11:11:45

Ralphjos
Scratcher
Registered: 2009-10-10
Posts: 100+

Re: 'When I Receive' Made Easy!

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  tongue

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'.

And that *points to quote* makes more sence.  smile

Regards,
   Ralphjos


http://i33.tinypic.com/2dt3j9j.gif

Offline

 

#13 2010-07-20 11:37:23

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: 'When I Receive' Made Easy!

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  big_smile

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.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

Board footer