Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Crazy Fast Variable Incrementing
- theresa111
-
Scratcher
28 posts
Crazy Fast Variable Incrementing
Hi there,
I've been working on a project lately in TurboWarp and ran into a weird issue; I was incrementing a variable by 1 in a forever loop, and all of the sudden the variable starting increasing by crazy, going up by thousands per second. I tried running the same project/code in normal Scratch, but got the exact same result
Scratch runs at 30fps, so how is this even possible? Why are variables the only thing running at hyper speed? And why has this problem never occurred before, even in other parts of the same project where I increment variables?
Thanks in advance for any insight
I've been working on a project lately in TurboWarp and ran into a weird issue; I was incrementing a variable by 1 in a forever loop, and all of the sudden the variable starting increasing by crazy, going up by thousands per second. I tried running the same project/code in normal Scratch, but got the exact same result
Scratch runs at 30fps, so how is this even possible? Why are variables the only thing running at hyper speed? And why has this problem never occurred before, even in other parts of the same project where I increment variables?
Thanks in advance for any insight
- kuswerdz
-
Scratcher
100+ posts
Crazy Fast Variable Incrementing
The most likely answer is that the loop is running multiple times at once. Can you share/link the project?
- NMario84
-
Scratcher
1000+ posts
Crazy Fast Variable Incrementing
If the only thing active is running a variable change, then it will go even faster than intended. So I would suggest putting in some movement block, or perhaps a show block inside that forever loop to help make the framerate of your project back to 30 FPS.
So for example, if your script looks like this, it will go insanely fast.
What you NEED to do is do something like this:
So for example, if your script looks like this, it will go insanely fast.
when green flag clicked
set [variable v] to (0)
forever
change [variable v] by (1)
end
What you NEED to do is do something like this:
when green flag clicked
set [variable v] to (0)
forever
change [variable v] by (1)
show
end
Last edited by NMario84 (Nov. 23, 2025 21:57:31)
- 10goto10
-
Scratcher
1000+ posts
Crazy Fast Variable Incrementing
(Just adding a little more explanation) Scratch only runs at 30 fps if an animation delay is needed after making a pass through all of the scripts in a project (and the project is not running in turbo mode or there isn’t a custom block without screen refresh.)
- theresa111
-
Scratcher
28 posts
Crazy Fast Variable Incrementing
Oh, very interesting. Thank you for the answers!!
- Discussion Forums
- » Help with Scripts
-
» Crazy Fast Variable Incrementing