Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Making a counter that goes at the same rate as the "Days since 2000" block
- ywc2
-
Scratcher
100+ posts
Making a counter that goes at the same rate as the "Days since 2000" block
My project I am trying to make a counter that goes up at the exact same rate as the
(days since 2000)block. My current issue is that the days since 2000 block is updating between the block to change the time and the block to reset the amount of time that has passed. Anyone know what to do?
- -Qlec-
-
Scratcher
100+ posts
Making a counter that goes at the same rate as the "Days since 2000" block
If I'm not mistaken, you're trying to make a stopwatch or something like that?
Try this:
Try this:
when gf clicked
set [start v] to ((days since 2000) * (86400))
forever
set [timer v] to (((days since 2000) * (86400)) - (start))
end
- 09878901234321
-
Scratcher
500+ posts
Making a counter that goes at the same rate as the "Days since 2000" block
Use a variable so that the time doesn’t update with processing wait time.
set [days since 2000 v] to (days since 2000)And then instead of using the sensing block, use the variable.
- ywc2
-
Scratcher
100+ posts
Making a counter that goes at the same rate as the "Days since 2000" block
First of all: I need to track the uptimes of a server in my project, using the script that @-Qlec- said would not work, because it would keep going even when the server is down.
- boyboyt
-
Scratcher
100+ posts
Making a counter that goes at the same rate as the "Days since 2000" block
do
when green flag clicked
forever
set [real days since 2000] to (days since 2000)
set [attempted days since 2000] to (real days since 2000)
end
Last edited by boyboyt (Dec. 22, 2022 18:17:34)
- ywc2
-
Scratcher
100+ posts
Making a counter that goes at the same rate as the "Days since 2000" block
A clarification: The first time a person logs on, the project records the days since 2000 as the first time they logged on (on a cloud variable). Then whenever the person is on after that, the project records the total time they were on (with a counter that goes at the same rate as the days since 2000 block) and then the project calculates
however, the fact that my current way of calculating the
(((attempted days since 2000) / ((days since 2000) - (first time logged on))) * (100))to get a percentage to see how often they are on the project.
however, the fact that my current way of calculating the
(attempted days since 200)block is off, the percentages will be off by major amounts. If there is another way I can only accept it if I can get the answers in percentage format.
Last edited by ywc2 (Dec. 24, 2022 20:18:52)
- Discussion Forums
- » Help with Scripts
-
» Making a counter that goes at the same rate as the "Days since 2000" block