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

#1 2010-02-25 19:50:36

AmoebaMan
Scratcher
Registered: 2009-01-26
Posts: 500+

wait until I recieve block

i think a lot of other scratch users are wishing for this, so here it is.  it would be nice for the next version of scratch to feature a command block stating "wait until I recieve [signal]".  such a block would let us create scripts that pause until a trigger is set.


http://i942.photobucket.com/albums/ad269/RyanScathe/AmoebaMan.png

Offline

 

#2 2010-02-25 19:58:44

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: wait until I recieve block

Right now you can use a variable for this:

[blocks]<set{ VAR }to( 1
<repeat until><( <{ VAR }> <=> 0 )>
[stuff]
<end>[/blocks]


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#3 2010-03-18 11:29:22

hpotter134
Scratcher
Registered: 2010-02-21
Posts: 100+

Re: wait until I recieve block

AmoebaMan wrote:

I think a lot of other scratch users are wishing for this, so here it is:  It would be nice for the next version of scratch to feature a command block stating "wait until I receive [signal]".  such a block would let us create scripts that pause until a trigger is set.

I agree. It can be very tedious, making so many variables. It would also be helpful to have a
[blocks] <{ broadcast  }>[/blocks]  block, so you can make something like "Wait until a is broadcast":

[blocks]<wait until> <( a <=><{ broadcast  }>  )> [/blocks]
Or, you can have:
[blocks] <forever if><( a <=><{ broadcast  }>  )>
   <repeat until><( b <=><{ broadcast  }>  )>
   <move( 10 )steps>
  <end>
<end>[/blocks]

Last edited by hpotter134 (2010-03-18 11:30:30)


http://i45.tinypic.com/fxgtvc.png

Offline

 

#4 2010-03-20 16:39:12

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: wait until I recieve block

I don't know how many times I've had to type this, but it WON"T HAPPEN BECAUSE BROADCASTS AREN'T BOOLEAN.

Boolean means the answer is 0 or 1. All of the diamond-shaped blocks are boolean, <a = 1> is boolean because either a is equal to one or a is not equal to one, 1 being if it is equal and 0 being if it isn't.

Offline

 

#5 2010-03-21 13:38:47

MaxtheWeirdo
Scratcher
Registered: 2010-03-18
Posts: 500+

Re: wait until I recieve block

There is an easy way to do this:
[blocks] <wait until><( <{ var }> <=> 1 )> [/blocks]
That's the way I would do it, any way.


My website. Hall Crawler My Awesome OS
It's just marketing, guys! Nothing sinister!

Offline

 

#6 2010-03-21 14:07:03

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: wait until I recieve block

Then make a boolean that says '..... broadcasting?'


Check out my projects if you have a chance.

Offline

 

#7 2010-03-21 14:48:03

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: wait until I recieve block

climber59 wrote:

Then make a boolean that says '..... broadcasting?'

But broadcasts are instantaneous.

Offline

 

#8 2010-09-09 10:09:47

hpotter134
Scratcher
Registered: 2010-02-21
Posts: 100+

Re: wait until I recieve block

coolstuff wrote:

climber59 wrote:

Then make a boolean that says '..... broadcasting?'

But broadcasts are instantaneous.

coolstuff wrote:

I don't know how many times I've had to type this, but it WON"T HAPPEN BECAUSE BROADCASTS AREN'T BOOLEAN.

yikes
Sorry. I didn't think about this enough.

But would it be possible to have a "message" reporter block? That way we could have a
script that says:


[blocks]<wait until><(<{ message }>  <=> "a message")>[/blocks]

and the "message" block, like "answer", stays the same until another message is broadcast. Is this possible? Please explain, for I really don't know much about this. I just started learning Smalltalk and have a long way to go.  hmm


http://i45.tinypic.com/fxgtvc.png

Offline

 

#9 2010-09-09 15:43:00

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: wait until I recieve block

hpotter134 wrote:

coolstuff wrote:

climber59 wrote:

Then make a boolean that says '..... broadcasting?'

But broadcasts are instantaneous.

coolstuff wrote:

I don't know how many times I've had to type this, but it WON"T HAPPEN BECAUSE BROADCASTS AREN'T BOOLEAN.

yikes
Sorry. I didn't think about this enough.

But would it be possible to have a "message" reporter block? That way we could have a
script that says:


[blocks]<wait until><(<{ message }>  <=> "a message")>[/blocks]

and the "message" block, like "answer", stays the same until another message is broadcast. Is this possible? Please explain, for I really don't know much about this. I just started learning Smalltalk and have a long way to go.  hmm

Ah... Please excuse my answer from way back then - I was rather rude, wasn't I?

Regardless, I think it could happen: While an "I receive" message isn't boolean because broadcasts are instantaneous, "I have received" or "I am receiving" message will do just fine.

Offline

 

#10 2010-09-10 02:08:22

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: wait until I recieve block

how about
<{ last brodcasted }>


http://i.imgur.com/1QqnHxQ.png

Offline

 

#11 2010-09-10 09:30:54

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: wait until I recieve block

hpotter134 wrote:

yikes
Sorry. I didn't think about this enough.

But would it be possible to have a "message" reporter block? That way we could have a
script that says:


[blocks]<wait until><(<{ message }>  <=> "a message")>[/blocks]

and the "message" block, like "answer", stays the same until another message is broadcast. Is this possible? Please explain, for I really don't know much about this. I just started learning Smalltalk and have a long way to go.  hmm

Broadcasts don't really exist in any Smalltalk images, except for Scratch. They implimented this just fo it.  smile


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#12 2010-09-10 20:36:52

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

Re: wait until I recieve block

hpotter134 wrote:

coolstuff wrote:

climber59 wrote:

Then make a boolean that says '..... broadcasting?'

But broadcasts are instantaneous.

coolstuff wrote:

I don't know how many times I've had to type this, but it WON"T HAPPEN BECAUSE BROADCASTS AREN'T BOOLEAN.

yikes
Sorry. I didn't think about this enough.

But would it be possible to have a "message" reporter block? That way we could have a
script that says:


[blocks]<wait until><(<{ message }>  <=> "a message")>[/blocks]

and the "message" block, like "answer", stays the same until another message is broadcast. Is this possible? Please explain, for I really don't know much about this. I just started learning Smalltalk and have a long way to go.  hmm

I don't see why not. The only problem I see with this is that such a thing can be pretty easily implemented with variables.

Last edited by Harakou (2010-09-10 20:37:02)


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

 

#13 2011-01-25 20:32:07

hpotter134
Scratcher
Registered: 2010-02-21
Posts: 100+

Re: wait until I recieve block

This topic is rather old, so I doubt anyone cares, but I succeeded in finally making myself a "message" block that does what I suggested. It uses class variables, and accessing methods and stuff. I posted it here in the Advanced Topics section.

Then, instead of
http://img831.imageshack.us/img831/9531/waituntilireceivehellow.gif

I can do
http://img694.imageshack.us/img694/2252/waituntilmessagehellowo.gif

Last edited by hpotter134 (2011-01-25 20:34:50)


http://i45.tinypic.com/fxgtvc.png

Offline

 

Board footer