Python Question

oaklanbash

Chieftain
Joined
Nov 15, 2005
Messages
31
I am new to Python, but seems fairly easy to pick up, was just wondering the best tool for digging deep in to the code. Let me give you an example of something I want to do now.

gc.getPlayer(pHolyCity.getOwner()).getCivilizationAdjective(0)

I want to change getCivilationAdjective(0) to the Name of the Owner, such as Rick or whatever name you choose as your in game name. Where can I find a nice table setup so I don't have to dig through endless libraries of definitions.

Thanks!
 
Well playing around I managed to find the solution, was pretty simple actually. But still took me longer than it might if I had good argument lists for the equations.

screen.setLabelAt("", szArea, "(%s)" % gc.getPlayer(pHolyCity.getOwner()).getName(),..........
 
Now that I'm doing BtS modding and the Apolyton API isn't up-to-date :( I've resorted to looking through the C++ code.

The code for the DLL is installed with the game, and all the CyXXX files show which functions from the CvXXX files are exposed to Python. For example, CvCity.cpp is the full C++ city class. It has some functions that aren't available from Python. The ones that are you can find in CyCity.cpp.

It's really a matter of getting familiar with the basic objects (city, player, game, gc, map, plot, all the infos). Once you do that, you can usually guess where a function would be exposed.
 
Top Bottom