View Full Version : Python question
GIR Sep 01, 2007, 03:18 PM Python question:
Some events in BTS gives you a +commerce on some Plots.
Is there a python function that i can use to do this?
thx
snarko Sep 01, 2007, 03:27 PM Try CyGame().setPlotExtraYield(int iX, int iY, int /*YieldTypes*/ eYield, int iExtraYield)
GIR Sep 01, 2007, 03:32 PM thx a lot!!
GIR Sep 02, 2007, 10:56 AM my new mod works thx to the python code!
http://forums.civfanatics.com/showthread.php?p=5902629#post5902629
where do you found this command? I don't find a complete BTS API.
Sto Sep 02, 2007, 11:07 AM The BtS API by Zebra 9 (http://forums.civfanatics.com/showthread.php?t=238839) . If you want all the functions in a single file ... sometimes usefull with the search function . You can launch this function via civ4 : ( It creates "CvPythonExtensions.hlp.txt" in the main folder . cf CvAppInterface.py )
import CvPythonExtensions
import CvUtil
import sys
helpFile=file("CvPythonExtensions.hlp.txt", "w")
sys.stdout=helpFile
import pydoc
pydoc.help(CvPythonExtensions)
helpFile.close()
sys.stdout=CvUtil.RedirectDebug()
Tcho !
snarko Sep 02, 2007, 11:07 AM I searched in the SDK.
GIR Sep 02, 2007, 11:22 AM The BtS API by Zebra 9 (http://forums.civfanatics.com/showthread.php?t=238839) . If you want all the functions in a single file ... sometimes usefull with the search function . You can launch this function via civ4 : ( It creates "CvPythonExtensions.hlp.txt" in the main folder . cf CvAppInterface.py )
import CvPythonExtensions
import CvUtil
import sys
helpFile=file("CvPythonExtensions.hlp.txt", "w")
sys.stdout=helpFile
import pydoc
pydoc.help(CvPythonExtensions)
helpFile.close()
sys.stdout=CvUtil.RedirectDebug()
Tcho !
jeha, the Zebra API isn't complete yet.
it's very interesting but i'm some kind of n00b and have no idea how to create this file :D
is it possible you just upload it? (because i think a howto would be too much work for you - and plz dont say it's in the python console because that thing don't work for me)
Sto Sep 02, 2007, 11:30 AM Not this time :) the how to is very simple , and it can be usefull to recreate the file with updates and different versions :
_ go to \<civ4 folder>\Assets\Python\EntryPoints
_ put a copy of CvAppInterface.py in your CustomAssets
_ change PythonHelp = 0 to 1 in init()
def init():
# for PythonExtensions Help File
PythonHelp = 0 # 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
help(CvPythonExtensions)
helpFile.close()
sys.stderr=CvUtil.RedirectError()
sys.excepthook = CvUtil.myExceptHook
sys.stdout=CvUtil.RedirectDebug()
_ launch civ4 and it's done .
Tcho !
i'll upload the file if you still want it ...
GIR Sep 02, 2007, 12:07 PM you are my hero!
that makes things much easier!
Fabrysse Sep 03, 2007, 01:59 AM Sto, :goodjob: you are my hero too !
Thanks a lot !!!!
diamondblast Aug 20, 2008, 08:22 AM Try CyGame().setPlotExtraYield(int iX, int iY, int /*YieldTypes*/ eYield, int iExtraYield)
Hi man, nice explanation ,I'm kind of a newbie here :) I had similar problem and
I tried your way and it works fine - just wanted to say thanks!
|
|