Discuss Scratch

bullelk12
Scratcher
100+ posts

How to make multiple custom blocks go at once?

So I'm making a project that requires two individual Custom Blocks to run.

The First causes the sprite to constantly wander back and forth.

The Second causes the sprite to constantly jump up and down. (Well, both are more complicated, but just as an example I'll use these)

Neither of these blocks are set to No Refresh. They are normal.
The problem is that when I run this code

defineblahdefineblahnumber2

Only the first one goes while the other waits. It waits because the first block isn't finished running. But I can't figure out a decent way to have both run simultaneously. And no, I can't stuff it into a single block because I want to use the first block by itself in other areas.

Thanks!
Birdlegs
Scratcher
1000+ posts

How to make multiple custom blocks go at once?

Well, a third block would be good to merge them both–a blah 1&2 block. Or you could just have them both run in different scripts. A broadcast or something might be good to get them running :3
PrizmGames
Scratcher
56 posts

How to make multiple custom blocks go at once?

*blinks

Isn't it so simple?
whenclickedblahwhenclickedblahnumber2

Last edited by PrizmGames (April 23, 2015 07:56:49)

GizzB
Scratcher
100+ posts

How to make multiple custom blocks go at once?

PrizmGames wrote:

*blinks

Isn't it so simple?
whenclickedblahwhenclickedblahnumber2
Or he could actually tick run without screen refresh
GizzB
Scratcher
100+ posts

How to make multiple custom blocks go at once?

bullelk12 wrote:

So I'm making a project that requires two individual Custom Blocks to run.

The First causes the sprite to constantly wander back and forth.

The Second causes the sprite to constantly jump up and down. (Well, both are more complicated, but just as an example I'll use these)

Neither of these blocks are set to No Refresh. They are normal.
The problem is that when I run this code

defineblahdefineblahnumber2

Only the first one goes while the other waits. It waits because the first block isn't finished running. But I can't figure out a decent way to have both run simultaneously. And no, I can't stuff it into a single block because I want to use the first block by itself in other areas.

Thanks!
I'd suggest ticking the screen refresh. It should do what your looking for, if you open the custom blocks tab and right click the block, open advanced dropdown and tick run without screen refresh
drmcw
Scratcher
1000+ posts

How to make multiple custom blocks go at once?

GizzB wrote:

bullelk12 wrote:

So I'm making a project that requires two individual Custom Blocks to run.

The First causes the sprite to constantly wander back and forth.

The Second causes the sprite to constantly jump up and down. (Well, both are more complicated, but just as an example I'll use these)

Neither of these blocks are set to No Refresh. They are normal.
The problem is that when I run this code

defineblahdefineblahnumber2

Only the first one goes while the other waits. It waits because the first block isn't finished running. But I can't figure out a decent way to have both run simultaneously. And no, I can't stuff it into a single block because I want to use the first block by itself in other areas.

Thanks!
I'd suggest ticking the screen refresh. It should do what your looking for, if you open the custom blocks tab and right click the block, open advanced dropdown and tick run without screen refresh
Run without screen refresh will not be the solution, and would more likely hang the computer if used, as I guess they contain forever loops so never return. The solution is to have the blocks called by different scripts like PrizmGames has shown.
Psiborg
Scratcher
500+ posts

How to make multiple custom blocks go at once?

GizzB wrote:

I'd suggest ticking the screen refresh. It should do what your looking for, if you open the custom blocks tab and right click the block, open advanced dropdown and tick run without screen refresh
No it wouldn't. He is trying to do two different animations presumably with loops in each custom block. Checking the “without refresh” would mean you don't see the animation.

As already stated, the most simple solution is using separate green flag hats (though I suspect this will not fit in with the rest of the project), so broadcasts could be used as JoeyTheChicken advised. The best practice solution would probably be to run each frame/tick from a single loop (though this is the most work).
GizzB
Scratcher
100+ posts

How to make multiple custom blocks go at once?

Psiborg wrote:

GizzB wrote:

I'd suggest ticking the screen refresh. It should do what your looking for, if you open the custom blocks tab and right click the block, open advanced dropdown and tick run without screen refresh
No it wouldn't. He is trying to do two different animations presumably with loops in each custom block. Checking the “without refresh” would mean you don't see the animation.

As already stated, the most simple solution is using separate green flag hats (though I suspect this will not fit in with the rest of the project), so broadcasts could be used as JoeyTheChicken advised. The best practice solution would probably be to run each frame/tick from a single loop (though this is the most work).
Oh, I see. My mistake
I didn't realize it was for a animation

Last edited by GizzB (April 23, 2015 09:34:38)

blue_coder7
Scratcher
4 posts

How to make multiple custom blocks go at once?

Psiborg wrote:

GizzB wrote:

I'd suggest ticking the screen refresh. It should do what your looking for, if you open the custom blocks tab and right click the block, open advanced dropdown and tick run without screen refresh
No it wouldn't. He is trying to do two different animations presumably with loops in each custom block. Checking the “without refresh” would mean you don't see the animation.

As already stated, the most simple solution is using separate green flag hats (though I suspect this will not fit in with the rest of the project), so broadcasts could be used as JoeyTheChicken advised. The best practice solution would probably be to run each frame/tick from a single loop (though this is the most work).
Or you could use broadcasts (with one hat block doing custom block 1 and the other hat block doing custom block 2)

Powered by DjangoBB