FANDOM



Module clock

What It Does

Got tired of not knowing what time it was in the module and every other clock script I found required an object to either use or display the time. This small script is placed in the on heartbeat of the module and eveytime the hour changes it send a message to the first PC (usually player in single player games) in the form of "1300 hours".

Note

This is also useful in debugging scripts that are time sensitive.

The Script

void main()
{
string sPrev = "PrevTime"; 
object oPC = GetFirstPC();
 int nHour = GetTimeHour();
 int nPrev = GetLocalInt( oPC, "PrevTime");
 if( nHour != nPrev )
    {
        SetLocalInt( oPC, sPrev, nHour);
        //int nTimevar = GetLocalInt( oPC, "PrevTime"); //debug line
        //string sTimevar = IntToString(nTimevar); //debug line
        //string sPrevhour = IntToString(nPrev); //debug line
        string sHour = IntToString(nHour);
        string sTime = sHour + "00 hours";
        SendMessageToPC( oPC, sTime );
        //SendMessageToPC( oPC, sPrevhour ); //debug line
        //SendMessageToPC( oPC, sTimevar ); //debug line
     }
 }

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.