HOW to python in-game?

ooo6ooo

Chieftain
Joined
Aug 8, 2006
Messages
7
HOW can I immediately see the changes of the python files in game without restarting the game? thx
 
thanks.
I've tried this but nothing changed, should I change some configs in the civilizationIV.ini file?
 
ooo6ooo said:
thanks.
I've tried this but nothing changed, should I change some configs in the civilizationIV.ini file?

Make sure that the python files you're changing were loaded before the game starts. In other words, if you add python files to the mod directory AFTER the game has started, I don't believe Civ4 will notice the files until you restart.

Also, python modules don't reload for multiplayer mode (for obvious reasons).

Finally, to test if the python module actually has reloaded, make sure you see "Python Modules Reloaded" at the top of the screen when you alt-tab back into the game. If you don't see this, then the code isn't being reloaded (perhaps you've accidentally put the python file in a mod directory and you've actually had vanilla loaded this whole time?), so you should check that the python files get loaded in the first place (sometimes I do this is put some garbage at the top of the file file and see if you get the error message... ugly, but it works).

If you DO see the "Python Modules Reloaded" message, but still don't see results, then you've probably got a bug in your code. Check the log files, because if there was an error the python code typically just traces back without doing a single line of code more, thus not getting to the line of code where you think should be making the city blow up. You don't see the city blow up, so you think the python files aren't reloading, when they really are. The best test is to look for the "Python Modules Reloaded" message.
 
I am new at python. I just press alt-tab in the game, opened "\Warlords\Assets\Python\Screens\CvInfoScreen.py" file and changed

fMilitary = pPlayer.getPower() * 1000

to

fMilitary = pPlayer.getPower() * 1

then save it.
but when back into the game, I did not see any messages on the screen. and when I press F9 to the demographics screen, there is nothing changed.
 
ooo6ooo said:
I am new at python. I just press alt-tab in the game, opened "\Warlords\Assets\Python\Screens\CvInfoScreen.py" file and changed

fMilitary = pPlayer.getPower() * 1000

to

fMilitary = pPlayer.getPower() * 1

then save it.
but when back into the game, I did not see any messages on the screen. and when I press F9 to the demographics screen, there is nothing changed.

I'd have to recommend not changing the files inside of the main Warlords folder, but rather copying any files you do want to change into the Custom Assets folder (using the same folder structure) and changing them there. This won't help with your reloading issue, but if you mess up a python file in the main folder, you'll have to completely reinstall to restore the file.

As for why it's not reloading, I really am not sure. I don't think there's something else that you need to do, it's always just worked for me.
 
I have copied it to the Custom Assets folder. Thank you very much!
Maybe I should delete the ini file and wish the regeneration of a new one...
 
Back
Top Bottom