Discuss Scratch

soarroying
Scratcher
500+ posts

"Repeat for ___ secs" blocks

removed–be polite

Last edited by spectre_specs (Oct. 14, 2023 22:20:29)


Generation 7: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
This is not part of my post! This is my signature. And mine has evil kumquat destroying scripts!
when <button [DO NOT PRESS v] pressed? :: extension hat
destruct all living evil kumquats :: pen
when [evil v] kumquat spotted :: events hat
press button [DO NOT PRESS v] :: extension
when [post v] :: events hat
forever
rotate camera to (wanted camera dir) :: extension
make good kumquats :: pen
broadcast [rotate v] and wait until <not <(wanted camera dir) = (old wanted camera dir)>> :: events
end
ᵔᴥᵔ :: sound boolean //This is Sally! She will protect me if my siggy is attacked by evil kumquats.
:3 :: custom reporter //This is Jake! He is a good kumquat that has an appetite of unconstructive posts.
;D :: sensing boolean //This is Marcus! He is a pancake that will rickroll you if you use the support convention.
ඞ :: extension reporter //This is crewposter! He attacks evil kumquat factories.

Had a bad day and want to cheer up? This might just do the trick.
Read this before suggesting.

^Credit to @7salad3salad for the banner.
ᚠᚮᛚᛚᚮᚡ ᛐᚮ ᛒᛂ ᚿᛁᛌᛂ
kennaminecraftz
Scratcher
63 posts

"Repeat for ___ secs" blocks

If you dont want to reset timer you could do this instead:
set [time executed] to (timer)
set [execute time] to [number in seconds]
repeat until <(timer) = ((time executed) + (execute time))>
...
end

Hi I'm Kenneth, you can call me kena for short. I'm interested in scratch and programming. I make games and animations sometimes.

Glad seeing you!
-Kenneth
mumu245
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

kennaminecraftz wrote:

