HI how to add a clock to a day night cycle?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GrumpyIdiot

daynightcycle code

thats the code of the day night cycle and i just need to add a clock to it but i have no idea how im new so i know nothing

Your image isn’t visible on the forum. You’ll need to upload it to a cloud storage service (Dropbox, Imgur, Google Drive, One Drive, …) and then provide a link here.

jgodfrey | 2023-01-19 15:26

Yeah I did that, but it didn’t work, I’ll try another one

GrumpyIdiot | 2023-01-19 15:37

Ah, I was able to follow your link (by pulling your post up in edit mode). Since it’s just code, I’d suggest you edit your post and paste the code directly in the message rather than trying to link an image.

The only trick is that you need to format it properly. To do that, after pasting it into your post, select it (just the code), and the press the {} button. That should format it as code. You can verify it in the Preview panel prior to posting…

jgodfrey | 2023-01-19 15:46

:bust_in_silhouette: Reply From: Gluon

Well there are a lot of ways you could choose to implement this but I would have a variable in an autoload script (see below on autoloads)

and then I would have a timer set for a period which makes sense for your game (see below as timer explanation)

and then when that timer ends link it to a function which will check the value of the variable on the autoload and update it with a change in time (every second = 1 game min maybe?).

Then you can have a label on the screen which in its process function updates every second by showing the value of the variable in the autoload script.

Its a lot of code you are asking for someone to write for you though, I am afraid this is something you would need to spend some time looking into but the links to the documentation give you all the info you need to be able to build this.

Thank you!
And I know, I’m not asking someone to write it for me, and I already made the clock and it works but doesn’t? Like it shows the time but nothing changes so idk what I’m missing
And the day night cycle is already done and it works all I need is to get them both together
I’ll look into these links and see what I can get
Thanks again!

GrumpyIdiot | 2023-01-19 15:44

If you are using a timer I would suggest it sounds like your timer is not linked to a function to update the time but hopefully the links will help. If not I will try to help with any specific problems or questions you have. Good luck!

Gluon | 2023-01-19 15:46