Discuss Scratch
- Discussion Forums
- » Suggestions
- » "Repeat for ___ secs" blocks
- michaeljackson1365
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
no support: there are a bunch of ways to work around this suggestion
- Toodchop
-
Scratcher
100+ posts
"Repeat for ___ secs" blocks
Semi-Support: It can be useful, but there's an easy workaround for it.
reset timer
repeat until <(timer) = []>
end
Last edited by Toodchop (Aug. 2, 2025 13:50:44)
- jeffnp
-
Scratcher
100+ posts
"Repeat for ___ secs" blocks
Scratch runs at 30 fps, so couldn't you just do
repeat ((seconds) * (30))
end
- Haycat2009
-
Scratcher
500+ posts
"Repeat for ___ secs" blocks
You mentioned that there are many workarounds. But there is only one timer. SO if a project needs more than one of these, its in trouble.
- cookedasparagus8
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
You can make multiple timers.
when green flag clicked
set [Initial Time v] to (days since 2000 :: sensing)
forever {
set [Timer2 v] to ((days since 2000 :: sensing) - (Inital Time :: variables) :: operators)
} @loopArrow :: control cap
- Haycat2009
-
Scratcher
500+ posts
"Repeat for ___ secs" blocks
Support. The workaround is easy, but reseting the timer interferes with other parts of the project that may require it.
- cookedasparagus8
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
Support. The workaround is easy, but reseting the timer interferes with other parts of the project that may require it.Did you not read the post above you? Can't be talking lol
You can make multiple timers.when green flag clicked
set [Initial Time v] to (days since 2000 :: sensing)
forever {
set [Timer2 v] to ((days since 2000 :: sensing) - (Inital Time :: variables) :: operators)
} @loopArrow :: control cap
- _Paymer
-
Scratcher
500+ posts
"Repeat for ___ secs" blocks
No support, not much purpose and easy to workaround
- CodeComet6161
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
No support, not much purpose and easy to workaround
repeat for [] secs{
broadcast [message1 v]
}@loopArrow::controlVery useful.And having an easy workaround is not a reason to not support it.
SourceIf you want to use this block right now, literally just search up hacked blocks. Also, this can be easily recreated with a variable and a repeat control block. Mixed support (this isn't a necropost, as it has not officially been implemented.)With that reasoning, we should remove theforeverblock, we just use
endrepeat ((1) / (0))
end
- _nix
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
Watch out, though! That script actually usually won't work. The “broadcast” block doesn't actually take any time, so it's going to keep sending out the broadcast OVER AND OVER, with only one frame in between. That means whoever receives the message (the “when I receive” blocks) will end up RESTARTING over and over, because that's what happens when you receive a broadcast-message that's you're already busy processing.No support, not much purpose and easy to workaroundrepeat for [] secs{Very useful.
broadcast [message1 v]
}@loopArrow::control
And having an easy workaround is not a reason to not support it.
You need to do this instead:
repeat for () seconds {
broadcast [message1 v] and wait
} :: control loopBut then you have the same questions as usual. What happens if you “repeat for 3 seconds” but the receiving script takes longer than 3 seconds? Does the “repeat for…” block immediately quit out, but permit corresponding “when I receive” to keep doing their own thing, on their own time? Or should it cancel out those “when I receive” scripts, too?
- purplebunny63
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.reset timer
repeat until <(timer) = [?]>
…
end
It's because the timer automatically starts on the launch of the program, and there is no way to stop it.
- G
- O
- O
- D
-
- I
- D
- E
- A
- _Coolguy123_
-
Scratcher
12 posts
"Repeat for ___ secs" blocks
Support. The workaround is easy, but reseting the timer interferes with other parts of the project that may require it.I agree. Support for the exact same reason.
- KoelDaBird
-
Scratcher
3 posts
"Repeat for ___ secs" blocks
Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.It won't work if there is a sprite using the forever reset timer blockreset timer
repeat until <(timer) = [?]>
do stuff
end
It's because the timer automatically starts on the launch of the program, and there is no way to stop it.
#217Today 02:05:23
- skansgames
-
Scratcher
2 posts
"Repeat for ___ secs" blocks
Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.Actually, there is NO way to work around itreset timer
repeat until <(timer) = [?]>
do stuff
end
It's because the timer automatically starts on the launch of the program, and there is no way to stop it.
The repeat until block only checks the condition at the end of the script. If you still believe in your work around, try this in Scratch
reset timerIf the work around works, it should end after 5 seconds
repeat until <(timer) = [5]>
wait (6) secs
end
I totally support this:
repeat for () seconds
end
#218Today 14:48:34
- NutOfCoco
-
Scratcher
100+ posts
"Repeat for ___ secs" blocks
This would be a really weird block though. It would be unreliable because the framerate isn't always 30, so many applications of a repeat block can't be used. The only good use I could think of for this block is FPS tracker, but other ways I feel are much better.
#219Today 15:22:43
- purplebunny63
-
Scratcher
1000+ posts
"Repeat for ___ secs" blocks
Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.Actually, there is NO way to work around itreset timer
repeat until <(timer) = [?]>
do stuff
end
It's because the timer automatically starts on the launch of the program, and there is no way to stop it.
The repeat until block only checks the condition at the end of the script. If you still believe in your work around, try this in Scratchreset timerIf the work around works, it should end after 5 seconds
repeat until <(timer) = [5]>
wait (6) secs
end
I totally support this:repeat for () seconds {
}::control
- Discussion Forums
- » Suggestions
-
» "Repeat for ___ secs" blocks