Difference between revisions of "Function for Time of Day"

33 bytes added ,  15:23, 22 February 2012
casting Time to an int is faster than calling Math.Floor()
imported>Cipscis
m (moved Script for Time of Day to Function for Time of Day: This page describes a custom function, not a script)
imported>Daemonjax
(casting Time to an int is faster than calling Math.Floor())
Line 11: Line 11:


float Time = Utility.GetCurrentGameTime()
float Time = Utility.GetCurrentGameTime()
Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit
Time -= (Time as int) ; Remove "previous in-game days passed" bit, and faster than using Math.Floor()
Time *= 24 ; Convert from fraction of a day to number of hours
Time *= 24 ; Convert from fraction of a day to number of hours
Return Time
Return Time
Anonymous user