Skip to content

Group Conditions

Parapets edited this page Jan 14, 2022 · 3 revisions

Group conditions allow you to enable or display different sets of MCM Controls under different circumstances.

For example, a mod's Advanced Settings can be set to display only if a toggle labeled Show Advanced Options is turned on, and otherwise stay hidden if the option is off.

To do this, assign all controls belonging to the advanced options to a group ID.

{
  ... // (an advanced option control)
  "groupCondition": 1
  "groupBehavior": "hide"     // Optional. Defaults to "disable".
}

The possible groupBehavior values are disable, hide, and skip. The skip option allows you to dynamically change the layout of a page, but you will need to call ForcePageReset from the Papyrus script in order to update a page that is already shown.

Then assign the groupControl property with the same group ID to the control whose state should determine whether the group is displayed.

{
  ... // (the Show Advanced Options switcher)
  "groupControl": 1
}

The display state of controls with groupCondition = 1 will now be controlled by the state of the control with groupControl = 1.

Advanced Conditions

More complex conditions can be created with the AND and OR operators.

The following are equivalent:

Display if groupControl 1 is true.

  • "groupCondition": 1
  • "groupCondition": [1]
  • "groupCondition": {"OR": [1]}

Display if groupControl 1 is false.

  • "groupCondition": {"NOT": 1}

Display if either groupControl 1 OR 2 is true.

  • "groupCondition": [1, 2]
  • "groupCondition": {"OR": [1, 2]}

Display if both groupControl 1 AND 2 are true.

  • "groupCondition": {"AND": [1, 2]}

Display if both groupControl 1 AND 2 are true and all others groupControls at this page false.

  • "groupCondition": {"ONLY": [1, 2]}