Jump to content

Help with an MCM menu update issue


Carreau

Recommended Posts

So I have a mod I have two exclusive options. Within my script, if the user enables one, it'll check if the other option is turned on. If it is, it turns it off and forces an MCM refresh to capture the change in state. The states are changing, but not being shown in MCM. If I exit back to the game and then re-enter MCM, the switchers are correctly shown.

Function OptionOneEnable(bool isEnabled)
	If(isEnabled)
		OptionOneIsEnabled = True	
		If(OptionTwoIsEnabled)
			OptionTwoIsEnabled = False
			MCM.SetModSettingBool("TestMod", "bOptionTwo:Main", False)
                        MCM.RefreshMenu()
		EndIf
                debug.messagebox("Option One has been enabled.")
	Else
		OptionOneIsEnabled = False
	EndIf
EndFunction

;MCM code

{
            "id": "bOptionOne:Main",
            "text": "Enable Option One",
            "type": "switcher",
            "valueOptions": {
                "sourceType": "ModSettingBool"
                },
                    "action": {
                        "type": "CallFunction",
                        "form": "TestMod.esp|FA1",
                        "function": "OptionOneEnable",
                        "params": ["{value}"]
                        }
},

The option bools are enabled through mod settings in MCM.

 

Option two is identically done in a separate function. This is obviously working in script, I'm just trying to figure out why MCM isn't changing.

Any help is appreciated.

Link to comment
Share on other sites

I understand that both variables are on the same page.

I think MCM.RefreshMenu() command sent to the wrong page, if the little arrow is somewhere in another place, not on the same page.

I have this problem with my mod MoreAGOMBz.

Link to comment
Share on other sites

It was a case sensitivity issue. I forgot JSON doesn't like if you capitalize the T or F in true/false. It's working as intended now.

 

Edit: for those that may stumble upon this. Whatever you pass through SetModSetting commands is exactly what the JSON sees. So formatting should be handled correctly. For bools, it has to be true and false. Not True and False or TRUE and FALSE. Iâm guilty of using capitalization for my boolean.

Edited by Carreau
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...