Date and time system coding (part 3) and results. – Digital Thoughts in an Analogue World

Date and time system coding (part 3) and results.

There were a couple of  a couple of post i had about coding that assisted with syncing date and time from SkyMaster into ORK. There were a few different variables that were added to  the system that would track the Time and date of the game world however, I did not give the dates a name.

Before the explanations: there are a few things I did not mention that will be important throughout the discussion. i will be using 4 terms when i mention variables (var). I will explain them here:

integer (int): integer is a number without decimals it is less accurate but easier to use. you can also use this to assign value to string variables, similar to the example below

float (flt): float is a number that includes decimals. in this example, the SKYMASTER element uses a float in order to simulate Time, it is more accurate but sometime wield ungodly amounts of decimal places. more on that later,

String: string variable are words. many of the words that you see in games, especially the ones randomly generated are calling on string variables. it can be generated on its own or by float/integer value.

Boolean (bool) : a Boolean has a binary function. either the variable is True, or the variable if false, this will cause other objects to function or fail depending on the coding associated with that variable. more examples during the discussion

I attempted to simplify the definitions as much as I could, but if you feel like your brain is melting and you need a rest before continuing, here is a picture of a puppy:

OK, Lets continue…

DISCLAIMER: I may be wrong when writing the code, as mentioned in previous articles – i normally use visual scripting, node-based tools.  I will fix later if i am incorrect. also, there are more than one way to use strings, This Library is a good tool for study.

Here are the variables that I am using so far:

TIME: float variable, range of 0.00 – 24.00
TIME_DAY: integer variable, range of 1-30
TIME_MONTH: integer variable, range of 1-12
TIME_DATE: integer variable, Range of 1-7

I created booleans simulating Morning, Day, and Night. for those to work, only one can be true at a time. The Booleans are based around the time frame dictated by TIME.

I need to create a few more during this, as well as use some information from ork in order to display the necessary information in the UI.

as mentioned before. Words don’t have meaning until you give them meaning. So things like date names will not function unless you tell it how. in this situation i associated TIME_DATE to DATE_NAME. I used visual scripting, but code-wise:

string DATE_NAME = null;

if  (TIME_DATE == [float] );


DATE_NAME = [“Date Name”];


NOTE: brackets are replaceable information.

The first line creates the variable and type and gives it a value, which is null (blank). afterward we add an if then statement.  if the date has a specific value then the name will change to the name provided.

for example: TIME_DATE = 1 / DATE NAME = Sunday (or the day of The Sun in my game).

using visual scripting I provided each Date value with a different Date Name.

for the day types i used Boolean types keep in mind, the only things that Boolean types can be switched to are true and false. the reason why Boolean types are good in this situation, is that you wont have to type in the time frames over and over again. just use the Boolean “Day” for example, using && for “and”.

bool Day = False;

if  (TIME >= 10 && <= 20);


Day = True;




Day = False;


this would be worded as “IF the time is greater than, or equal to 10 AND less than, or equal to 20, then “Day” is true. IF THIS IS NOT TRUE, then “Day” is considered false.”

to me, placing the code in this type of format is good for visual scripting as well as assists with knowing the structure of how the code should be placed.

finally adding the UI.

the UI was created using ork framework. so the coding is a little different, but to simplify, I typed for dialog

Hour [TIME] in the Day of [DATE_NAME]

there was a change I needed to make which ork made simple. at the beginning, i mentioned that TIME was a float, so the value of TIME looks like 11.67216242521276129… I needed to make the UI display an integer instead. so ork provided #varifloat#, or variable: float displayed as integer)

Hour #varifloat[TIME]# in the Day of #varstring[DATE_NAME]#

NOTE: the #var# codes only work in ORK’s dialog fields and is not part of the code structue

this makes the game show the following:

This was really long…


As mentioned before, I am not an expert. However I believe that in teaching others, I also teach myself. Hopefully you learn something, and if you know more than I do, leave examples in the comments. i would be happy to discuss more on this.