Announcement

Collapse
No announcement yet.

Python reference question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Python reference question

    Question to the modders from the beta (though if anybody else knows the answer, feel free to contribute ).

    I was playing around with the UI stuff some, and it's pretty nifty how you can change the interface through scripting. However, I was a little stuck on this: where is the code that does the popups in the game that allow you to pick a build order for a city or a tech to research? (Ya know then one, shows you a list of available shtuff and the two recommended choices on top.) I grepped the python files for 'recommended' and for 'tech' and 'building' but came up blank. So... In case someone knows where this stuff is and can cut my searching time by sharing the info, that would be teh awesome.

    Vovan
    XBox Live: VovanSim
    xbox.com (login required)
    Halo 3 Service Record (I fail at FPS...)
    Spore page

  • #2
    While most of the UI is indeed quite moddable, there are still some hardcoded elements, and this is one of them But 'hardcoded' in this case just means 'defined in the SDK' of course, so in a few months it will be moddable

    In the meantime, you *can* however overwrite what the recommended options are in GameUtils.py.
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #3
      Just out of curiosity, Locutus, can you say why they are hardcoded? I mean, the main reason I wanted to see them was not to actually mod them, but to see how this stuff is done in Python. Is there anything fancy going on there that cannot be done in Python, or is it just a matter of the screens accessing some functionality that is not exposed to the scripts?

      Vovan
      XBox Live: VovanSim
      xbox.com (login required)
      Halo 3 Service Record (I fail at FPS...)
      Spore page

      Comment


      • #4
        Initially the entire UI would be hardcoded, but soon the devs found out how easy it was to do it in Python, so they started to migrate more and more of the UI to Python. Some things were kept hard-coded though, probably mostly because it's just double work.

        Don't pin me down on this but I think the only thing that's hard-coded because it's hard to do (or otherwise undesirable) in Python is mouse-over help. The rest (very little) is probably either laziness or lack of time
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #5
          I thought I'd post this here, as its UI related:

          I've been looking throught the python code for the various interface screens, and think I have a basic grasp of how its setup - certainly looks like there's a lot of power and possibilities there.

          The one thing I can't seem to figure out, however, is the city screen. As far as I can see there is no city /screen/ as such, its just another set of interface overlays on the main screen(CvMainInterface.py). The updateCityScreen function then seems to handle updating these elements on redraw if that data has changed (by reading from pHeadSelectedCity) and then shows them if CyInterface().isScreenUp() is true.

          Which makes sense, but I can't work out where or how CyInterface().isScreenUp() is set in the first place. Or how one would set pHeadSelectedCity to any arbitrary city - not necessarily the one that is selected.

          Has anyone got any clues? Or is there a reference to the CyInterface class anywhere?

          thanks

          Comment

          Working...
          X