Author Topic: Questions about Environment Day Time Offset and the FRACTION variable [SOLVED]  (Read 772 times)

Okay, so. I need to be able to set the FRACTION* variable in the daycycle. However, after searching for a while, I can't seem to find the variable name of that variable, or a function to change it.

I've decided to go with the Day Time Offset. And, I've found that I can modify it using
serverCmdEnvGui_SetVar(%client*, DayOffset, Value);

The issue is that I need to set the FRACTION variable to 0.25, and using the Day Time Offset doesn't seem to do it accurately.

Would somebody tell me either:
A) How to directly modify the FRACTION variable.
B) How the Day Time Offset works.

Thanks in advance.

* FRACTION - The FRACTION variable is the time of day, ranging from 0.0 to 1.0
* %client - A client object whose isAdmin variable is equal to 1. In order to simulate this, I'm using an AiConnection with the variable isAdmin set to 1.
« Last Edit: April 28, 2013, 02:45:02 PM by Evar678 »

Still need help, here.

There is no fraction variable, it's for creating daycycles only.
What you could do is

serverCmdEnvGui_SetVar(%client, DayOffset, %fraction * daylength);

There is a way to directly get the length of the daycycle but I don't know it right now

function DCgetTime()
{
   %pas = $Sim::Time/Daycycle.dayLength;
   %tim = %pas - mFloor(%pas);
   while(%tim >= 1)
      %tim--;
   while(%tim < 0)
      %tim++;
   return %tim;
}
function DCsettime(%time)
{
   dayCycle.setDayOffset(%time-DCgetTime());
}

function DCgetTime()
{
   %pas = $Sim::Time/Daycycle.dayLength;
   %tim = %pas - mFloor(%pas);
   while(%tim >= 1)
      %tim--;
   while(%tim < 0)
      %tim++;
   return %tim;
}
function DCsettime(%time)
{
   dayCycle.setDayOffset(%time-DCgetTime());
}

Jesus marble I love you.