Okay, so I'm running a loop using schedules to figure out when the daycycle repeats itself, but once the daycycle is set over 1000 seconds long, Torque fails to do math, and just runs the schedule as if it's an infinite loop.
Current code:
function getDayTime()
{
%time = $Sim.Time / DayCycle.dayLength + DayCycle.dayOffset;
$DayTime = (%time - mFloor(%time)) *1000;
return $DayTime;
}
new ScriptObject(day_cycle);
day_cycle.Days = "1";
day_cycle.Months = "1";
day_cycle.Years = "1";
function dayCycleAnnouncementLoop()
{
day_cycle.Days++;
if(day_cycle.Days >= 31)
{
day_cycle.Days = 1;
day_cycle.Months++;
}
if(day_cycle.Months >= 12)
{
day_cycle.Months = 1;
day_cycle.Years++;
}
messageAll('', "\c6It is now \c3" SPC day_cycle.Months @ "/" @ day_cycle.Days @ "/" @ day_cycle.Years);
dayCycle.announcementSchedule = schedule(dayCycle.dayLength *1000, 0, dayCycleAnnouncementLoop);
}
function serverCmdtoggleDayCycleAnn(%c)
{
if(isEventPending(dayCycle.announcementSchedule))
{
cancel(dayCycle.announcementSchedule);
messageAll('', "\c3" @ %c.getPlayerName() SPC "\c6has \c0 disabled \c6day cycle announcements.");
}
else
{
dayCycleAnnouncementLoop();
messageAll('', "\c3" @ %c.getPlayerName() SPC "\c6has \c2enabled \c6day cycle announcements.");
}
}
EDIT: Apparently, schedules break when you go over anything above 999*1000.