"I'm a moron" formula question

Post » Mon May 07, 2012 12:13 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
WTW
 
Posts: 3313
Joined: Wed May 30, 2007 7:48 pm

Post » Mon May 07, 2012 1:01 pm

Can you not use the http://cs.elderscrolls.com/constwiki/index.php/GetCurrentTime function?
User avatar
Steven Hardman
 
Posts: 3323
Joined: Sun Jun 10, 2007 5:12 pm

Post » Mon May 07, 2012 1:40 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
Laura-Lee Gerwing
 
Posts: 3363
Joined: Fri Jan 12, 2007 12:46 am

Post » Mon May 07, 2012 9:01 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
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm

Post » Mon May 07, 2012 10:23 am

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
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Mon May 07, 2012 4:13 pm

Actually, GameHour and GetCurrentTime return exactly the same value.
User avatar
{Richies Mommy}
 
Posts: 3398
Joined: Wed Jun 21, 2006 2:40 pm

Post » Mon May 07, 2012 3:54 am

Oh, okay. Well WillieSea said one was a float and the other was a short. I guess they are both shorts?
User avatar
carley moss
 
Posts: 3331
Joined: Tue Jun 20, 2006 5:05 pm

Post » Mon May 07, 2012 5:21 pm

Have a look at http://cs.elderscrolls.com/constwiki/index.php/Category:Time_Functions page, it tells you all about them ;)
User avatar
Chloe :)
 
Posts: 3386
Joined: Tue Jun 13, 2006 10:00 am

Post » Mon May 07, 2012 3:34 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
Gen Daley
 
Posts: 3315
Joined: Sat Jul 08, 2006 3:36 pm

Post » Mon May 07, 2012 12:39 pm

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
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am


Return to IV - Oblivion