I am messing around with the python and so far, I have achieved the result I wanted. I modified the basic year display to display CurrentTurn/MaxTurns and the year instead of just the year.
In addition to this, I am trying to make it display the percentage of the game that has elapsed. This is the code in-total for what I have done so far.
This is in the CvMainInterface.py file(well, a copy of it in my mod directory anyhow).
g_szTimeText = unicode(gc.getGame().getGameTurn()+1) + "/" + unicode(gc.getGame().getMaxTurns()) +" " + unicode(round(100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())),2) + "% " + unicode(CyGameTextMgr().getInterfaceTimeStr(ePlayer))
I know, it is horribly messy.
This is the part I am concerned with:
unicode(round(100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())),2)
It works fine if I type it as:
unicode((100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())))
or as:
unicode(int(100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())))
The problem is, however, that the former has like a 10 digit decimal and looks way too ugly, and the latter isn't quite as fine as I wanted, as whole percentages aren't helpful, and I don't like the idea of 2.99% being shown as 2%. When I attempt to do the round-to-two places as I show above, it simply no longer prints the line to the screen at all...
Does anyone have any idea why it renders it unprintable?
In addition to this, I am trying to make it display the percentage of the game that has elapsed. This is the code in-total for what I have done so far.
This is in the CvMainInterface.py file(well, a copy of it in my mod directory anyhow).
g_szTimeText = unicode(gc.getGame().getGameTurn()+1) + "/" + unicode(gc.getGame().getMaxTurns()) +" " + unicode(round(100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())),2) + "% " + unicode(CyGameTextMgr().getInterfaceTimeStr(ePlayer))
I know, it is horribly messy.
This is the part I am concerned with:
unicode(round(100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())),2)
It works fine if I type it as:
unicode((100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())))
or as:
unicode(int(100*((1.00*(gc.getGame().getGameTurn()+1)) / gc.getGame().getMaxTurns())))
The problem is, however, that the former has like a 10 digit decimal and looks way too ugly, and the latter isn't quite as fine as I wanted, as whole percentages aren't helpful, and I don't like the idea of 2.99% being shown as 2%. When I attempt to do the round-to-two places as I show above, it simply no longer prints the line to the screen at all...
Does anyone have any idea why it renders it unprintable?