View Full Version : Need a small favour...


Locutus
Mar 16, 2006, 04:12 PM
... from someone with both Python and Civ4 v1.52 installed -- as ATM I don't.

I need the pydoc information from v1.52 so I can hopefully generate a detailed change log of the Python API in the new patch. This should benefit all Python coders, as there are quite a few changes (nothing too mind-blowing but interesting enough to be aware of).

To obtain that file, I need someone who has Python installed on his/her system, and of course also the v1.52 patch, to do the following:

1) Open [Civ4 dir]\Assets\Python\EntryPoints\CvAppInterface.py and set PythonHelp = 1 in the init() function. Save the file (duh).

2) Start Civ4 and begin a new game (or a savegame, whatever).

3) Go to [Civ4 dir]\logs, you should find the file CvPythonExtensions.hlp.txt there. This is the file I need. I don't know how uploading files work on CFC, but you can upload it here or on Apolyton (or somewhere else for that matter), or email me at locutus@apolyton.net

4) Change PythonHelp back to 0 (for a teeny tiny increase in performance).

I would much appreciate it...

Sto
Mar 16, 2006, 04:46 PM
Sorry i try ,but that doesn't work . If someone can post this file ,i'm interrested too !
thanks,tcho !

12monkeys
Mar 16, 2006, 05:35 PM
I tried it as well. Have Python on my system and did exactly what you told. Result : global name "help" is not defined.
Seems to be, that the link between Civ4 and Python did not work.

Locutus
Mar 16, 2006, 06:25 PM
Crap, then that apparently isn't fixed until the upcoming patch. I thought that was in v1.52 already. Oh well, in that case, replace the init() function with the following:

def onInit(self, argsList):
'Called when Civ starts up'
# for PythonExtensions Help File
PythonHelp = 1 # doesn't work on systems which haven't installed Python

# dump Civ python module directory
if PythonHelp:
import CvPythonExtensions
helpFile=file("log\CvPythonExtensions.hlp.txt", "w")
sys.stdout=helpFile
import pydoc
pydoc.help(CvPythonExtensions)
helpFile.close()

sys.stderr=CvUtil.RedirectError()
sys.excepthook = CvUtil.myExceptHook
sys.stdout=CvUtil.RedirectDebug()
CvUtil.pyPrint( 'OnInit' )

Then it should work.

