3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: New Year Countdown  (Read 694 times)

« on: December 23, 2011, 04:43:25 AM »
Hi to all

Does anyone know how can a countdown until New Years eve be made? Like 7 days, 14 hours, 3 minutes, 5 seconds..?

Thanks and happy holidays to all!
« Reply #1 on: December 23, 2011, 04:48:22 AM »
That would be great, if only I knew how...
« Reply #2 on: December 23, 2011, 11:43:42 AM »
Fil... this post really belongs in the Tech questions forum and not here...
best to try and keep posts organized so that your question will be properly answered...

as for the question... take a look at the scripting reference (load a script object in the project, open it, click on help, click on scripting reference) guide for iSystemTime()...

you should be able to get what you want by setting  the target date and time in a variable... and currently subtracting the current date and time from that...

good luck...

--Mike

« Reply #3 on: December 23, 2011, 01:29:39 PM »
Mike - active and alive again, I see!

As for the post in the wrong place - sorry if possible move this to the Tech forum.

About the question - the first thing I thought of was normally the iSystemTime() function, but as said it returns current time. That's fine for the current time, but can I somehow initialize it so that I say

iSystemTime(3) is set to  31.
iSystemTime(4) is set to 00:00

and so on...

Thanks.
« Reply #4 on: December 23, 2011, 01:38:37 PM »
that's it...

--Mike

jestermon

« Reply #5 on: December 23, 2011, 04:09:38 PM »
Here's a simple example of a new year countdown timer

Code: [Select]
int PRINT = OBJ_0;
string S;

string zero(int num){
   string N;
   N = num;
   if(iStringLen(N) < 2) N = "0"+N;
   return(N);
}

void Main()
{
   //Get date and time info
   int day =  iSystemTime(3);
   int hour = iSystemTime(4);
   int minute = iSystemTime(5);
   int second = iSystemTime(6);

   float days = 31-day; 
   float hours = 24-hour-1;
   float minutes = 60-minute-1;
   float seconds = 60-second;

   iPrint(S="Local Time  "+zero(hour)+":"+zero(minute)+":"+zero(second),-6,6,PRINT);
   iPrint("DAYS"  , 1,4,   PRINT);
   iPrint("HOURS" , 1,2.5, PRINT);
   iPrint("MINUTES",1,1,   PRINT);
   iPrint("SECONDS",1,-0.5,PRINT);
   iPrint(S=zero(days),   -1,4,   PRINT);
   iPrint(S=zero(hours),  -1,2.5, PRINT);
   iPrint(S=zero(minutes),-1,1,   PRINT);
   iPrint(S=zero(seconds),-1,-0.5,PRINT);

}
« Reply #6 on: December 23, 2011, 05:45:23 PM »
Here's a simple example of a new year countdown timer

Code: [Select]
int PRINT = OBJ_0;
string S;

string zero(int num){
   string N;
   N = num;
   if(iStringLen(N) < 2) N = "0"+N;
   return(N);
}

void Main()
{
   //Get date and time info
   int day =  iSystemTime(3);
   int hour = iSystemTime(4);
   int minute = iSystemTime(5);
   int second = iSystemTime(6);

   float days = 31-day; 
   float hours = 24-hour-1;
   float minutes = 60-minute-1;
   float seconds = 60-second;

   iPrint(S="Local Time  "+zero(hour)+":"+zero(minute)+":"+zero(second),-6,6,PRINT);
   iPrint("DAYS"  , 1,4,   PRINT);
   iPrint("HOURS" , 1,2.5, PRINT);
   iPrint("MINUTES",1,1,   PRINT);
   iPrint("SECONDS",1,-0.5,PRINT);
   iPrint(S=zero(days),   -1,4,   PRINT);
   iPrint(S=zero(hours),  -1,2.5, PRINT);
   iPrint(S=zero(minutes),-1,1,   PRINT);
   iPrint(S=zero(seconds),-1,-0.5,PRINT);

}
is very good
See my web:
« Reply #7 on: December 24, 2011, 04:27:44 AM »
Thank you Jestermon! Not enough words to thank you.. Second the picture

jestermon

« Reply #8 on: December 24, 2011, 04:45:47 AM »
You guys are welcome. Just donate $1 to your favorite charity, and we'll call it even .. :D
Pages: [1]