(#182)
If you dont want to reset timer you could do this instead:
set [time executed] to (timer)
set [execute time] to [number in seconds]
repeat until <(timer) = ((time executed) + (execute time))>
...
end
If another script resets the timer this one will break.

select this text then press Ctrl+Shift+Down to read more
mumu245
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

kennaminecraftz wrote:

(#182)
If you dont want to reset timer you could do this instead:


set [time executed] to (timer)
set [execute time] to [number in seconds]
repeat until <not <(timer) < ((time executed) + (execute time))>>
. . .
end

Replace “=” with “not <” for better stability.

select this text then press Ctrl+Shift+Down to read more
medians
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

Bringing this topic up.

:D: 2.0 is 11 years old https://scratch.mit.edu/projects/1018259409/
Medians bamboozled by 3.0 (version 3.0): https://scratch.mit.edu/projects/979822351/
hi875230163394: You're similar to valve in that you both hate a certain number…
Scratch 0.x, 1.x, 2.x, 3.x and LogoBlocks Archives
Bamboozlement: https://scratch.mit.edu/studios/33739789
Years on internet: 15 (soon 16)
medians: Oh god not this utc - 12 thing again..
Fun_Cupcake_i81: What, were you expecting not to see the utc - 12 thing again? THE UTC - 12 THIGN ALWAYS RETURNS. ALWAYS.
medians: I knew it would happen. I was the one who started it last year.
Fun_Cupcake_i81: Well then if you didn't want it back maybe you need to time travel to last year and fix that

Oh wait if you could time travel I think we all know exactly when you would go-
user1: That picture is from 2.0. Now he’s at my house and is my pet.
user2: But this is medians we're talking about, so “from 2.0” can mean the same thing as “from five seconds ago”.

Detect Scratch version here
My other accounts: @selfexplanatory @modesties @chaircard @fireflyhero @dividendyield @colloids @radians @skeuamorphism @dihectogon @anglebisector @aau- @EditBlockColors @AdamantOrb @MoongeistBeam @festively @Ampharos_ @straightforwardness
i trolled redcat LOL





if you see this
{what method did you use::control hat
answer on profile ::motion
} ::operators
;
lgrov44
Scratcher
500+ posts

"Repeat for ___ secs" blocks

No support, very simple workaround.
when green flag clicked
wait (foo) secs
set [Temp v] to [1]
when green flag clicked
set [Temp v] to [0]
repeat until <(Temp) = [1]>
...
end

Last edited by lgrov44 (March 29, 2024 21:15:22)


lgrov44, an Australian Scratcher whose most famous for his follows, followed by his activity, especially on Discussion Forums, and his follower count. Is also a remix chainer and school student. Identifies as bisexual.

My top 3 favourite people:
1. @Higgies (deleted) - First Follower, Thank you so much! (Wish you could see this…)
2. @Dubstepv1 (Banned/Moved) - Remix Chainer
3. @GIitchInTheMatrix (Moved to @GlitchedThrough) - Many small things.
Still looking for one of my first followers who are still active.
Minoru07
Scratcher
76 posts

"Repeat for ___ secs" blocks

No support. The workaround is super simple. Because scratch runs at 30 frames per second, you can just use a normal repeat script and multiply the number of seconds you want it to run by 30.

define scratch
a website that exists
DangerPuppy10
Scratcher
500+ posts

"Repeat for ___ secs" blocks

VoltageGames wrote:

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?

I shall




















Workaround chart:

Malicondi
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

VoltageGames wrote:

No support.
If I have a script like
repeat for 10 seconds,
with a wait 11 seconds in it, what happens?
then it will repeat the wait 11 seconds once, as thats how much time was allowed.

VoltageGames wrote:

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?
The exact same thing will happen as what happens with repeat until blocks, once the input is met, the loop stops. If the loop stops in the middle of a script, then the rest of the loop will finish and just not start again.

post #1000 post #100 i help in the forums post #1 post #500 0 second ninja
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.

coming soon :)


Unithlees3
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

This is literally how easy the workaround is:
set [timer v] to (x)
broadcast (start timer v)
repeat until <(timer :: variables) = (0)>

end

when I receive [start timer v]
repeat until <(timer :: variables) = (0)>
change [timer v] by (-1)
wait (1) secs
end
This is very easy to do; therefore using a block for it is unnecessary.

Edit: I've just realised I've done a post about a different workaround like a year ago. But it really doesn't matter. This one doesn't use the timer.

Last edited by Unithlees3 (March 31, 2024 08:38:45)


this is a signature, it goes beneath my posts and a link here isn't considered advertising

meh youtube channel is here
thunderclwd
Scratcher
11 posts

"Repeat for ___ secs" blocks

Support.

Unithlees3 wrote:

This is literally how easy the workaround is:
set [timer v] to (x)
broadcast (start timer v)
repeat until <(timer :: variables) = (0)>

end

when I receive [start timer v]
repeat until <(timer :: variables) = (0)>
change [timer v] by (-1)
wait (1) secs
end
This is very easy to do; therefore using a block for it is unnecessary.

Edit: I've just realised I've done a post about a different workaround like a year ago. But it really doesn't matter. This one doesn't use the timer.
While you are correct that that would work as a workaround it is counter-intuitive and making this block would help make it simple for new scratchers, as well as decreasing the amount of blocks and therefore the lag (Slightly, not by much, but slightly). Also, I'd like to point out that you'd need o make a new variable for each script you're running simultaneously.
Therefore, for all these reasons, I think that this block should be in scratch.
thunderclwd
Scratcher
11 posts

"Repeat for ___ secs" blocks

SavetheAtlantic wrote:

Little_Mittle12345 wrote:

Stop No support easy workaround. its a HARD WORKAROUND. forever block has a workaround. Can you remove it? or many blocks?
It's nothing. And just because some blocks have an easy workaround doesn't mean that we should remove them, or that we should add more blocks with easy workarounds. With that justification, you could suggest ridiculous blocks like these:
play sound [ v] and then go to x: () y: () ::sound
broadcast [ v] until [var v] = () ::events
You get the point.
I think new scratchers can understand
play sound [ v]
go to x: () y: (0)
But I doubt New scratcher can understand these workarounds as easily as they could understand that or just the “Repeat for (x) seconds” block.
Unithlees3
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

thunderclwd wrote:

-snip-
While you are correct that that would work as a workaround it is counter-intuitive and making this block would help make it simple for new scratchers, as well as decreasing the amount of blocks and therefore the lag (Slightly, not by much, but slightly). Also, I'd like to point out that you'd need o make a new variable for each script you're running simultaneously.
Therefore, for all these reasons, I think that this block should be in scratch.
The workaround is not hard really. New scratchers can adapt to it.
Putting extra blocks doesn't make noticeable lag
You can make a list to convey every timer if you don't want to waste variables. Like this:

set [script id v] to (y)
repeat (script id)
wait (0) secs // Optional – for better manipulation of timer adding
end
add (x) to [timers v]
repeat until <(item (script id) of [timers v] :: list) = (0)> // "script id" referring to the id of the script. Set it to the placement of the timer of the list
if <(x) = (item (script id) of [timers v])> then
broadcast (timer v)
end

end
replace item (script id) of [timers v] with () // Or just delete the item entirely if this is the only script utilising this
when I receive [timer v]
repeat until <(x) = (0)>
wait (1) secs
change [x v] by (-1)
Perhaps backpack it for later use.

Last edited by Unithlees3 (April 13, 2024 05:29:13)


this is a signature, it goes beneath my posts and a link here isn't considered advertising

meh youtube channel is here
TheEpikGamer211
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

workaround.
repeat (12)
...
wait (1) secs
end

Epik gamer 211. Proud inventor of GTTSTES.
im workng on
sc (then SBOX)
GTTSTES 1.3
when (::ff0000) horribly misclicked and pressed @greenFlag instead.:: hat :: events 
Summon Evil Kumquats using (((((((((((((:D):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion):: motion :: motion)
lapisi
Scratcher
1000+ posts

"Repeat for ___ secs" blocks

TheEpikGamer211 wrote:

(#194)
workaround.
repeat (12)
...
wait (1) secs
end
that just runs the script and then waits a second before doing it again

I swear if one more person comments “carrot” on my profile I'll-

don't forget

by the way MagicCoder330 is hosting a social experiment, I'm curious to see where it goes, please comment on it I want to see what the next phase is

why are humans so meaty?

Powered by DjangoBB