12monkeys
Mar 17, 2006, 03:52 PM
Well, that works. But the resulting document seems to be have the same contents as we already have at sthurlows (http://sthurlow.com/cvDocs/cvDoc/CvActionInfo.htm) and are very similar to the ones at civilization4.net (http://civilization4.net/files/modding/PythonAPI/). Now I know, how they gathered all the information ;).

Anyway, here is the document you requested. .

Locutus
Mar 17, 2006, 04:26 PM
Well, that works. But the resulting document seems to be have the same contents as we already have at sthurlows (http://sthurlow.com/cvDocs/cvDoc/CvActionInfo.htm) and are very similar to the ones at civilization4.net (http://civilization4.net/files/modding/PythonAPI/). Now I know, how they gathered all the information ;).

Basically, yes, that's the point :) The second link you mentioned is maintained by me, and I'm in the process of making it up-to-date for the new patch. To see what changed between that patch and v1.52, I needed this file. But it's not exactly the same as those links. First, those links are in HTML format, I can't run a file-compare on those with the CyPythonExtensions.hlp.txt file of the new patch. If I used those as source, I'd have to go through them manually, line-by-line, which at 15,000 lines would probably take me about 3 months :) Second, the first link seems to be for v1.09 or similar (at least older than v1.52) and the second one (mine) is even for v1.00. I needed the v1.52 version specifically.

Anyway, here is the document you requested. .

Thanks. Someone at Apolyton posted the same earlier this evening though, so I didn't actually need it anymore -- I was still busy analysing the file or I would've updated this thread, sorry. But I can tell you now that the new patch, if the version I have is indeed the final one (which it almost certainly is), will make 250 changes to the API, mostly by adding new functions. They're largely not very spectacular changes, but I'm pretty sure some of the new functions will find their way into people's scripts before too long.

I will post the list (and the updated API) as soon as the patch is released, lest I violate my NDA otherwise.

(BTW, my API docs do not use this txt file for its information (the other one does), because it isn't nearly complete enough (no type info) and too error-prone as it's maintained by hand. My script to generate that document taps directly into the source code (where possible) to ensure the information is 100% complete and accurate.)

12monkeys
Mar 17, 2006, 04:47 PM
Basically, yes, that's the point :) The second link you mentioned is maintained by me, and I'm in the process of making it up-to-date for the new patch.
Let me take the chance to say thank you for that page. First of all it was a tremendous help for all of us python modders, even it was not up-to-date. Without the information from that page, we would have made far less progress than we did. Although there is nearly the same information at sthurlows, your one is way more comfortable to use. Very good job :goodjob:

Locutus
Mar 18, 2006, 12:58 AM
You're welcome :) When the new patch is out I plan on taking the whole API concept to a new level, which I think/hope you'll like even more. Stay tuned... ;)

matthewv
Mar 18, 2006, 01:01 AM
you keep talking about a new patch. Is there a new patch coming out that we don't know about?(are you talking about the SDK?) If so when is it supposed to be released?

Locutus
Mar 18, 2006, 01:24 AM
Well, if you don't know about it, you should, lord knows there's been plenty of discussion about it (specifically about how it keeps being delayed)... But yes, there will be a very large new patch that includes the SDK, Pitboss and a bunch of other stuff, such as countless bug fixes and performance improvements. It will be released 'soon' (sorry, can't be more specific, it's in the hands of 2K Games, not Firaxis).

matthewv
Mar 18, 2006, 01:36 AM
Thank you, I know about the sdk but I wasn't sure whether that is what you were refering to.

The Great Apple
Mar 18, 2006, 05:53 AM
You're welcome :) When the new patch is out I plan on taking the whole API concept to a new level, which I think/hope you'll like even more. Stay tuned... ;)Oooh - a new level! Sounds like fun.

Thanks for updating this one!

The Great Apple
Mar 18, 2006, 02:52 PM
Hmmm, still when comparing both APIs GBM's seems to contain quite a bit more informaion (comparing the CyInterface class, for example).

Locutus
Mar 18, 2006, 04:38 PM
No, I never said I had already updated the public API on Apolyton, I can't do that until the patch is released. It would violate my NDA and not be very useful because of the large differences between v1.52 and the new patch. I made the change list to make it easier for coders to see what new options they have and if they need to adapt their existing scripts (some functions have been renamed/removed or have different arguments/return type) once the patch is out. But down-grading my new API to v1.52 would have to be done manually and take a fair bit of time, and since the new patch is due 'soon' (and I've been told that this time they really mean it), that's just not worth the effort. I don't have all that much time to begin with, so I'd rather spend it on that new level of mine ;)

If the patch isn't released by this time next week though, and I don't get a concrete indication of when it will be, I will seriously consider downgrading and updating the API on Apolyton to v1.52.

The Great Apple
Mar 18, 2006, 04:42 PM
No, I never said I had already updated the public API on Apolyton, I can't do that until the patch is released. It would violate my NDA and not be very useful because of the large differences between v1.52 and the new patch. I made the change list to make it easier for coders to see what new options they have and if they need to adapt their existing scripts (some functions have been renamed/removed or have different arguments/return type) once the patch is out. But down-grading my new API to v1.52 would have to be done manually and take a fair bit of time, and since the new patch is due 'soon' (and I've been told that this time they really mean it), that's just not worth the effort. I don't have all that much time to begin with, so I'd rather spend it on that new level of mine ;)

If the patch isn't released by this time next week though, and I don't get a concrete indication of when it will be, I will seriously consider downgrading and updating the API on Apolyton to v1.52.
Ahhh, my mistake. I thought you had updated the API to v1.52. Got confused there.