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

Why is it...

Discussion in 'Rhye's and Fall Modmods' started by Baldyr, Dec 26, 2009.

  1. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    ...that when I'm working with the Python files in RFC, restarting the scenario, testing and doing changes - all of the sudden one of the .py files stops working. It will do nothing at all. And just now that file worked just fine, and I was trying to get another file to work the I had intended.

    Example: After much trial and error I managed to get both the cities and the the units to spawn correctly (Barbs.py) - only to realize that improvements have stopped spawning (Resources.py), without any reason for it what so ever! Its not the file I was working on - and it worked fine five minutes ago!

    Now I may have to start all over again...:mad:
     
  2. Deon

    Deon Lt. of Mordor

    Joined:
    Jan 13, 2008
    Messages:
    2,954
    Location:
    St.Petersburg, Russian Federation
    Do you make it while the game is launched? You have to restart Civ4 every time you've made your python changes.
     
  3. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I try some things out while testing, and it works mostly. (I also read in some guide that it should. It says so on the screen that the Python is being reloaded, by the way.) But most of the time I'm restarting the scenario to see if everything is triggered on schedule. (Instead of changing the turn triggers ad-hoc while testing.)

    I may not restart the game all that often, but when something isn't working at all I of course try everything including a re-boot of my PC. When one of the .py files stop working there is nothing I can do to make them work, so I backup my work and replace everything with the original files. Then I start copy-pasting in my own stuff, one feature at a time, to see if everything works. And, in the end it does. I just don't get why this happens in the first place.:confused:

    My best guess, as an amateur, is that it has something to do with formatting - either of the code or the files themselves. (Notepad seems to save the files in ANSI format. Should I change it to Unicode instead?)
     
  4. 3Miro

    3Miro Chieftain

    Joined:
    Apr 23, 2008
    Messages:
    3,480
    Location:
    Knoxville USA
    1. You have to restart Civ to make sure the python files are reloaded. Actually sometimes they will reload on runtime, however, depending on the changes, the result may be bad.

    2. Enable debug info from My Games\Beyond the Sword\CivilizationIV.ini (open it with notepad or textpad or some other text editor). LoggingEnabled = 1. Then you can check for python errors in My Games\Beyond the Sword\Logs\PythinErr.log.

    What you describe can be due to the following: one module partially fails, then the next is not loaded at all. Thus some things may seem to work, while others will not work at all (even though they have not been changed).
     
  5. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Yeah, I might try to spawn some unit while in-game, since it takes so long for autoplay to finish every time. But if it doesn't work, I'll try going to back to Main Menu or restart completely. I guess I should do the latter more...:rolleyes:

    I'll take a look at this. Probably I should have read up on my Python guides more, but they were mostly Greek to me...:crazyeye:

    Yeah, it seems almost like one .py file stops working half way and the next one doesn't even load. I guess debugging would give me some answers then.

    Thanks for you help!:)
     
  6. 3Miro

    3Miro Chieftain

    Joined:
    Apr 23, 2008
    Messages:
    3,480
    Location:
    Knoxville USA
    If you are debugging a game after autoplay, you can save the game, test python, restart the game and load the save from where you were int he first place. The only time this may be an issue is if you are hanging the pickle section, GameData section. The pickle data gets written into the savegame, so if you change it, it may not register when you reload the game.
     

Share This Page