"Repeat for ___ secs" blocks

id: 20841

category: Suggestions

posts: 194

anguz110 anguz110 loading
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

jh1234l jh1234l loading
It can be worked around:
repeat until <(timer) = [?]>

move () steps
end
Or you can use a variable, if you have another spite that uses the timer.
cobraguy cobraguy loading
Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.

reset 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.

cobraguy wrote:

Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.

reset timer
repeat until <(timer) = [?]>
do stuff//category=grey
end

It's because the timer automatically starts on the launch of the program, and there is no way to stop it.
fixed xD

No support. Easy workaroud.
Repeat for a Set Amount of Time

The Scratch Wiki; made by Scratchers, for Scratchers
DevanWolf DevanWolf loading
repeat(1)secs::control cstart
RPFluffy RPFluffy loading

jh1234l wrote:

It can be worked around:
repeat until <(timer) = [?]>

move () steps
end
Or you can use a variable, if you have another spite that uses the timer.

cobraguy wrote:

Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.

reset 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.
No support.
If I have a script like
repeat for 10 seconds,
with a wait 11 seconds in it, what happens?

If I have a script like wait 10 seconds
with blocks inside of it,
what happens when the 10 seconds are up and it's in the middle of the scripts?
Will the rest of the scripts inside continue even though the 10 secs are up? Or will they stop and skip ahead of the repeat?
DevanWolf DevanWolf loading
repeat(1280)secs::control cstart
say(join[Bump #](timer))
MathlyCat MathlyCat loading

MegaApuTurkUltra wrote:

RPFluffy wrote:

jh1234l wrote:

It can be worked around:
repeat until <(timer) = [?]>

move () steps
end
Or you can use a variable, if you have another spite that uses the timer.

cobraguy wrote:

Adding on to @jh1234I's answer, you would want to reset the timer before using the repeat until block.

reset 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.
No support as per the workaround
^^^

DevanWolf wrote:

repeat(1280)secs::control cstart
say(join[Bump #](timer))

Dat necro man…. meh, suggestion forums r boss
P.S. DevanWolf, please don't troll by removing the [/scratchblocks] tag :\
DaSpudLord DaSpudLord loading
No support, except the workaround should probably look something like this instead-
reset timer
repeat until <<(timer) > []> or <(timer) = []>
...
end

scrooge200 wrote:

This sticky rejected it.
Is that sticky actually a “do not suggest” list now?

Still no support because the workaround is easy.

stickfiregames wrote:

scrooge200 wrote:

This sticky rejected it.
Is that sticky actually a “do not suggest” list now?
Well, kind of, but it's really just a list of commonly suggested block workarounds.

Anyway, no support, because of the simple workaround I listed in that link up there.
Pixar2000 Pixar2000 loading

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

I think that it can be made by -
define repeat (How much) for (time) secs
repeat (How much)
...::grey//Put anything here.
end
wait (time::custom-arg) secs
stop [this script v]
Austinato Austinato loading

jh1234l wrote:

It can be worked around:
repeat until <(timer) = [?]>

move () steps
end
Or you can use a variable, if you have another spite that uses the timer.
Another workaround:
when green flag clicked
repeat (x)
script
wait (1) secs
end
x is how many seconds you want it to wait, reflecting off of the “wait for 1 secs” at the end of the script.
Pixar2000 Pixar2000 loading
Not
<[] = []>
It would be
<[] > []>
anguz110 anguz110 loading
This thread should be dead.
Semi-Support cause of an easy workaround.
Pixar2000 Pixar2000 loading
How will he watch TV if he can't turn it on?
anguz110 anguz110 loading
Jfc this thread is almost 4 years old and it's been answered already, stop necrobumping

anguz110 wrote:

Jfc this thread is almost 4 years old and it's been answered already, stop necrobumping
You're allowed to post on old suggestions if they haven't been implemented or rejected.

Anyway this block is ambiguous. If the time runs out halfway through the loop, would it cut off immediately or carry on to the end of the loop? The first might be more expected but it means you can't guarantee that every block in the loop will run the same number of times. The second would be more like the repeat until block.
tali1665 tali1665 loading
Support!
repeat for (1) secs::control
Sorry, no support. ST wants to make Scratch learning, only the essentials. Not to make it really easy. Good idea, but any block that's not adding a new thing, just making it easier shouldn't be added.
Read the stickies. This has already been suggested, and already has a workaround. Now I suggest you close this topic
anguz110 anguz110 loading
This thread is, like, 3 years old.
_-Unity-_ _-Unity-_ loading

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

that's nice. sometimes we need to control our timing and this is what we need… Nice one!
cul8er cul8er loading

Auroura_Wolf wrote:

Read the stickies. This has already been suggested, and already has a workaround. Now I suggest you close this topic
???
Where has it already been suggested? Which sticky?
As mentioned, there's a workaround and some ambiguity as to how it would work.
No support.
Sheep_maker Sheep_maker loading

Auroura_Wolf wrote:

Read the stickies. This has already been suggested, and already has a workaround. Now I suggest you close this topic
This is the oldest repeat for _ secs block suggestion; this topic was probably posted on because their topic was closed for being a duplicate of this topic.
Pixar2000 Pixar2000 loading

_-Unity-_ wrote:

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

that's nice. sometimes we need to control our timing and this is what we need… Nice one!
No. More like this.
repeat for (1) secs{
}::control
No Support. What if you are putting a script it the repeat seconds block and that one script takes more time than the amount of seconds you want? And if it does complete and the seconds are up, will it repeat again? No, it would repeat only once, since those seconds are up, and the script is done. Besides, what would happen to the script while the seconds are gone? Will they continue, or stop?

However, here is a good workaround:

reset timer
repeat until <(timer) = (amount of seconds you want)>
... // Do Your Stuff Here
end
PkmnQ PkmnQ loading

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{
. . .
} :: control

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

Please give feedback

Fixed, and here's a workaround.
set [timer+ v] to ((timer) + (. . .))
repeat until <(timer) = (timer+)>
. . .
end
LionHeart70 LionHeart70 loading
Semi support.. But there's a workaround. I could use this for an animation, though.
FancyFoxy FancyFoxy loading
I'd say I'd support this, as I would've needed this block for my animations and I'd assume, my games.
I'd is my favorite word now
removed by me because at this time i was kinda dumb

Botcho_Otkho wrote:

Rejected from the sticky.
It isn't rejected. There is nothing in the sticky. It's just that this block is complicated.
walkcycle walkcycle loading

PkmnQ wrote:

Fixed, and here's a workaround.
set [timer+ v] to ((timer) + (. . .))
repeat until <(timer) = (timer+)>
. . .
end
That's a better workaround since the timer doesn't have to be reset.

Change the Boolean to

<(timer) > (timer+)> // greater than 

so the loop is exited for sure.
set [timer1 v] to ((timer) + (# of seconds))
repeat until <not <(timer) < (# of seconds)>>
...
end

What do you mean, exited? The timer doesn't have to be more than the amount of seconds otherwise it would repeat for the amount more than we want.
HappyMohid HappyMohid loading
repeat <[] < []>

end

in scratch wiki
No Support. It would cause problems, like this:

repeat for (2) seconds { 
wait (20) secs
} :: control
removed by ScatchDiogoh
Seam49 Seam49 loading
Support, the workaround hardly ever works, and putting wait 20 seconds won't run at all, plus, if the time runs out in the middle, It just will skip the last bits, or at the top, well skip the whole thing, why, there are no reliable workarounds,
SickBoi2000 SickBoi2000 loading
Support!
I saw the soultions but i would make a custom block out of it.
i support, would be useful in so many ways

the workaround is annoying and unreliable
No support, you are just making a seconds version of the repeat block, you can tell others to avoid turbo mode and you can set this:
... :: hat
repeat (() * (30))
...
end
...
Also, isn't this rejected?

SuperKamekArea wrote:

No support, you are just making a seconds version of the repeat block,
That's the point.

SuperKamekArea wrote:

you can set this:
... :: hat
repeat (() * (30))
...
end
...
That doesn't work.

SuperKamekArea wrote:

Also, isn't this rejected?
It isn't rejected.
I'm getting real sick and tired of people saying “No support, there's a workaround.” Very rarely does a block get removed because of a workaround. so rare in fact, that the only instance of a block getting removed because of a workaround that i am 100% sure happened is the forever if block. even then the extremely simple workaround wasn't the only factor, apparently users didn't understand it either. and because a block has a workaround DOESN'T mean it shouldn't be added. so if you could kindly read this, that'd be great.
Support!
I was about to suggest this! It would look like this:
repeat for (10) seconds { 

} ::control
And work like this:
set [time v] to (timer)
repeat until <(timer) > ((time) + [10])