Is it possible to dynamically populate a pulldown menu in Advanced Setup?

MyopicCat

Chieftain
Joined
Jan 6, 2014
Messages
73
I'm making a small mod that lets you reduce the number of City States in a game by adding an extra pulldown menu to the Advanced Setup screen. (Unfortunately it seems currently impossible to *increase* the CS count.) Then I modded AssignStartingPlots.lua so it sets the number of City States according to whatever was selected in the pulldown.

So far that works fine, but I hardcoded the number of City States that can be selected like this:
Code:
<GameInfo>
    <Parameters>
        <Row ParameterId="CityStatesNumber" Name="LOC_CITY_STATES_NUMBER_NAME" Description="LOC_CITY_STATES_NUMBER_DESCRIPTION" Domain="CityStatesNumber" DefaultValue="DEFAULT_NUMBER" ConfigurationGroup="Map" ConfigurationId="CityStatesNumber" GroupId="MapOptions" Hash="0" SortIndex="1000"/>
    </Parameters>  

    <DomainValues>
        <Row Domain="CityStatesNumber" Value="DEFAULT_NUMBER" Name="LOC_MAP_CITY_STATES_DEFAULT_NAME" Description="LOC_MAP_CITY_STATES_DEFAULT_DESCRIPTION" SortIndex="10"/>
        <Row Domain="CityStatesNumber" Value="0" Name="LOC_MAP_CITY_STATES_ZERO_NAME" Description="LOC_MAP_CITY_STATES_ZERO_DESCRIPTION" SortIndex="20"/>
        <Row Domain="CityStatesNumber" Value="1" Name="1" Description="1"/>
        <Row Domain="CityStatesNumber" Value="2" Name="2" Description="2"/>
        <Row Domain="CityStatesNumber" Value="3" Name="3" Description="3"/>
        <Row Domain="CityStatesNumber" Value="4" Name="4" Description="4"/>
        <Row Domain="CityStatesNumber" Value="5" Name="5" Description="5"/>
    </DomainValues>
</GameInfo>

Now I would like to dynamically populate the pulldown menu from zero up to the default number of city states (which is 1.5 * number of major Civs, rounded down). Is this at all possible in a mod?

There are some interesting sections in the lower half of /Base/Assets/Configuration/Data/SetupParameters.xml that suggest that this may be possible by using <Queries> and other tags to integrate SQL queries of the configuration database into the setup screen. Or am I misunderstanding what these queries can do?
 
Top Bottom