49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Olander's - Persistent Time and Automatic Street Lights
|
|
// opw_mod_hb
|
|
// By:Don Anderson
|
|
// dandersonru@msn.com
|
|
//
|
|
// This is a Counter Script that updates the Persistent Time.
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "nbde_inc"
|
|
|
|
void main()
|
|
{
|
|
object oMod = GetModule();
|
|
|
|
//From Module Onload Event
|
|
int nPERMTIME = GetLocalInt(oMod,"PERMTIME");
|
|
int nMPH = GetLocalInt(oMod,"MPH");
|
|
int nCycle = (nMPH * 60)/6;//This is the Counts Per Game Hour
|
|
int nNth;
|
|
|
|
//Current Time Info
|
|
int nCurHour = GetTimeHour();
|
|
int nCurMin = GetTimeMinute();
|
|
int nCurSec = GetTimeSecond();
|
|
int nCurMS = GetTimeMillisecond();
|
|
|
|
int nHB = GetLocalInt(oMod,"PERMCOUNT");
|
|
|
|
if(nHB == nCycle)
|
|
{
|
|
//Update Time DB
|
|
int nHour = NBDE_GetCampaignInt("TIME","TIMEHOUR",oMod);
|
|
if(nCurHour != nHour && nPERMTIME == 1)
|
|
{
|
|
NBDE_SetCampaignInt("TIME","TIMEHOUR",GetTimeHour(),oMod);
|
|
NBDE_SetCampaignInt("TIME","TIMEDAY",GetCalendarDay(),oMod);
|
|
NBDE_SetCampaignInt("TIME","TIMEMONTH",GetCalendarMonth(),oMod);
|
|
NBDE_SetCampaignInt("TIME","TIMEYEAR",GetCalendarYear(),oMod);
|
|
}
|
|
}
|
|
|
|
nHB++;
|
|
if(nHB > nCycle) nHB = 1;
|
|
SetLocalInt(oMod, "PERMCOUNT", nHB);
|
|
}
|