Difference between revisions of "Talk:GetCurrentGameTime - Utility"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Lisselli
(function for getting the 'real' game time as seen in the journal, sleep, and wait minutes.)
 
imported>Lisselli
Line 21: Line 21:
</source>
</source>


I'll explain this the best I can, there's a bit of math involved and I'm bad at explaining math. The time you see in the wait, journal, and sleep menus is calculated differently than the 'time' returned from [[GetCurrentGameTime]] and/or using the globalvariable GameDaysPassed(with some math). If it's 9:32AM, the game will convert it as 9.52xxxx, with xxxx possibly being the miliseconds(a value I don't know how to get, since there's no function to chop off specific decimal points. This function I made will convert, for example, 9.52 into 9.32. There's some rounding involved as well. [[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]])---
I'll explain this the best I can, there's a bit of math involved and I'm bad at explaining math. The time you see in the wait, journal, and sleep menus is calculated differently than the 'time' returned from [[GetCurrentGameTime]] and/or using the globalvariable GameDaysPassed(with some math). If it's 9:32AM, the game will convert it as 9.52xxxx, with xxxx possibly being the seconds(a value I don't know how to get, since there's no function to chop off specific decimal points. This function I made will convert, for example, 9.52 into 9.32. There's some rounding involved as well. ~~----

Revision as of 06:39, 11 September 2017

GetRealCurrentGameTime

Float Function GetRealCurrentGameTime()
	; Returns the current time seen in the wait, sleep, and journal menus.
	
        ; Store the current days passed.
        Float getCurrentTime = Utility.GetCurrentGameTime()
	
	; Get the current real hour in game time.
	Float getRealCurrentGameHour = ((getCurrentTime - getCurrentTime as int) * 24) as int
	
        ; Get the current real minutes of the real game time hour, but removing the hour.
	Float getRealCurrentGameMinutes = ((getCurrentTime - getCurrentTime as int) * 24) - ((getCurrentTime - getCurrentTime as int) * 24) as int
	
        ; Add the current real minutes to the current real game time hour.
	Float getRealCurrentGameHoursMinutes = getRealCurrentGameHour + ((getRealCurrentGameMinutes * 60) + 1) / 100
	
       	return getRealCurrentGameHoursMinutes 
	
EndFunction

I'll explain this the best I can, there's a bit of math involved and I'm bad at explaining math. The time you see in the wait, journal, and sleep menus is calculated differently than the 'time' returned from GetCurrentGameTime and/or using the globalvariable GameDaysPassed(with some math). If it's 9:32AM, the game will convert it as 9.52xxxx, with xxxx possibly being the seconds(a value I don't know how to get, since there's no function to chop off specific decimal points. This function I made will convert, for example, 9.52 into 9.32. There's some rounding involved as well. ~~----