Author Topic: Math problem with SetTime event [Solved]  (Read 1094 times)

There, it's working beautifully. Thank you.

But of course I tried to be clever, and use your method for Add/Sub time, and now that broke XD. Oh well, ill set it back to how it was for that part, all in the Switch of course.

Again, thank you. Your names will be in the code so I can remember if I ever decide to post it.

Edit: There, reverted Inc/Dec to old method and its working. Again, thank you.
« Last Edit: October 07, 2012, 03:29:19 PM by boodals 2 »

Oooh, that's odd. Your setDayCycleTime conflicts with the inc/dec time method. Basically, if you set the time, then increase it, it jumps back to where it was before the set time (I think). Is it really moving the offset, or using another method?

Edit: Just tested, your method doesn't move the Offset, and then when the Inc/Dec changes it, the sun resets. I would just change the Inc/Dec to your method, but that wouldn't solve the thing about users changing the slider, and having the sun jump majorly after setting the time. I think we're back to stage one :/
« Last Edit: October 07, 2012, 04:30:06 PM by boodals 2 »

Code: [Select]
function addDayCycleTime(%time)
{
%offset = DayCycle.dayOffset+%time;
while(%offset >= 1)
%offset--;
while(%offset < 0)
%offset++;
DayCycle.setDayOffset(%offset);
}

Trying that now. setDayCycleTime(%amount+getDayCycleTime()); didn't work, although I thought it would of..

Trying that now. setDayCycleTime(%amount+getDayCycleTime()); didn't work, although I thought it would of..
You're using it wrong. Make sure %time is a number between 0 and 1, it already does the math for you.
« Last Edit: October 07, 2012, 05:18:04 PM by Plexious »

addDayCycleTime works. Thank you again. <3