I made a "repeat for x seconds" block, but the time that I input doesn't seem to match the time that it runs for. It seems that the larger x is, the farther over x the timer goes. How can I fix this?
edit: forgot this - Snap! Build Your Own Blocks
I made a "repeat for x seconds" block, but the time that I input doesn't seem to match the time that it runs for. It seems that the larger x is, the farther over x the timer goes. How can I fix this?
edit: forgot this - Snap! Build Your Own Blocks
Sorry, I don't know how to fix it.
But for me, it seems to be working perfectly fine.
It probably is because the custom block is running one extra block in between the wait block, increasing the wait time ever so slightly.
Script for reference:

I'm talking about the "repeat for _ seconds" block. Isn't that from the "wait until _ for up to _ seconds" block?
Oh, sorry for my mistake.
Yeah, I see what you mean about that.
The main cause is still because the block has to run something after every time it waits.
I suggest you use
instead of ![]()
Edit: Nevermind, I just tested it. It doesn't work in practice.
Edit 2: I found a way.
You should probably use greater than or equal to rather than greater than, technically.
Here was my (nearly exactly the same) solution:
Explanation as to why the original definition doesn't work: Running the "event" variable takes however much time it takes to execute the code. So, if you had a wait block in there, your repeat for would fail even more badly. However, even the switch to costume takes time to execute.
This is identical to the block I made back in 2023 (aside from the different variable names)!
Also,
“even worse”?
I’m not entirely certain. I chose “even more badly” over “even worse” because “badly” is the adverb form of “bad”, and worse doesn’t have an adverb form. You would say “worse” instead of “more bad”, but it is unclear to me how to approach things when it is an adverb. I’m pretty sure that both work. Don’t quote me on this.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.