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

Issue with Screens Popping Up

Discussion in 'Civ4 - SDK/Python' started by cybrxkhan, Aug 15, 2010.

  1. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    Hello all! I'm almost done with my mod, World of Legends, after a long hiatus, but again and again I keep encountering the same issue with the screens in the game.

    Basically, the problem is that some of the game screens don't pop up when they're supposed to - for example, the screen that asks for a city's name when you found one; or the screen that pops up when you finish researching a technology, showing the quote and what the technology provides; or the screen that appears when you found your first religion, asking you if you want to adopt it or not; etc. etc. etc.

    I am assuming that this is a python issue. As for python itself, I have several of The J's small modcomps in my mod, as well as other small interface modcomps; however, the largest modcomp I have is Orion's Inquisition mod, of which I did some minor adjustments to.

    Can anyone direct me to a certain python file that may be the root of the problem, or give me suggestions as to where the issue originates from?

    Thank you so much in advance.
     
  2. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    The city name, tech, and religion pop-up screens are done in CvEventManager.py, in the onCityBuilt, onTechAcquired ,and onReligionFounded event handlers respectively.

    So the first thing to do is to compare your mod's version of these functions with the original BtS versions and make sure that the code in the original version that does this is still in the modified version.
     
  3. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    Just checking, do you have python alerts disabled? Generally this behavior is because there was a python error. Once you see the text of the error, you can generally figure it out, or at least ask a more specific question here.
     
  4. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Also, try to figure out what all the different bits of code in the Event Manager does. Because it could be that you're calls are conflicting, intercepting or otherwise not making any sense with all the other stuff in there.

    You could brake it down by starting anew with a fresh copy of the CvEventManager module and adding your stuff one line at the time. Make sure to test each component before moving on the the next, and you might just catch the culprit in the act.

    Other than that, are you using several Event Managers/Handlers with your mod? Because those could easily be executing code in the wrong order, so you might have to make your own setup from scratch. Because this sounds to me like a issue with combining different mod components.

    Also, and this is an embarrassing thing to ask: Do you have Python exceptions enabled? :blush: edit: davidallen beat me to the punch! :p
     
  5. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    Thank you all so much for your help. I guess I forgot to enable python exceptions the last few times I tested. Anyhow, unsurprisingly, I got a whole crapload of python exceptions when I loaded the game, as seen here:

    Spoiler :


    Anyhow, the first thing I noticed was that when I played the game with python exceptions enabled, the entire interface disappeared in-game, although I'm guessing that it's the result of having python exceptions enabled, somehow.

    Since the exceptions stated that the CvGameInterface failed to load, I looked into the CvGameInterface.py and found this:

    Code:
    # # MODDERS - If you create a GameUtils file, update the CvGameInterfaceFile reference to point to your new file
    I was wondering whether this can possibly be (one of) the cause of the problems, and what does it mean?

    Thank you so, so much again for helping me, since my python skills are basically nil.
     

    Attached Files:

  6. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Your supposed the read the Traceback. On the first line it says: "most recent call last", so the Traceback is presented in chronological order then, with the original callup first - ending with the actual line of code that caused the exception. This would be line #75 in CvScreenInterface.py - if you look in there you should find what the actual exception is referring to:
    Code:
    Attribute Error: 'module' object has no attribute 'CvTechChooser'
    This might not mean much to you, but this is what the error basically is: the code is referencing the "attribute" CvTechChooser belonging to the CvScreenInterface module, but there is none to be found. You are probably missing a line like this in CvScreenInterface.py:
    Code:
    import CvTechChooser
    The rest of the Traceback tells where the call to CvScreenInterface originally came from line #5 in the Inquisition.py file. Because all these calls are made during "load_module" I'm guessing that the line is something like this:
    Code:
    import CvScreenInterface
    The call to Inquisition.py was in turn made from InquisitionGameUtils.py line #12 - I'm gonna go out on a limb and say it reads:
    Code:
    import Inquisition
    ...and so on.
     
  7. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    Thank you very much for the tips, and sorry for making you post all that.

    After thinking over it a bit, my original suspicions - of my blotched merging of the Inquisition mod with my mod being the cause of the problem - seems to be confirmed. I suppose I will try your original suggestion of removing suspicious files of code and re-merging them into your mod, and seeing what happens. Apparently after I tried to fix this, the interface got even worse, so I think I have no other alternative. Thanks again for your help, anyhow.
     
  8. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Did you try adding this line to CvScreenInterface.py:
    Code:
    import CvTechChooser
    ?
     
  9. cybrxkhan

    cybrxkhan Asian Xwedodah

    Joined:
    Aug 10, 2006
    Messages:
    9,687
    Location:
    The Universe
    The line was already present in the file, apparently.

    Anyhow I somehow f***ed the interface up enough that it won't even show anymore. I guess the only option I have now is to remove the Inquisition mod (which is most likely the cause of this problem), and hope that everything else is fine.

    Thanks for the suggestion, anyhow!
     

Share This Page