Discuss Scratch
- Discussion Forums
- » Suggestions
- » Repeat ( ) seconds
- ThePelicanBird
-
Scratcher
24 posts
Repeat ( ) seconds
That the action inside repeat for ( ) seconds! That would be cool!
- Zekrom01
-
Scratcher
1000+ posts
Repeat ( ) seconds
...No support, use that
reset timer
repeat until <(timer) > (how many seconds you want it to repeat for)>
...
end
...
Last edited by Zekrom01 (Feb. 19, 2016 20:48:53)
- gdpr533f604550b2f20900645890
-
Scratcher
1000+ posts
Repeat ( ) seconds
Change the = to a >. This is a common programming trap; the condition is only checked before the next iteration begins, not during the entire loop, so unless the iteration ends at exactly the time, the loop will run forever!...No support, use that
reset timer
repeat until <(timer) = (how many seconds you want it to repeat for)>
...
end
...
- Zekrom01
-
Scratcher
1000+ posts
Repeat ( ) seconds
OhChange the = to a >. This is a common programming trap; the condition is only checked before the next iteration begins, not during the entire loop, so unless the iteration ends at exactly the time, the loop will run forever!...No support, use that
reset timer
repeat until <(timer) = (how many seconds you want it to repeat for)>
...
end
...
Last edited by Zekrom01 (Feb. 19, 2016 20:48:58)
- DaSpudLord
-
Scratcher
1000+ posts
Repeat ( ) seconds
Yeah. And what if you are using the timer? I semi-support as per the workaround.Change the = to a >. This is a common programming trap; the condition is only checked before the next iteration begins, not during the entire loop, so unless the iteration ends at exactly the time, the loop will run forever!...No support, use that
reset timer
repeat until <(timer) = (how many seconds you want it to repeat for)>
...
end
...
- alexphan
-
Scratcher
1000+ posts
Repeat ( ) seconds
And what if you are using the timer?
set [mytimer v] to ((timer) + (amount of time wanted))
repeat until <(timer) > (mytimer>
...
end
You can use this workaround if the timer is being used elsewhere.
Last edited by alexphan (Feb. 19, 2016 22:18:53)
- ThePelicanBird
-
Scratcher
24 posts
Repeat ( ) seconds
I get those things, but do you think that it will be cool that scratxh has that kind of block?
- alexphan
-
Scratcher
1000+ posts
Repeat ( ) seconds
I get those things, but do you think that it will be cool that scratxh has that kind of block?
It would, but you can already kind of make the block with the things we have now

- Vienradze
-
Scratcher
500+ posts
Repeat ( ) seconds
I get those things, but do you think that it will be cool that scratxh has that kind of block?Yes
- Sheep_tester
-
Scratcher
500+ posts
Repeat ( ) seconds
repeat (1) secs::control cstartHow would this behave?
wait (2) secs
end
I'm assuming once 1 second has passed, the script will stop doing whatever it is doing and go on past the loop. In that case,
when green flag clickedWarning: I haven't tested this so please notify me if it happens to not work.
set [mode v] to (0)
broadcast [repeat secs v] and wait
when I receive [repeat secs v]
if <(mode)=[0]>
set [t v] to (((days since 2000)*(86400))+(seconds::grey))
wait until <((days since 2000)*(86400))>(t)>
set [mode v] to [1]
broadcast [repeat secs v]
end
when I receive [repeat secs v]
if <(mode)=[0]>
forever
...
end
end
- ThePelicanBird
-
Scratcher
24 posts
Repeat ( ) seconds
I Think that in that kind of actions, it automaticly stops!
So useful!
If () and () and () and () and () and () and () and () and () and () and () and () and () and () and () and () = ()
So useful!
Last edited by ThePelicanBird (Feb. 20, 2016 19:06:44)
- Sheep_tester
-
Scratcher
500+ posts
Repeat ( ) seconds
So was I right? (I meant that the wait block would only operate for 1 second and then the loop would stop its scripts)Yeah, but in that kind of actions, it ends while the typed seconds have passed!repeat (1) secs::control cstartHow would this behave?
wait (2) secs
end
I'm assuming once 1 second has passed, the script will stop doing whatever it is doing and go on past the loop.when i rekt someone
say [Get rekt]
show (shades)
change [Guys rekt] by (1)
oh and don't blockspam
- ThePelicanBird
-
Scratcher
24 posts
Repeat ( ) seconds
when I receive [Rekt]
play all sound in the group [MLG]
say something from the group [MLG Words]
do a dramatic exit
Last edited by ThePelicanBird (Feb. 20, 2016 19:12:26)
- asivi
-
Scratcher
1000+ posts
Repeat ( ) seconds
This might be a workaround
Edit:
Sorry, i had not noticed this
set (secs to repeat) to ((timer) + (0)) // where says 0 put the seconds to repeat
repeat until <(timer) > (secs to repeat)>
end
Edit:
Sorry, i had not noticed this
Greets.And what if you are using the timer?set [mytimer v] to ((timer) + (amount of time wanted))
repeat until <(timer) > (mytimer>
...
end
You can use this workaround if the timer is being used elsewhere.
Last edited by asivi (Feb. 20, 2016 21:06:56)
- Sheep_tester
-
Scratcher
500+ posts
Repeat ( ) seconds
Issues:And what if you are using the timer?set [mytimer v] to ((timer) + (amount of time wanted))
repeat until <(timer) > (mytimer>
...
end
You can use this workaround if the timer is being used elsewhere.
1) And what if you are constantly resetting the timer to detect the stop button?
2) And what if the script inside takes longer than the loop is supposed to run? It's supposed to stop, by the way:
I Think that in that kind of actions, it automaticly stops!
- DaSpudLord
-
Scratcher
1000+ posts
Repeat ( ) seconds
I thought it would be like the repeat until <> block, where every time it finished doing what was inside of the c loop, it would check the condition (in this case, the condition being whether the required amount of time has passed), and then decide whether to repeat the loop or continue onward. Like the repeat until <> block, the loop would not stop halfway.repeat (1) secs::control cstartHow would this behave?
wait (2) secs
end
I'm assuming once 1 second has passed, the script will stop doing whatever it is doing and go on past the loop.
- ThePelicanBird
-
Scratcher
24 posts
Repeat ( ) seconds
I thought it would be like the repeat until <> block, where every time it finished doing what was inside of the c loop, it would check the condition (in this case, the condition being whether the required amount of time has passed), and then decide whether to repeat the loop or continue onward. Like the repeat until <> block, the loop would not stop halfway.repeat (1) secs::control cstartHow would this behave?
wait (2) secs
end
I'm assuming once 1 second has passed, the script will stop doing whatever it is doing and go on past the loop.
Yeah, that would be cool!
when green flag clicked
move (Banana!) steps
- Zekrom01
-
Scratcher
1000+ posts
Repeat ( ) seconds
Deleted
Last edited by Zekrom01 (Feb. 24, 2016 00:56:53)
- pvz_pro
-
Scratcher
500+ posts
Repeat ( ) seconds
no support
reset timer
repeat until <(timer)>(seconds::grey)>
end
- Paddle2See
-
Scratch Team
1000+ posts
Repeat ( ) seconds
It looks like this is a duplicate topic of this one over here so I'll close it to keep the conversation all in one place.
Please use the existing topic in the link above.
Please use the existing topic in the link above.
- Discussion Forums
- » Suggestions
-
» Repeat ( ) seconds









