"I'm a moron" formula question

Post » Sat Feb 19, 2011 12:10 am

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
Emmie Cate
 
Posts: 3372
Joined: Sun Mar 11, 2007 12:01 am

Post » Sat Feb 19, 2011 5:00 am

Can you not use the http://cs.elderscrolls.com/constwiki/index.php/GetCurrentTime function?
User avatar
Brittany Abner
 
Posts: 3401
Joined: Wed Oct 24, 2007 10:48 pm

Post » Fri Feb 18, 2011 10:13 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
Queen of Spades
 
Posts: 3383
Joined: Fri Dec 08, 2006 12:06 pm

Post » Sat Feb 19, 2011 2:13 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
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm

Post » Fri Feb 18, 2011 9:43 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
Genocidal Cry
 
Posts: 3357
Joined: Fri Jun 22, 2007 10:02 pm

Post » Sat Feb 19, 2011 7:06 am

Actually, GameHour and GetCurrentTime return exactly the same value.
User avatar
Kelly James
 
Posts: 3266
Joined: Wed Oct 04, 2006 7:33 pm

Post » Sat Feb 19, 2011 11:08 am

Oh, okay. Well WillieSea said one was a float and the other was a short. I guess they are both shorts?
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Fri Feb 18, 2011 10:51 pm

Have a look at http://cs.elderscrolls.com/constwiki/index.php/Category:Time_Functions page, it tells you all about them ;)
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm

Post » Sat Feb 19, 2011 12:59 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
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Sat Feb 19, 2011 6:37 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
michael flanigan
 
Posts: 3449
Joined: Thu Jun 14, 2007 2:33 pm


Return to IV - Oblivion