phungus420
Deity
- Joined
- Mar 1, 2003
- Messages
- 6,296
I need to make the RevIdx of taxes visible. Or at least get something on screen so that I can see what my code calculates.
How can I do this? I've been told to throw in a print statement, but I don't know what that is. I'm trying to adjust the taxes model, but I can't begin to experiment with it, if I can't see the numbers that get churned out by the code.
See here for what I mean:
http://forums.civfanatics.com/showpost.php?p=7887106&postcount=39
from revolutions.py
Alternatively, I'd be just as happy (in fact happier) with getting this to actually show in the RevIdx bar. Currently nothing is displayed, but the TXT calls do in deed exist in the Revolutions text file, so I don't know why they are broken:
The reason I was able to code a city distance calculation that I am happy with, is because I could see and tweak the numbers. Also this let me know if I was breaking things, ie I had debugging feedback. Currently all this information is stealth. This means I can't begin to takle the problem, because I'd just be shooting blind with everything I try.
How can I do this? I've been told to throw in a print statement, but I don't know what that is. I'm trying to adjust the taxes model, but I can't begin to experiment with it, if I can't see the numbers that get churned out by the code.
See here for what I mean:
http://forums.civfanatics.com/showpost.php?p=7887106&postcount=39
from revolutions.py
Code:
# Finances
finIdx = 0
finIdx2 = 0
taxesIdx = 0
goldPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_GOLD )
#I need a print statement to tell me what goldPerc is being calculated as here.
#This is where I need to see the numbers. How can I do this?
#Once I figure out how to get a print statement working where will the value be displayed?
sciPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_RESEARCH )
cultPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_CULTURE )
Alternatively, I'd be just as happy (in fact happier) with getting this to actually show in the RevIdx bar. Currently nothing is displayed, but the TXT calls do in deed exist in the Revolutions text file, so I don't know why they are broken:
Spoiler :
Code:
if( pTeam.getAtWarCount(True) == 0 ) :
if( goldPerc > 50 ) :
# At peace, stronger penalties for taxes and financial trouble
iGold = pPlayer.getGold()
goldRate = pPlayer.calculateGoldRate()
# Taxes
taxesIdx -= (goldPerc - 50)/3
if( goldRate > 10*pPlayer.getCurrentEra() ) :
taxesIdx /=2
if( bIsRevWatch ) : negList.append( (taxesIdx, localText.getText("TXT_KEY_REV_WATCH_TAXES",())) )
# Finances
if( iGold < 50 + 12*pPlayer.getCurrentEra() and goldRate < 1 + pPlayer.getCurrentEra() ) :
if( self.LOG_DEBUG and bVerbose) : CvUtil.pyPrint(" Revolt - The %s is in serious financial trouble, gold: %d, rate: %d, gold perc: %.2f"%(pPlayer.getCivilizationDescription(0), iGold, goldRate,goldPerc))
finIdx += (2*(goldPerc - 50)) + 15
revIdxHistEvents += 15
finIdx2 -= (goldPerc - 50)/2 + 5 - max([goldRate,-5])
if( bIsRevWatch ) : negList.append( (finIdx2, localText.getText("TXT_KEY_REV_WATCH_SERIOUS_FINANCIAL",())) )
elif( iGold < 80 + 20*pPlayer.getCurrentEra() and goldRate < 5 + pPlayer.getCurrentEra() ) :
if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint(" Revolt - The %s is in financial trouble, gold: %d, rate: %d, gold perc: %.2f"%(pPlayer.getCivilizationDescription(0), iGold, goldRate,goldPerc))
finIdx += (goldPerc - 50) + 5
revIdxHistEvents += 8
finIdx2 -= (goldPerc - 50)/2 - max([min([goldRate,8]),-5])/2
if( bIsRevWatch ) : negList.append( (finIdx2, localText.getText("TXT_KEY_REV_WATCH_FINANCIAL",())) )
else :
if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint(" Revolt - The %s are at peace and have very high taxes, gold: %d, rate: %d, gold perc: %.2f"%(pPlayer.getCivilizationDescription(0),iGold, goldRate,goldPerc))
finIdx += 2*(goldPerc - 50)/3
if( goldRate > 10*pPlayer.getCurrentEra() ) :
finIdx /= 2
elif( sciPerc + (3*cultPerc)/2 > 60 ) :
taxesIdx += min([(sciPerc + (3*cultPerc)/2 - 60)/4,10])
if( bIsRevWatch ) : posList.append( (taxesIdx, localText.getText("TXT_KEY_REV_WATCH_LOW_TAXES",())) )
else :
if( goldPerc > 70 ) :
iGold = pPlayer.getGold()
goldRate = pPlayer.calculateGoldRate()
# Taxes
taxesIdx -= (2*(goldPerc - 70))/3
if( goldRate > 3 + 4*pPlayer.getCurrentEra() ) :
taxesIdx /= 2
if( bIsRevWatch ) : negList.append( (taxesIdx, localText.getText("TXT_KEY_REV_WATCH_TAXES",())) )
# Finances
if( iGold < 80 + 25*pPlayer.getCurrentEra() and goldRate < 6 + pPlayer.getCurrentEra() ) :
if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint(" Revolt - The %s is in serious financial trouble, gold: %d, rate: %d, gold perc: %.2f"%(pPlayer.getCivilizationDescription(0), iGold, goldRate,goldPerc))
finIdx += (goldPerc - 50) + 10
revIdxHistEvents += 8
finIdx2 -= (goldPerc - 50)/2 + 5
if( bIsRevWatch ) : negList.append( (finIdx2, localText.getText("TXT_KEY_REV_WATCH_SERIOUS_FINANCIAL",())) )
elif( iGold < 100 + 40*pPlayer.getCurrentEra() and goldRate < 4 + pPlayer.getCurrentEra() ) :
if( self.LOG_DEBUG and bVerbose ) : CvUtil.pyPrint(" Revolt - The %s is in financial trouble, gold: %d, rate: %d, gold perc: %.2f"%(pPlayer.getCivilizationDescription(0), iGold, goldRate,goldPerc))
finIdx += (goldPerc - 50)/2 + 5
finIdx2 -= (goldPerc - 50)/3
if( bIsRevWatch ) : negList.append( (finIdx2, localText.getText("TXT_KEY_REV_WATCH_FINANCIAL",())) )
else :
if( self.LOG_DEBUG and bVerbose) : CvUtil.pyPrint(" Revolt - The %s are at war and have very high taxes, gold: %d, rate: %d, gold perc: %.2f"%(pPlayer.getCivilizationDescription(0), iGold, goldRate,goldPerc))
finIdx += goldPerc - 70
if( goldRate > 3 + 3*pPlayer.getCurrentEra() ) :
finIdx /= 2
elif( sciPerc + (3*cultPerc)/2 > 50 ) :
taxesIdx += min([(sciPerc + (3*cultPerc)/2 - 50)/5,10])
if( bIsRevWatch ) : posList.append( (taxesIdx, localText.getText("TXT_KEY_REV_WATCH_LOW_TAXES",())) )
The reason I was able to code a city distance calculation that I am happy with, is because I could see and tweak the numbers. Also this let me know if I was breaking things, ie I had debugging feedback. Currently all this information is stealth. This means I can't begin to takle the problem, because I'd just be shooting blind with everything I try.