BtS Python API

Zebra 9

Emperor
Joined
May 17, 2006
Messages
1,554
Location
Middle of Cyberspace
Python API for Sid Meier's Civilization IV: Beyond the Sword.
It is still under construction, but will soon be done. Some things to keep in mind. The CvInfos are not done so I have provided an entry that is called CyInfo that contains all the info classes in a rather messy bunch. Also I have not created the Type List yet. And one last thing, the Types and Classes are not links yet, so if x function on y page returns z class, and you want to look at z class you will have to find z class on the side listing to view it.

Now I would advise the usage of Loctus's API in conjunction with this one due to the fact that his is complete and includes more files.

Download Here
 
Is this updated for BTS 3.13?

:)
 
No, not yet. If I get time I will try to update it. In the meantime I would like it if other moders would post any changes made to python in 3.13. Thanks.
 
Re uploaded because of hacker. I will be making another release soon that will have the completed CyInfos (I already finished them just have to add them).
 
I agree, I'm eager for it too :)
 
Well the reason I don't just add the missing parts is that I wrote a python script that converts the C++ code to api form (in a very messy form, I have to spend a day or so cleaning it).

I have finished getting the CvInfos into their own list so I will be releasing that soon. ;)
 
Sorry about that. I forgot all about civ (12th grade isn't a piece of cake, but hey I graduated with a good sized scholarship). I have the updated files on my desktop computer just have to figure out where. I'll probably get it up soon. ;)
 
Well I'm glad people are looking forward to this.

And just as a note to those who already have python code done and are using/upgrading to 3.17. The getXMLVal function has been removed from the infos base class. So you will have to get the class tag via the gc.getUnitClassInfos function or the gc.getBuildingClassInfos and call the getType function on the returned object.

Old system
Code:
iUnit = gc.getInfotypeForString ( "UNIT_WARRIOR" )
pUnit = gc.getUnitInfo ( iUnit )
szClass = pUnit.getXMLVal ( )
That won't work anymore, instead do this.
Code:
iUnit = gc.getInfotypeForString ( "UNIT_WARRIOR" )
pUnit = gc.getUnitInfo ( iUnit )
szClass = gc.getUnitClassInfo ( pUnit.getUnitClassType ( ) ).getType ( )
This forces us to use explicit code. The second example is very clear as to what I am doing. ;)
 
(bump)

I recently stumbled across some API calls which are available in BTS but not warlords (CvUnit.getFacingDirection). I join everybody else in requesting an updated/final version of this which could replace the old apolyton one.

I request that you alphabetize the API calls in the left panel, so I can quickly scroll to the "getXXX" section and see all the possible get's in one place.

Also, when it's done, please consider installing it at the resurrected civiv wiki: http://civ4.wikidot.com/
 
Ok, I'll see what I can do. The problem is that 3.17 add some new stuff and it takes me a week of just strait working on it to get an API done, there has got to be a better way (there is but I'm lazy).

Isn't that one listed in my API already?
 
Yes, it is listed in yours, but not in the apolyton one everybody is using. That is why I would like to see yours finished up and published.
 
Back
Top Bottom