• 📚 Admin Project Update: I've added a major feature to PictureBooks.io called Avatar Studio! You can now upload photos to instantly turn your kids (and pets! 🐶) into illustrated characters that star in their own stories. Give it a try and let me know what you think!

python changes to UI and debugging

Change the python file and save. My experience is that on some computers it works and on some computers the game won't notice I'm not entirely sure what the difference is, but it works on my current computer so I'm not investigating.

One note though. When reloading a python file the game clears all the variables in that file so if you say open an advisor screen and then change it, you might get a lot of errors about using uninitialized variables. It's better to close it, save the file and then open the screen again. Editing the main interface file might be a hassle because of this.
 
anyone knows how can i make changes to the python ui without restarting the game for every single change i do?
Sometimes you need to switch to another ingame screen and come back to the screen you changed to have it refresh.
But for most changes in Python all you need to do is to save the Python file and it will refreshes with your changes instantly.
 
Last edited:
With the BUG mod, I always(?) get a bunch of unhandled Python exceptions upon reloading scripts, and then part of the screen may not get updated properly, Advisors may become inaccessible, will need to exit and restart (screenshot from BUG 4.4 attached; reload caused by a change to CvMainInterface.py). So, as far as I can tell, editing scripts at runtime isn't really possible with BUG-based mods. In AdvCiv, I've gotten things to a point where reloading will often succeed, and, when it doesn't, making another change (to the same script, or maybe a different one), will usually do the trick. But I don't know enough about Python and the BUG design to fix this properly. A bit strange that BUG introduced those issues; as a Python-only mod, you'd think that its creators themselves would've been greatly inconvenienced.
 

Attachments

  • BUG-py-crash.jpg
    BUG-py-crash.jpg
    169.3 KB · Views: 52
Has anyone found a way for reloading python modules with the game running using BUG mod?
My mod is BUG based and a Shift-F5, Shift-F8 usually does the job if you get errors
once errors show up the interface disappears (with AND mod)
 
sry for my late answer: if you make python changes during game, just save the turn and load that save (without restarting the game). this works about 7-10 times then it comes to a ctd. no worry about that, just start the game and load the save. then you can change python files again 7-10 times during game play.

if you do not save/load after you change a python file, then lots of python features will be ignored and those features will not work anymore. it helps to set python error in civ.ini to 1. once a python error occurs, all other python things in the background won't work anymore.
 
Back
Top Bottom