Hi Folks,
I am interested in adding a clock to my game displaying the current Time (am/pm) with no seconds just hours and minutes, and the current date (day,month, year).
But I am unsure on how to do it, and have it update whilst in game.
You can save the values in some variables as I’m doing in the image, then use the variables to change a text object string or something
If you are using the web platform (HTML5), take care of the functions “mday” and “wday” because they are broken in that platform, if you need them just modify the file located at:
Right now you are adding a “0” before the minutes, no matter the minutes value. You should check if minutes is < 10, if so add a “0” before, this way you convert 1, 2, 3 into 01, 02, 03. But don’t add a “0” if minutes is >= 10, otherwise you’ll convert 12 into 012
[code]Conditions: No conditions (always)
Actions: Do = Time(min) to global variable Minute
Do = GlobalVariableString(Minute) to the text of global variable MinuteString
Conditions: Global variable Minute is < 10
Actions: Do = “0” + GlobalVariableString(Minute) to the text of global variable MinuteString[/code]
Now the variable MinuteString has the value with the the extra “0” if needed, you can use the variable Minute in maths (because it’s a number), and use MinuteString to display it in text objects (you can’t use it for maths because it’s a string, “09” for example).
I am working on a codebase for a clock as we speak.
I will upload it here as a resource when complete.
I am aiming for the following format;
10:23AM Saturday 10th of March 2018
The reason for the format is that I live in Australia (DD/MM/YY),
but the US format is (MM/DD/YY),
so by expressing it this way, it is in an International format.
Will let you know how I go, I am a slow coder so it may take a few days for me to perfect it !
Here in Latin America we use the same format (DD/MM/YY). Of course I’m subjective, but this format is more “international” I think, and has more sense (day D of the month M of the year Y)
You can change the format in Account settings >> Board preferences, if you don’t like it anyway