Home   Help Search Login Register  

Author Topic: DayTime command  (Read 509 times)

0 Members and 1 Guest are viewing this topic.

Ace Productions

  • Guest
DayTime command
« on: 15 Apr 2004, 09:21:59 »
I've tried to get the actual time during the game by using the dayTime command, but I it returned the number 0.867153 while the watch was showing 12:53. Does anybody knows what is the relationship between the two or what's the proper way to obtain the hour in the game?

Thanks in advance.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:DayTime command
« Reply #1 on: 15 Apr 2004, 11:21:03 »
Heya Ace,

Daytime returns the hour of the day. In other words, it will return a number between 0 and 24 (or really 23.99999999...).

I had a snippet running around somewhere that would convert one to the other... but I seem to have mis-laid it.

Anyway, if you times your 0.86... by 60, you'll end up with 52, which is your minutes.
The idea is to cut the number infront of the decimal point out and use it as your hours, then multiply the bit behind the decimal by 60 to get your minutes...

I'd sit down and write it for you, but I'm way too tired to write sensible code at the moment... I tried for a bit but came up with this:

Code: [Select]
hour = (daytime - (daytime mod 1))
Minute = ((daytime - (daytime - (daytime mod 1)) * 60)) - (((daytime - (daytime - (daytime mod 1)) * 60)) mod 1)

I think I'll give up and come back tomorrow ;D ;D

Ace Productions

  • Guest
Re:DayTime command
« Reply #2 on: 15 Apr 2004, 17:04:28 »
Many thanks my friend Sui...