Trying to make code dictate displayed label text

Godot Version

Godot Engine v4.4.1.stable.official.49a5bc7b6 - https://godotengine.org
Vulkan 1.4.308 - Forward Mobile

Question

Hello, I’ve been trying to mess around with a time/day night cycle mechanic and was just testing some things with the time display. I can’t figure out how to make the time variables affect the time display text. Any help would be appreciated, thanks in advance.

The Code:

https://pastebin.pl/view/653ad517

I’m not really sure what the code should be doing. Out of curiosity, did you use a LLM for help? If you did, please avoid them as they aren’t good with GDscript.

You’ll need to update the Label text every frame in the _process() function. Something like:

# ...
$TimeHour.text = "%s:%s:%s" % [time_h, time_m, time_s]

More info about string formatting here GDScript format strings — Godot Engine (stable) documentation in English

Haha no :smiley: I wrote it on my own pretty impulsively. This is just my extremely primitive way of making the computer progress hour/day/month/year variables. I didn’t do research on the meta way of doing something like this. I wanted to try and get something working by my own logic first.

Thanks for the help, I’ll look into the link you sent as well. Hasve a good day.