Discuss Scratch

eddieduck
Scratcher
22 posts

What is "run without screen refresh"?

i have never understood how it works, could someone tell me how?

define screen refresh 
?????

Last edited by eddieduck (Aug. 9, 2024 04:39:01)

Ranger_07
Scratcher
100+ posts

What is "run without screen refresh"?

Basically it makes it so that a script runs completely before the screen updates.
It's mostly used for repeat loops and such, as it cancels out their built-in wait time, meaning that you can make something like this complete it's loop instantly:
pen down
repeat (36)
move (10) steps
turn cw (10) degrees
end
pen up

Hopefully this helps
deck26
Scratcher
1000+ posts

What is "run without screen refresh"?

But the script does have to complete within one frame or it will lag horribly. So not forever loops are any kind of wait in a scvript run with no screen refresh.
kooqle
Scratcher
100+ posts

What is "run without screen refresh"?

deck26 wrote:

But the script does have to complete within one frame or it will lag horribly. So not forever loops are any kind of wait in a scvript run with no screen refresh.
If you want to use a forever loop, make a new ‘run without screen refresh’ block. Then, at the end of that block's code (stuff inside the loop), run the block again!
deck26
Scratcher
1000+ posts

What is "run without screen refresh"?

kooqle wrote:

deck26 wrote:

But the script does have to complete within one frame or it will lag horribly. So not forever loops are any kind of wait in a scvript run with no screen refresh.
If you want to use a forever loop, make a new ‘run without screen refresh’ block. Then, at the end of that block's code (stuff inside the loop), run the block again!
Better to put the forever loop outside the call of the custom block.
kooqle
Scratcher
100+ posts

What is "run without screen refresh"?

deck26 wrote:

kooqle wrote:

deck26 wrote:

But the script does have to complete within one frame or it will lag horribly. So not forever loops are any kind of wait in a scvript run with no screen refresh.
If you want to use a forever loop, make a new ‘run without screen refresh’ block. Then, at the end of that block's code (stuff inside the loop), run the block again!
Better to put the forever loop outside the call of the custom block.
I mean a bit like this:
define loop
run some code
loop
eddieduck
Scratcher
22 posts

What is "run without screen refresh"?

Ranger_07 wrote:

Basically it makes it so that a script runs completely before the screen updates.
It's mostly used for repeat loops and such, as it cancels out their built-in wait time, meaning that you can make something like this complete it's loop instantly:
pen down
repeat (36)
move (10) steps
turn cw (10) degrees
end
pen up

Hopefully this helps

so im assuming that running that will instantly make a circle?
eddieduck
Scratcher
22 posts

What is "run without screen refresh"?

kooqle wrote:

deck26 wrote:

kooqle wrote:

deck26 wrote:

But the script does have to complete within one frame or it will lag horribly. So not forever loops are any kind of wait in a scvript run with no screen refresh.
If you want to use a forever loop, make a new ‘run without screen refresh’ block. Then, at the end of that block's code (stuff inside the loop), run the block again!
Better to put the forever loop outside the call of the custom block.
I mean a bit like this:
define loop
run some code
loop

but what difference would that be that NOT running without screen refresh
Ranger_07
Scratcher
100+ posts

What is "run without screen refresh"?

eddieduck wrote:

so im assuming that running that will instantly make a circle?

Yes, given that it's run inside a “run without screen refresh” custom block.
Otherwise you'll get to see a bit of animation as the circle is drawn.

But feel free to try it out yourself!

Also, as a side note: just be aware that for the “run without screen refresh” to actually work, you can't just click on the block definition to run it, as that will ignore the special property; You need to instead run the actual custom block itself.
For visual demonstration:
define run without screen refresh test
// if you just click on this block definition, it won't run without screen refresh

run without screen refresh test //instead, you need to call the custom block function directly, with the special block it creates like this one
SpyCoderX
Scratcher
1000+ posts

What is "run without screen refresh"?

An example is this project: https://scratch.mit.edu/projects/566199302/

When you set “Slowdown” to 0 it uses a function which DOES run without screen refresh.
When you set “Slowdown” to 1 it uses a function which does NOT run without screen refresh.
(The mouse needs to be on the right side of the screen for the variable to be visible.)

Last edited by SpyCoderX (Aug. 10, 2024 02:16:57)

Popanauti
Scratcher
18 posts

What is "run without screen refresh"?

It makes so that a script runs instantly, by running all the blocks before the screen refreshes :>

For example, if you runned the code:
repeat (10)
move (10) steps
end
Without “run without screen refresh” ill do it normally and ill look like the sprite is walking
If you use “run without screen refresh” ill do it all instantly and ill just look as if the sprite had teleported

Just don’t put infinite loops inside a “run without screen refresh” block, cuz ill lag horribly

Powered by DjangoBB