Discuss Scratch

GameArchitect
New Scratcher
27 posts

Using a variable in the "When I Receive Broadcast" block

Psiborg wrote:

This is what I said about serialisation. If you are running loops within the receiver then you aren't likely to be using “broadcast and wait” and hence you will lose your serialisation and it won't work. Personally I only run the one loop so I won't hit issues like that - everything processes one tick at a time with countdown or cool down timers etc for things like jumping, shooting and other animated actions.
So wait, are you saying that “broadcast and wait” will prevent the script from being reset?
Psiborg
Scratcher
500+ posts

Using a variable in the "When I Receive Broadcast" block

GameArchitect wrote:

So wait, are you saying that “broadcast and wait” will prevent the script from being reset?
Only inasmuch as if that is the only place it broadcasts, then it can't call again until the other scripts have finished.
drmcw
Scratcher
1000+ posts

Using a variable in the "When I Receive Broadcast" block

If you have a single control loop and just use broadcast it will continue looping and firing broadcasts. Broadcast and wait will broadcast but then can block the main loop and won't continue it until all the when I receive scripts for that message have completed. You can use that to ensure all your scripts are serialised.

Edit: Psiborg already replied.

Last edited by drmcw (April 30, 2015 05:48:34)

deck26
Scratcher
1000+ posts

Using a variable in the "When I Receive Broadcast" block

I've tweaked my demo project. Note that it effectively saves the next command for a sprite to be done when the current command is completed (only one command can be saved per clone and it has to be different from the command being done). It wouldn't be that difficult though to give each clone a list fo commands!

So in my example the butterfly is told to flash and then move. That is all coded before the cat is told to move but the cat still moves while the butterfly is flashing.

I also switched to using words for the commands which will make code easier to follow than using numeric codes for different moves.

This idea looks promising to me!
GameArchitect
New Scratcher
27 posts

Using a variable in the "When I Receive Broadcast" block

deck26 wrote:

I've tweaked my demo project. Note that it effectively saves the next command for a sprite to be done when the current command is completed (only one command can be saved per clone and it has to be different from the command being done). It wouldn't be that difficult though to give each clone a list fo commands!

So in my example the butterfly is told to flash and then move. That is all coded before the cat is told to move but the cat still moves while the butterfly is flashing.

I also switched to using words for the commands which will make code easier to follow than using numeric codes for different moves.

This idea looks promising to me!
Sorry, I've been gone for a few days. That really works well! I really should use that to upgrade from my current work around.
Thanks for helping, that will do wonders.
PokemonBFFS16
Scratcher
13 posts

Using a variable in the "When I Receive Broadcast" block

oh do i post like this?
when green flag clicked
move (100000) steps
pen down
deck26
Scratcher
1000+ posts

Using a variable in the "When I Receive Broadcast" block

PokemonBFFS16 wrote:

oh do i post like this?
when green flag clicked
move (100000) steps
pen down
Please use the sticky topic at the top of the forum to practice with Scratch blocks. Or start your own topic when you have a question. What you've done here is considered necroposting and is frowned upon.
mayahorse
Scratcher
6 posts

Using a variable in the "When I Receive Broadcast" block

Do any of you guys know how to make a variable act as a
when I receive [ v]

block? if so please let me know!

Last edited by mayahorse (Sept. 28, 2017 10:28:39)

asivi
Scratcher
1000+ posts

Using a variable in the "When I Receive Broadcast" block

mayahorse wrote:

Do any of you guys know how to make a variable act as a
when I receive [ v]

block? if so please let me know!
Yes

set [ v] to []

//or

change [ v] by (0)

//and

<(var) = []>
<[] < []>
<[] > []>

Please next time do not revive old topics and create your own instead. Thanks.

Last edited by asivi (Sept. 28, 2017 11:44:58)

RholanT3344
Scratcher
62 posts

Using a variable in the "When I Receive Broadcast" block

It works with anything with a
[thing] input or (75129) input::custom
when I receive <(answer) contains [thing]::operators>
sathvikrias
Scratcher
500+ posts

Using a variable in the "When I Receive Broadcast" block

GameArchitect wrote:

The scratchblock didn't turn out as I had thought, hopefully this will do it xD (but maybe not)

broadcast (input)
when I receive (input)
here

Powered by DjangoBB