- Code: Select all
int Hour;
int Mode;
void DisplayTime()
{
stTime u = getTime();
if (Mode == 0)
{
sprintf(text, "%d:%d:%d AM", Hour, u.min, u.sec);
}
if (Mode == 1)
{
sprintf(text, "%d:%d:%d PM", Hour, u.min, u.sec);
}
if (u.hour<13)
{
Hour = u.hour;
}
if (u.hour>12)
{
Mode = 1;
}
if (u.hour<12)
{
Mode = 0;
}
if (u.hour == 12)
{
Mode = 1;
}
switch(u.hour)
{
case 13:
Hour = 1;
break;
case 14:
Hour = 2;
break;
case 15:
Hour = 3;
break;
case 16:
Hour = 4;
break;
case 17:
Hour = 5;
break;
case 18:
Hour = 6;
break;
case 19:
Hour = 7;
break;
case 20:
Hour = 8;
break;
case 21:
Hour = 9;
break;
case 22:
Hour = 10;
break;
case 23:
Hour = 11;
break;
case 24:
Hour = 12;
break;
}
}
=]How to use[=
In your text actor, click Add - Draw Actor - Script editor, then put this code in it
DisplayTime();
then click ok, and watch as it displays real time.
here's a screenshot
Hehe... I made a lil system clock.
12:00 AM Fix:
I foudn out that uh... if it's 12:00 Am then it uh... sets it'sself to 0, but now I fixed that. here's the code
- Code: Select all
int Hour;
int Mode;
void DisplayTime()
{
stTime u = getTime();
if (Mode == 0)
{
sprintf(text, "%d:%d:%d AM", Hour, u.min, u.sec);
}
if (Mode == 1)
{
sprintf(text, "%d:%d:%d PM", Hour, u.min, u.sec);
}
if (u.hour<13 && u.hour>0)
{
Hour = u.hour;
}
if (u.hour>12)
{
Mode = 1;
}
if (u.hour<12)
{
Mode = 0;
}
if (u.hour == 12)
{
Mode = 1;
}
if (u.hour == 0)
{
Hour = 12;
}
switch(u.hour)
{
case 13:
Hour = 1;
break;
case 14:
Hour = 2;
break;
case 15:
Hour = 3;
break;
case 16:
Hour = 4;
break;
case 17:
Hour = 5;
break;
case 18:
Hour = 6;
break;
case 19:
Hour = 7;
break;
case 20:
Hour = 8;
break;
case 21:
Hour = 9;
break;
case 22:
Hour = 10;
break;
case 23:
Hour = 11;
break;
case 24:
Hour = 12;
break;
}
}
Anyways, yeah now the clock is fixed
Enjoy