Jump to content

Odd MCM behavior for hidden options


kryptopyr

Recommended Posts

I've run across some strange behavior from several of the MCMs I've created. The situation is when I'm choosing to hide/reveal certain options based on whether or not other options are selected. The hidden option appears to be hidden (visually, at least), but it is still getting registered by OnOptionHighlight when trying to click on the option that replaced it.

 

So for example, my script would look something like this:

 

If bExtraOption

OIDAdvOption = AddToggleOption(....)
endif
OIDRegOption = AddToggleOption(....)

 

Everything works perfectly if bExtraOption is true and all options are revealed on the MCM screen. The problem arises when bExtraOption is false. Visually, everything seems to work as expected: OIDAdvOption is hidden, and OIDRegOption appears in the spot where OIDAdvOption would have been. However, if I try to select or change OIDRegOption, the option doesn't work, and the text that appears at the bottom of the screen is the OnOptionHighlight text for OIDAdvOption, not the text for OIDRegOption.

 

Has anyone else encountered this problem or have any ideas on how to solve it?

 

This has happened now in three of my mod menus. In some cases I've been able to get around the issue by simply rearranging the text options, so the hidden options are at the bottom of the page, but that isn't necessarily ideal since there's a certain order I'd like to have the options appear when they're available.

 

If you want to see this in action, look at the menu of Complete Crafting Overhaul. On the "mods" page the options for Jewelcraft and Jaysus swords are experiencing this problem.

 

Any help or suggestions on how to resolve this would be greatly appreciated.

 

Link to comment
Share on other sites

Put the "hidden" option where you want it. Toggle its status from disabled to enabled as needed. It won't be hidden but it will be greyed out and non-modifiable.

 

A working example is best:

 

 

This following code(s) are for a particular page in a mod that I have not yet released....

	SetCursorFillMode(TOP_TO_BOTTOM)
	SetCursorPosition(0)
	AddHeaderOption("$IMS: Bag of Holding")
	OIDBOH = AddToggleOption("$IMS: Bag of Holding", UseBOH)
	If UseBOH == false
		OIDBOHMesh = AddMenuOption("$BOH Mesh", MeshChoice[BOHIndex],OPTION_FLAG_DISABLED)
	Else	
		OIDBOHMesh = AddMenuOption("$BOH Mesh", MeshChoice[BOHIndex],OPTION_FLAG_NONE)
	EndIf
	SetCursorPosition(1)
	AddHeaderOption("$Options")
	OIDBOHQT = AddToggleOption("$Transfer registered items to/from BOH", UseBOHQT)
	If UseBOHQT == false
		OIDBOHQTHK = AddKeyMapOption("$Hotkey to transfer BOH items",HKBOHQT,OPTION_FLAG_DISABLED)
	Else
		OIDBOHQTHK = AddKeyMapOption("$Hotkey to transfer BOH items",HKBOHQT,OPTION_FLAG_NONE)
	EndIf
 

The above only makes the options viable when the page is reset.

 

To make the options viable when conditions change while on the same page, this is needed in the selection section of the initial choices.

	If option == OIDBOH
		UseBOH = !UseBOH
		SetToggleOptionValue(OIDBOH, UseBOH)
		If UseBOH == true
			SetOptionFlags(OIDBOHMesh,OPTION_FLAG_NONE)
		Else	
			SetOptionFlags(OIDBOHMesh,OPTION_FLAG_DISABLED)
		EndIf
	ElseIf option == OIDBOHQT
		UseBOHQT = !UseBOHQT
		SetToggleOptionValue(OIDBOHQT,UseBOHQT)
		If UseBOHQT == true
			SetOptionFlags(OIDBOHQTHK,OPTION_FLAG_NONE)
		Else
			SetOptionFlags(OIDBOHQTHK,OPTION_FLAG_DISABLED)
		EndIf
	EndIf
 

 

 

Link to comment
Share on other sites

Thank you; that's a good idea and is a viable solution for CCO.

 

However, it won't really work for another mod I'm currently working on, where I want an entire column of options to change based on the user's selections. Do you think disabling and hiding the options might work?

Link to comment
Share on other sites

No. Because MCM goes by position. We see it as the text labels that we give it. But behind the scenes MCM is referring to each entry as an entry of an array. This is why each page is limited to 128 lines (64 per side). If you completely hide one or more entries and others come up to take their place, results can be unpredictable.

 

 

Theoretically this might work. I have not tested it.

 

 

;page reset code
OID_A = AddToggleOption("Option A", USE_A)
If USE_A == true
	OID_B = AddToggleOption("Option B", USE_B)
Else
	OID_B = AddToggleOption("Option C", USE_C)
EndIf

;option selection code
If option == OID_A
	USE_A = !USE_A
	SetToggleOptionValue(OID_A,USE_A)
ElseIf option == OID_B
	If USE_A == true
		USE_B = !USE_B
		USE_C = false
		SetToggleOptionValue(OID_B,USE_B)
	Else
		USE_C = !USE_C
		USE_B = false
		SetToggleOptionValue(OID_B,USE_C)
	EndIf
EndIf 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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