1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

BtS Python API

Discussion in 'Civ4 - Modding Tutorials & Reference' started by Zebra 9, Aug 17, 2007.

  1. Zebra 9

    Zebra 9 Chieftain

    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
     
  2. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    Much appreciated, thanks.
     
  3. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    You are welcome. :thumbsup:
     
  4. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    Awesome Zebra 9. :cool:

    Keep up the good work, it is much appriceated. :)
     
  5. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    Your welcome.:thumbsup:
     
  6. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
    Is this updated for BTS 3.13?

    :)
     
  7. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    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.
     
  8. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    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).
     
  9. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    Awesome, can't wait for the new release.
     
  10. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
    I agree, I'm eager for it too :)
     
  11. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    I'll see if I can get it done this weekend (having computer trouble).
     
  12. Kalimakhus

    Kalimakhus Chieftain

    Joined:
    May 8, 2007
    Messages:
    1,249
    This is really helpful. I hope you are still working on this documentation because it is much needed. I think you may be aware of the warlords Python API docs here: http://civilization4.net/files/modding/PythonAPI/ . My question is wouldn't it be easier to update it for BTS and add the missing parts?
     
  13. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    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. ;)
     
  14. NikNaks

    NikNaks Chieftain

    Joined:
    Jul 25, 2006
    Messages:
    2,972
    Location:
    England
    Any update on this?
     
  15. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    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. ;)
     
  16. NikNaks

    NikNaks Chieftain

    Joined:
    Jul 25, 2006
    Messages:
    2,972
    Location:
    England
    Awesome. I'm trying to learn Python and an update of this would help a ton.
     
  17. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    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. ;)
     
  18. davidlallen

    davidlallen Chieftain

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    (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/
     
  19. Zebra 9

    Zebra 9 Chieftain

    Joined:
    May 17, 2006
    Messages:
    1,554
    Location:
    Middle of Cyberspace
    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?
     
  20. davidlallen

    davidlallen Chieftain

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    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.
     

Share This Page