Discuss Scratch

soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

anguz110 wrote:

I think there should be repeat blocks that don't repeat a given number of times, but for a given number of seconds.

How it works is, there's a repeat block like this:

repeat (for ___ seconds?)

end

Then you enter how many seconds you want it to repeat.

Please give feedback

This would look weird in the palate. This has a workaround.
reset timer
repeat until <(timer) > [amount v]>
Do something
end
cooldude-222
Scratcher
100+ posts

"Repeat for ___ secs" blocks

What if you need the timer for something
soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

cooldude-222 wrote:

What if you need the timer for something
NO IDEA
IDontNoWatIAm
Scratcher
500+ posts

"Repeat for ___ secs" blocks

cooldude-222 wrote:

What if you need the timer for something
Something like this?

when green flag clicked
broadcast [time v]
repeat until <(timer) > ((time) + (amount of seconds))> //time of activation added to amount of seconds
blocks
end

when I receive [time v] // saves timer time when the block is called on
set [time] to (timer)
M0LDYGH
Scratcher
9 posts

"Repeat for ___ secs" blocks

maybe
repeat for (2) secs
historical_supa
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

M0LDYGH wrote:

maybe
repeat for (2) secs
That is a stack block however.
soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

IDontNoWatIAm wrote:

cooldude-222 wrote:

What if you need the timer for something
Something like this?

when green flag clicked
broadcast [time v]
repeat until <(timer) > ((time) + (amount of seconds))> //time of activation added to amount of seconds
blocks
end

when I receive [time v] // saves timer time when the block is called on
set [time] to (timer)
GREAT IDEA!!!!
<(answer) = [Yes v]>
cooldude-222
Scratcher
100+ posts

"Repeat for ___ secs" blocks

IDontNoWatIAm wrote:

cooldude-222 wrote:

What if you need the timer for something
Something like this?

when green flag clicked
broadcast [time v]
repeat until <(timer) > ((time) + (amount of seconds))> //time of activation added to amount of seconds
blocks
end

when I receive [time v] // saves timer time when the block is called on
set [time] to (timer)
What if I need to constantly reset the timer for a stop button detector.
MrJJib
Scratcher
32 posts

"Repeat for ___ secs" blocks

I already made a forum for this
7salad3salad
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

MrJJib wrote:

I already made a forum for this
I guarantee this one was made before yours, and anyways this is off-topic
RubiksRocker
Scratcher
100+ posts

"Repeat for ___ secs" blocks

IDontNoWatIAm wrote:

cooldude-222 wrote:

What if you need the timer for something
Something like this?

when green flag clicked
broadcast [time v]
repeat until <(timer) > ((time) + (amount of seconds))> //time of activation added to amount of seconds
blocks
end

when I receive [time v] // saves timer time when the block is called on
set [time] to (timer)

You would need to reset the timer once it receives the message.
when I receive [time v]
reset timer
WhyDidlMakeThis
New Scratcher
3 posts

"Repeat for ___ secs" blocks

Pixar2000 wrote:

How will he watch TV if he can't turn it on?
Uh, what?
dertermenter_easy
Scratcher
58 posts

"Repeat for ___ secs" blocks

bump
saverofthewo
Scratcher
100+ posts

"Repeat for ___ secs" blocks

the workaround doesn't work, stop sign detector, or anything that utilizes the reset timer block will break it. please stop.
k0d3rrr
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

Bump. This is very useful for projects where you need to repeat something for a certain amount of seconds.
soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

M0LDYGH wrote:

maybe
repeat for (2) secs
Fixed mockup:
repeat for (2) secs {
} :: control

Last edited by soarroying (Oct. 15, 2022 15:16:24)

soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

mrcreatorluigi wrote:

Support. Why? Can you explain?
epicboi17
Scratcher
100+ posts

"Repeat for ___ secs" blocks

since scratch is 30 fps, you can just
repeat ((seconds) * (30))

end
Little_Mittle12345
Scratcher
100+ posts

"Repeat for ___ secs" blocks

when green flag clicked
repeat for (2) seconds{
glide (1) secs to [random position v]:: motion}:: control
Hmmmmm super hard workaround
soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

Little_Mittle12345 wrote:

This quote was eaten by an evil banana
Well? The workaround it easy, and you can put it in your backpack so you can use it everywhere.
when green flag clicked
set [v v] to [0] //I'm just using v as an example you can name it whatever you want
broadcast [loooop v]
time
When I receive [loooop v]
repeat until <(v)=(insert number here)> //Put the code inside and you're done!

end
define time
repeat until <(v)=(insert number here)>
wait (1) secs
change [v v] by (1)
end
set [v v] to [0]
Ok, maybe saying you could put it in your backpack was a fib sorry :(

Powered by DjangoBB