Various call questions (Python)

So, other then that, the above looks to do what I want it to achieve? Is it really that simple?
Also due to that e from the python call page, wouldn't it need to be YieldTypes.YIELD_COMMERCEe

By the way, what do the i,e,j etc. specify in otherwise integer calls?
 
No, you should not add an "e" to the end of that constant. The e prefix stands for "enumeration". These are defined constants with a set of possible values, such as food/production/commerce for yield types and gold/research/culture/espionage for commerce types.

Note that the prefixes (e, i, sz, f, etc) are only conventions. They are not interpreted specifically by Python. Also, the name of the parameter in a function definition has no bearing on the values you pass into it. They only define the name of the parameter inside the function.
 
Thanks EF, it's really nice having you around here. Makes learning this stuff possible, you should charge for your code tutoring, lol.

I'm still curious if it looks like the above sample code would work though, I'm kinda stabbing at the dark here, and I'm concerend that that calculateTotalCommerce will only calculate commerce, not all types (science, gold, espionage and culture), which would make my equation too harsh.
 
To answer those questions, I recommend digging into the SDK and seeing what those functions do themselves. This is how I've learned what I know about the SDK--following function calls all over the place.
 
OK. Will do, this has stalled out until I can figure out how to get my variable to print anyway. I need to know the numbers the code I write is coming up with, in order to balance and properly test it. But for that I need jdog's input as it's tied in Revolutions.
 
Talked to Xienwolf in IRC, got the print statement working. Decided the best way to go about this was to find where the numbers that display in the tax rate are calculated (you can see total research, espionage, and culture earned empire wide in the tax rate setter, also gold per turn shows up above). I checked CvMainInterface and can't find this anywhere. I know bug just added the ++ and -- button to max/min the rate settings, where is this located? I think If I can find these I can figure out the perfect calls to use.

Spoiler :
Code:
	def updatePercentButtons( self ):

		screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )

		for iI in range( CommerceTypes.NUM_COMMERCE_TYPES ):
			szString = "IncreasePercent" + [B]str(iI)[/B]
			screen.hide( szString )
			szString = "DecreasePercent" + [B]str(iI)[/B]
			screen.hide( szString )
# BUG - Min/Max Sliders - start
			szString = "MaxPercent" + [B]str(iI)[/B]
			screen.hide( szString )
			szString = "MinPercent" + [B]str(iI)[/B]
			screen.hide( szString )
# BUG - Min/Max Sliders - start
Nope, nothing in there...

How does the game figure out the numbers it displayes in the research/espionage/culture sliders? This is so frustrating, everwhere I look it's a dead end, it's like the game just pulls these out of thin air :confused:

What are those bolded parts refering to in the code? Are those the numbers I'm looking for... If so, how are these calculated?
 
How does the game figure out the numbers it displayes in the research/espionage/culture sliders?

It uses

Code:
CyPlayer.getCommerceRate(CommerceTypes eIndex)

What are those bolded parts refering to in the code?

They are the index of the commerce type, and they are added to the name of the GUI element to give it a unique identifier for the UI tookit Civ uses. The variable iI is the loop variable that goes 0, 1, 2, to 3.
 
BAM!!!!!

And it works now :woohoo:

Spoiler :
Code:
        #phungus tax start
        totalUnitCost = pPlayer.calculateUnitCost()
        totalUnitSupply = pPlayer.calculateUnitSupply()
        totalMaintenance = pPlayer.getTotalMaintenance()
        totalCivicUpkeep = pPlayer.getCivicUpkeep([], False)
        totalPreInflatedCosts = pPlayer.calculatePreInflatedCosts()
        totalInflatedCosts = pPlayer.calculateInflatedCosts()
        iInflation = totalInflatedCosts - totalPreInflatedCosts
        goldFromCivs = pPlayer.getGoldPerTurn()
        goldRate = pPlayer.getCommerceRate(CommerceTypes.COMMERCE_GOLD)
        researchRate = pPlayer.calculateResearchRate(-1)
        cultureRate = pPlayer.getCommerceRate(CommerceTypes.COMMERCE_CULTURE)
        espionageRate = pPlayer.getCommerceRate(CommerceTypes.COMMERCE_ESPIONAGE)

        iGDP = goldFromCivs + goldRate + researchRate + cultureRate + espionageRate + pPlayer.calculateTotalImports(YieldTypes.YIELD_COMMERCE)
        CyInterface().addImmediateMessage("iGDP = %d" % (iGDP), "")
        iwaste = totalUnitCost + totalUnitSupply + totalMaintenance + totalCivicUpkeep + iInflation + pPlayer.calculateTotalExports(YieldTypes.YIELD_COMMERCE)
        CyInterface().addImmediateMessage("iwaste = %d" % (iwaste), "")
        taxBurden = (100*iwaste) / iGDP - 10
        CyInterface().addImmediateMessage("taxBurden = %d" % (taxBurden), "")
        if( pPlayer.hasTrait(gc.getInfoTypeForString("TRAIT_ORGANIZED")) ):
            taxBurden /= 2
        sciPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_RESEARCH )
        cultPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_CULTURE )
        if( pPlayer.hasTrait(gc.getInfoTypeForString("TRAIT_CREATIVE")) ):
            cultPerc *= 2
 
What's the magic 10% you deduct at the end in the taxBurden calculation? What if the taxBurden is under 10% (can it be)? You might want to check for that and make the final value 0% if so.
 
Top Bottom