Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with making Clock 2
- JoJo_Siwa_Boy
-
33 posts
Help with making Clock 2
So I have a project that I'm working on, clock 2. It was made by a YouTuber called Oats Jenkins. But, it doesn't work like a normal clock (click the link “Oats Jenkins” to learn more), and so I need to have specific images go to specific places during specific times. Idk how to do it. Here's the project here, as a placeholder for now so yOu GuYs can see what the project is about.
- ConnaLulu
-
40 posts
Help with making Clock 2
May be painstaking, but how about adding two lists, like x and y, then making a code called item#.
Then do the following:
Then do the following:
when green flag clickedThen afterward, add
set [item# v] to [1]
forever
go to x: (item ((item#)) of [x v] :: list) y: (item ((item#)) of [y v] :: list)
change [item# v] by (1)
end
when green flag clicked
forever
wait until <(item#) > [however long your list is]>
set [item# v] to [1]
end
Last edited by ConnaLulu (July 4, 2022 17:50:15)
- JoJo_Siwa_Boy
-
33 posts
Help with making Clock 2
The only problem is that I need to make a script that runs on irl time, but other than that, it could work. May be painstaking, but how about adding two lists, like x and y, then making a code called item#.
Then do the following:when green flag clickedThen afterward, add
set [item# v] to [1]
forever
go to x: (item ((item#)) of [x v] :: list) y: (item ((item#)) of [y v] :: list)
change [item# v] by (1)
endwhen green flag clicked
forever
wait until <(item#) > [however long your list is]>
set [item# v] to [1]
end
- RT_Borg
-
1000+ posts
Help with making Clock 2
Hi JoJo_Siwa_Boy,
For real time, there's a block in sensing
I believe it uses the local time from the computer you're running the code on.
– RT_Borg
For real time, there's a block in sensing
(current [year v])
(current [month v])
...
(current [hour v])
(current [minute v])
(current [second v])
I believe it uses the local time from the computer you're running the code on.
– RT_Borg
- JoJo_Siwa_Boy
-
33 posts
Help with making Clock 2
That would mean I have to map every time to a specific x/y pos Hi JoJo_Siwa_Boy,
For real time, there's a block in sensing(current [year v])
(current [month v])
...
(current [hour v])
(current [minute v])
(current [second v])
I believe it uses the local time from the computer you're running the code on.
– RT_Borg
- RT_Borg
-
1000+ posts
Help with making Clock 2
That would mean I have to map every time to a specific x/y pos
Oh, I thought that's what you wanted to do. If you want to do math on time values to do your placement, there's
(days since 2000)
The part after the decimal represents the fraction of the current day that's passed.
The time zone seems to be UTC, so you'll have to convert to the users own local time (with the help of those individual blocks I referenced earlier).
The time unit is in days, so if you take the decimal part of “days since 2000” you can do math on that to get angles
set [fraction-of-today v] to ((days since 2000) - ([floor v] of (days since 2000))
set [angle v] to ((360) / (fraction-of-today))
Again, that should work for UTC time. Elsewhere, you'll need to adjust “days since 2000” for the local timezone and use the adjusted value in the above angle calculation.
I hope this helps,
– RT_Borg
Last edited by RT_Borg (July 10, 2022 19:19:25)
- Discussion Forums
- » Help with Scripts
-
» Help with making Clock 2