[PYTHON] Simple Game Clock Mod

homegrown

Missionary of Sorenism
Joined
Jan 5, 2002
Messages
203
Location
Houston TX
I like having the clock on, but I dislike how when I look up and want to know the game date, it's showing me the real time, and when I want to know the real time, it's showing me the game date. So I went looking...

This was wayyyy easier than I thought it would be. There are two sections of the CvMainInterface.py that needed to be looked at.

Code:
if (g_iTimeTextCounter >= 30.0):		# 15 seconds
			g_iTimeTextCounter = 0.0
			self.updateTimeText(false)
			screen.setLabel( "TimeText", "Background", g_szTimeText, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 56, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
			screen.show( "TimeText" )
		elif (g_iTimeTextCounter >= 15.0):		# Another 15 Seconds
			self.updateTimeText(true)
			screen.setLabel( "TimeText", "Background", g_szTimeText, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 56, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
			screen.show( "TimeText" )

I changed the first self.updateTimeText to (true)... telling it to display TimeText all the time.

The second section is where it determines what text to print...

Code:
def updateTimeText( self, bUseClockText ):
		
		global g_szTimeText
		
		ePlayer = gc.getGame().getActivePlayer()
		
		if (CyUserProfile().isClockOn() and bUseClockText):
			g_szTimeText = getClockText()
		else:
			g_szTimeText = unicode(CyGameTextMgr().getInterfaceTimeStr(ePlayer))

If the clock is on, and we're supposed to be seeing the clock (which I changed above to always)...

g_szTimeText = getClockText() + " " + unicode(CyGameTextMgr().getInterfaceTimeStr(ePlayer))

Here is a screenshot.

And a nifty zip. This just contains the CvMainInterface.py file. Place it in your My Documents/My Games/SM Civ 4/CustomAssets/python/screens folder.

The other thing that might be interesting to put there, would be the Elasped Game time, OR the time remaining until the alarm goes off... still pondering... maybe I'll take a poll. :D

Happy Civving!
 
Yes!!! This is absolutely the first thing I wanted to change, but I haven't looked at a programming language in years, so I was intimidated to do something about it...

THANK YOU!!!!!!!!!!!!!!! :D
 
Brilliant, I too had this annoyance just lacked the abilities required to fix it :)

Firaxis will hopefully do that same!
 
You are awesome.

Thanks.
 
thanks sir !!
 
thanks for this helpful mod, i allways have the same problem....

i would also realy like an elapsed time clock, that would be cool.
 
civaddict098 said:
thanks for this helpful mod, i allways have the same problem....

i would also realy like an elapsed time clock, that would be cool.
Seems like an easy process.

Is there a written API for all of these functions somewhere?
 
Thanks works great!!!:goodjob: One (Noob modding) question by changing this in my interface will I have problems with playing online with other players that don't have this same interface? And what about changes I made to my ini file(no wonder movies for example) is that going to be a problem online? Thanks!
 
civaddict098 said:
thanks for this helpful mod, i allways have the same problem....

i would also realy like an elapsed time clock, that would be cool.

Total time since this session started, or total time since the game started? I think total game time has it's own function..


CyGame().getMinutesPlayed()

As for session time, that might be a little more tricky. You'd probably have to store the result of getMinutesPlayed() or some other time function into a variable of your own, then to get the elapsed session time subtract this answer from the current getMinutesPlayed() or whatever time function is used.
 
I hate to nitpick (the mod is great, the date/clock thing annoyed me to no end) but even tiny mods should have documentation. Doesn't need to be anything fancy, even if it's just installation instructions. Having the basic directory structure within the zip is a plus, though admittedly a bit of a hassle when you're only putting one file in it.

Thanks, between this and the domestic advisor, my Civ4 gaming is becoming less annoying and more enjoyable by the day.
 
Dear god, this was a terrible problem. Thanks for the fix! I'm going to check out that domestic advisor mod next.
 
Decided to work up a second flavor to this. My signature now contains a link to an All Clocks Mod that displays the real time, the elapsed game time (across all sessions, not just the current one), and the game date all at the same time.

And for the nitpicker, all the zips now have readme files. :p

Happy Civving!
 
Top Bottom