Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Timer goes faster than it should?
- 290Scratcher
-
1000+ posts
Timer goes faster than it should?
In a test, I made a variable that is supposed to run at the exact same speed as the timer.
This can be proved by looking at this project.
The variable seems to be slower.
This can be proved by looking at this project.
- Warriorbuilds3
-
100+ posts
Timer goes faster than it should?
This is because you put the wait block BEFORE the change variable block. Put the change variable block first, then the wait block, and it will work. This happens because you're putting a delay before it starts, thus putting it immediately behind.
- Warriorbuilds3
-
100+ posts
Timer goes faster than it should?
Also, you might want to set the sprite's rotation style to don't rotate, so it doesn't lag as much. Less lag = Better performanceThis is because you put the wait block BEFORE the change variable block. Put the change variable block first, then the wait block, and it will work. This happens because you're putting a delay before it starts, thus putting it immediately behind.
that fixes it for a few seconds but once you get into double digits i can definitely still see a 1-2 second delay
- njb14
-
100+ posts
Timer goes faster than it should?
It's probably also because it takes time for the project to update the variable, wait 0.1 seconds and then go back to the start. It doesn't take much time, but eventually that's going to start to pile up and slow the variable down.
- luke14444
-
11 posts
Timer goes faster than it should?
Same feature here.
When changed to:
forever
wait 1 sec
change by 1
timers run “at the same speed” with smaller error (compared to 0.1 case)
Seems that executing ( wait 1 sec; change by 1; repeat ) takes a bit more time than 1 second.
https://scratch.mit.edu/projects/181305176/
When changed to:
forever
wait 1 sec
change by 1
timers run “at the same speed” with smaller error (compared to 0.1 case)
Seems that executing ( wait 1 sec; change by 1; repeat ) takes a bit more time than 1 second.
https://scratch.mit.edu/projects/181305176/
- asivi
-
1000+ posts
Timer goes faster than it should?
Last edited by asivi (Oct. 21, 2017 06:35:07)
- 290Scratcher
-
1000+ posts
Timer goes faster than it should?
That actually does work. Same feature here.
When changed to:
forever
wait 1 sec
change by 1
timers run “at the same speed” with smaller error (compared to 0.1 case)
Seems that executing ( wait 1 sec; change by 1; repeat ) takes a bit more time than 1 second.
https://scratch.mit.edu/projects/181305176/
- luke14444
-
11 posts
Timer goes faster than it should?
Nope. Error is just smaller. Wait about 200 seconds and you will see the difference.
- njb14
-
100+ posts
Timer goes faster than it should?
https://scratch.mit.edu/projects/181349337/
If you allow time for the script to be processed (around 0.008 seconds), it works fine
If you allow time for the script to be processed (around 0.008 seconds), it works fine
Last edited by njb14 (Oct. 21, 2017 14:21:49)
- LordOfMuffins
-
100+ posts
Timer goes faster than it should?
In the
blocks there is a one-frame delay (about 0.03 seconds) after every loop in order to stop flash from crashing when somebody does something like this:
If the delay wasn't there, the flash player would try to do “something without the ‘wait’ block after it” an infinite ammount of times a second, and we know that's not possible, so it would crash. You can disable the one-tick delay by doing this:
^^^^^^To get this to work correctly, in the options for the custom block you have to check the “run without screen refresh” checkbox. Problem solved!
- asivi
-
1000+ posts
Timer goes faster than it should?
…^^^^^^To get this to work correctly, in the options for the custom block you have to check the “run without screen refresh” checkbox. Problem solved!
If you add any block with a wait in a no screen refresh custom block it will mess such script, and any other no screen refresh custom block in the project too, probably. Also that forever loop…
If you are not kidding us, please, just test it.
Last edited by asivi (Oct. 21, 2017 23:12:53)
- plit234
-
93 posts
Timer goes faster than it should?
This is because you put the wait block BEFORE the change variable block. Put the change variable block first, then the wait block, and it will work. This happens because you're putting a delay before it starts, thus putting it immediately behind.
Actually,it is going a bit more behind the timer,so that won't work.It's not the delay either.The only way to get the exact amount of the timer is this code:
That makes it exactly be the same as the other timer.
- 290Scratcher
-
1000+ posts
Timer goes faster than it should?
The thing is theoretically the second script should make the variable run at the same speed as the in-built timer.This is because you put the wait block BEFORE the change variable block. Put the change variable block first, then the wait block, and it will work. This happens because you're putting a delay before it starts, thus putting it immediately behind.
Actually,it is going a bit more behind the timer,so that won't work.It's not the delay either.The only way to get the exact amount of the timer is this code:
That makes it exactly be the same as the other timer.
- CGGSCC8
-
5 posts
Timer goes faster than it should?
that worksThe thing is theoretically the second script should make the variable run at the same speed as the in-built timer.This is because you put the wait block BEFORE the change variable block. Put the change variable block first, then the wait block, and it will work. This happens because you're putting a delay before it starts, thus putting it immediately behind.
Actually,it is going a bit more behind the timer,so that won't work.It's not the delay either.The only way to get the exact amount of the timer is this code:
That makes it exactly be the same as the other timer.
- Yeetoburro1
-
1000+ posts
Timer goes faster than it should?
Please do not necropost, this topic is 3 years old this works:

- 4096bits
-
1000+ posts
Timer goes faster than it should?
Okay, I'll report it to be closed.Please do not necropost, this topic is 3 years old this works:
i am not a moderator
- Discussion Forums
- » Bugs and Glitches
-
» Timer goes faster than it should?