Announcement

Collapse
No announcement yet.

multiple choice window question

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

  • multiple choice window question

    Hi!

    I'm trying to merge some modifications.
    While doing this, I had an idea.
    How would it be, if there was a menu popup before the first turn where I could choose, which integrated modification i would like to activate for the game and which not.
    My vision is a multiple choice window that returns a value for each modification to the CvEventManager.py; from this point I know how to program this.
    But how to program a popup window with multiple choice options that returns these values?
    If someone's got a hint, I would be very pleased.

  • #2
    *push* no one's got an idea?

    Comment


    • #3
      I haven't actually done this but you can use the class CyPopupInfo() to create a popup with multiple buttons and use the setOnClickedPythonCallback function to call a function that will en/disable certain features depending on which button was pressed. See CvAdvisorUtils.py (for the popup) and CvScreenInterface.py (for the callback) for a few examples.

      Alternatively you could define a completely new screen to do this, that would give you a lot more power (e.g. checkboxes, drop-down menus, etc) but is also a bit more work. See pretty much the whole Python/Screens folder for examples
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        I creatd a popup, but i don't know, how to get the values of the checked and unchecked boxes

        Is there anybody who can help me with this?

        PHP Code:
        from CvPythonExtensions import *
        import CvUtil
        import PyHelpers
        import Popup 
        as PyPopup
        import CvCustomEventManager
        import random
        import ScreenInput
        from CvPythonExtensions import 
        *
                    
        # globals
        gc CyGlobalContext()
        localText CyTranslator()
        UserProfile CyUserProfile()

        class 
        ModChooser:
            
        def __init__(self):
                
        self.list = []

            
        def onGameStart(selfargslist):
                
        'Mods wählen'
                
        CvUtil.pyPrint('Test')
                
        CvCustomEventManager.CvCustomEventManager().beginEvent(7505)

                    
            
        def eventModChooserBegin(selfargslist):
                
        popup PyPopup.PyPopup(7505EventContextTypes.EVENTCONTEXT_ALL)
                
        popup.setHeaderString('ModChooser')
                
        popup.createPythonCheckBoxes(121)
                
        popup.setCheckBoxText(0'GreenMod'1)
                
        popup.setCheckBoxText(1'AbandonRazeDemolish'1)
                
        popup.setCheckBoxText(2'FreeTech'1)
                
        popup.setCheckBoxText(3'Terraform'1)
                
        popup.setCheckBoxText(4'SettlerReligion'1)
                
        popup.setCheckBoxText(5'CulturalDecay'1)
                
        popup.setCheckBoxText(6'RealFort'1)
                
        popup.setCheckBoxText(7'Caravan'1)
                
        popup.setCheckBoxText(8'TechErforscht'1)
                
        popup.setCheckBoxText(9'Leader'1)
                
        popup.setCheckBoxText(10'Adaption'1)
                
        popup.setCheckBoxText(11'CivII'1)
                
        popup.addButton("OK")
                
        popup.launch(FalsePopupStates.POPUPSTATE_IMMEDIATE)
                return


            
        def eventModChooserApply(selfplayerIDuserDatapopupReturn):
                return 

        Comment

        Working...
        X