Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make multiple custom blocks go at once?
- bullelk12
-
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
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!
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
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
-
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
-
56 posts
How to make multiple custom blocks go at once?
*blinks
Isn't it so simple?
Isn't it so simple?
Last edited by PrizmGames (April 23, 2015 07:56:49)
- GizzB
-
100+ posts
How to make multiple custom blocks go at once?
Or he could actually tick run without screen refresh *blinks
Isn't it so simple?
- GizzB
-
100+ posts
How to make multiple custom blocks go at once?
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 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
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!
- drmcw
-
1000+ posts
How to make multiple custom blocks go at once?
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.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 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
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!
- Psiborg
-
500+ posts
How to make multiple custom blocks go at once?
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. 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
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
-
100+ posts
How to make multiple custom blocks go at once?
Oh, I see. My mistakeNo 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. 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
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).
I didn't realize it was for a animation
Last edited by GizzB (April 23, 2015 09:34:38)
- blue_coder7
-
4 posts
How to make multiple custom blocks go at once?
Or you could use broadcasts (with one hat block doing custom block 1 and the other hat block doing custom block 2)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. 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
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).
- Discussion Forums
- » Help with Scripts
-
» How to make multiple custom blocks go at once?