"I'm a moron" formula question

Post » Wed Dec 07, 2011 12:47 pm

How do I convert the Oblivion global "GameHour" into an Hour:Minute clock. I tried following the tutorial on the wiki, but it keeps giving me "0" for the minute. I looked at other mods that do the same thing, but I keep getting "0" for the minute. Math isn't my strongest subject, but I can do simple equations. And following what they do, I get "0". So how does it work for them?
User avatar
Kelsey Anna Farley
 
Posts: 3433
Joined: Fri Jun 30, 2006 10:33 pm

Post » Wed Dec 07, 2011 6:02 am

Can you not use the http://cs.elderscrolls.com/constwiki/index.php/GetCurrentTime function?
User avatar
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Wed Dec 07, 2011 12:11 pm

You want to display as HH:MM?

GameHour gives the hour as a float, so you have to put it in a variable defined as a float, not a short.

You might have better luck using http://cs.elderscrolls.com/constwiki/index.php/GetCurrentTime.
User avatar
Scott
 
Posts: 3385
Joined: Fri Nov 30, 2007 2:59 am

Post » Wed Dec 07, 2011 8:16 am

Well, crapola! says I...

I just figured out how to convert the hour using GameHour into an HH:MM:SS format. I really need to browse the wiki more aggressively. Well, for anybody who's interested, here's the script:

...Set fTotalOblivionSeconds to fOblivionTime * 3600.0Set fOblivionHours to fTotalOblivionSeconds / 3600Set fOblivionMinutes to (fTotalOblivionSeconds / 60) % 60Set fOblivionSeconds to fTotalOblivionSeconds % 60...


Thanks for the responses. I may go ahead and use GetCurrentTime, as it's more efficient.
User avatar
bonita mathews
 
Posts: 3405
Joined: Sun Aug 06, 2006 5:04 am

Post » Wed Dec 07, 2011 4:01 pm

I just looked at the "GetCurrentTime" function, and it is identical to "GameHour", except it's a short instead of a float. I think I'll stick with what I have.
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Wed Dec 07, 2011 12:17 pm

Actually, GameHour and GetCurrentTime return exactly the same value.
User avatar
Maya Maya
 
Posts: 3511
Joined: Wed Jul 05, 2006 7:35 pm

Post » Wed Dec 07, 2011 7:45 am

Oh, okay. Well WillieSea said one was a float and the other was a short. I guess they are both shorts?
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Wed Dec 07, 2011 2:50 pm

Have a look at http://cs.elderscrolls.com/constwiki/index.php/Category:Time_Functions page, it tells you all about them ;)
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am

Post » Wed Dec 07, 2011 10:02 am

Oh, okay. Well WillieSea said one was a float and the other was a short. I guess they are both shorts?

No, I said it returns a float. So if you are saving it in a 'short' variable type, you will probably get 0 for minutes since a short would truncate the decimal places, and thus the minutes.
User avatar
Roanne Bardsley
 
Posts: 3414
Joined: Wed Nov 08, 2006 9:57 am

Post » Wed Dec 07, 2011 9:25 am

No, I said it returns a float. So if you are saving it in a 'short' variable type, you will probably get 0 for minutes since a short would truncate the decimal places, and thus the minutes.


Oh, my mistake. Misunderstood. Sorry.
User avatar
electro_fantics
 
Posts: 3448
Joined: Fri Mar 30, 2007 11:50 pm


Return to IV - Oblivion