Discussion: Visual scripting and code format.

I’m not a programmer, but while studying design I learned the basics of coding. In other words, i cant create my own code but i can use my knowledge for better understanding of Visual Scripting, and can manipulate code in order for it to better serve it’s purpose.

Last time I talked about persistent time manipulation and how to make coding that will reflect what will happen if you pass 24 hours in game time:

if (TIME_HOUR >= 24)
{
TIME_DAY +1;

TIME = 0;
}

There was something important that was left out, like pronouns, your code has no meaning until you give it meaning. if you add TIME = 0, unity doesn’t know what that means until you declare it. most  code starts off by connecting to coding libraries or other code by typing

using [inset library/codename here]

This will give some meaning to what your coding will do, you will declare more later. For example in “SkyMasterManager.cs” you can tell that it is using information from Unity engine as well as information from ORK Framework

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ORKFramework;

This means that if you were were yo type code that is within ORK, then ORK will listen and vice versa.

there is code within sky maker that states that if TIME, TIME_DAY and TIME_MONTH variables do not exist with ORK. create the variables. furthermore Time is gathering information from the variable “current_Time,” so as long as current_Time is running, ORK’s TIME will gather the same information. The coding for this is

current_Time = Current_Time;

Current_Time = ORK.Game.Variables.GetFloat(“TIME”);

The goal was to extend the day system to include days of the week.

in ORK’s event system. I created an event that creates a new variable equal to TIME_DAY, which is controlled by TIME – which is controlled by current_Time. if i were to write this by hane it would most likely be

ORK.Game.Variables.GetFloat(“TIME_DATE”) = ORK.Game.Variables.GetFloat(“TIME_DAY”);

or

TIME_DATE = TIME_DAY

disclaimer = I may be wrong on this. I will edit if so

So, if TIME_DAY =+ 1 like the code at the beginning of the article, TIME_DATE also =+1. TIME_DAY is equal to 30 days, adding a value to TIME_MONTH after 30 days ends (that format is similar to the 24 hour code above). That does not help when adding the days of the week, so i added TIME_DATE to fix that. it subtracts 7 each time the TIME_DATE is greater than 8

if (TIME_DATE >= 8)
{
TIME_DATE =-7;
}

Keep in mind that TIME_DAY still EQUALS TIME_DATE so after the 7th day, 8 gets subtracted by 7, equaling 1, 9 gets subtracted by 7 equaling 2, etc.

I added precautions for when they become higher than 14, 21 and 28, but i believe that it may not be necessary. if we follow the code and have it check the status enough times, 15 is greater than 8, which then becomes 8, which then becomes 1.

After word i have each value a string name. TIME_DATE’s 1 = sunday, 2 = tuesday, etc.

I have a system test for this code in the Game Gallery. click there if you would like to install the game and see the results in the UI

Keep in mind, that I am not an expert, but i do think it is interesting and by teaching you, I am also teaching myself. If you have better examples, leave an example in the comments. and thank you for reading.