Jump to content

Is there a way to introduce delay function in MCM?


3aq

Recommended Posts

Was wondering if it's possible to put a time delay for a line.

 

Something I was thinking about

 

Toggle (Click this to toggle and toggle will appear, but will reset in 10 seconds due to page resetting.)

 

Delay (10000);

 

ForcePageReset()

Link to comment
Share on other sites

In order to get toggle options to "work" with my MCM.

 

The MCM I have is a dispenser of txt files, user has options to pick w/e they want pretty much, ie it's very configurable. Problem with that is, it's impossible to separate the settings between saves because the settings are altered via txt; so if I am understanding this correctly ... it means that in order for MCM to know which type of txt is being used it'll be required to scan numerous txt and pair it with the one currently being used, then match it to a number. There's also the challenge of figuring out how to script a function that disables all toggles within a group before toggling the one being clicked. This is seems far too technical for me..

 

So instead, I've opted for a simpler, you get to see which option you ticked then the tick will be cleaned off from the page after x seconds.

Link to comment
Share on other sites

I am still confused on your usage of TXT files with MCM.

 

Anyway, disabling / enabling a group of options based on the status of another option is real simple. Working example:

 

A simple toggle on or off based on current status when the page is reset. Code from the OnPageReset event

        If FissActive == true
            FISSInterface fiss = FISSFactory.getFISS()
            If fiss
                AddToggleOptionST("SavePreset","$SavePreset",PresetSave,OPTION_FLAG_NONE)
                AddToggleOptionST("LoadPreset","$LoadPreset",PresetLoad,OPTION_FLAG_NONE)
            Else
                AddToggleOptionST("SavePreset","$SavePreset",PresetSave,OPTION_FLAG_DISABLED)
                AddToggleOptionST("LoadPreset","$LoadPreset",PresetLoad,OPTION_FLAG_DISABLED)
            EndIf
        Else
            AddToggleOptionST("SavePreset","$SavePreset",PresetSave,OPTION_FLAG_DISABLED)
            AddToggleOptionST("LoadPreset","$LoadPreset",PresetLoad,OPTION_FLAG_DISABLED)
        EndIf
 

Take this a step further and not only disable / enable based on current status but disable / enable based on another option

Code from the OnPageReset event

        AddTextOptionST("ToggleState"+0, "$Use Alchemy Supplies", ComponentBehave[cbc0])
        If ComponentChoice[0] == 0
            AddTextOptionST("AutoSortState"+0,"$Auto-Store", AutoStoreBehave[asc0],OPTION_FLAG_DISABLED)
            AddToggleOptionST("Weightless"+0,"$Weightless", WeightlesActive[0],OPTION_FLAG_DISABLED)
            AddToggleOptionST("MerchExcl"+0,"$MerchExcl", MerchExclActive[0],OPTION_FLAG_DISABLED)
            AddToggleOptionST("RedoItems"+0,"$RedoItems", RedoItemsActive[0],OPTION_FLAG_DISABLED)
        Else
            AddTextOptionST("AutoSortState"+0,"$Auto-Store", AutoStoreBehave[asc0],OPTION_FLAG_NONE)
            AddToggleOptionST("Weightless"+0,"$Weightless", WeightlesActive[0],OPTION_FLAG_NONE)
            AddToggleOptionST("MerchExcl"+0,"$MerchExcl", MerchExclActive[0],OPTION_FLAG_NONE)
            AddToggleOptionST("RedoItems"+0,"$RedoItems", RedoItemsActive[0],OPTION_FLAG_NONE)
        EndIf

Code from the ToggleState state block

State ToggleState0
    Event OnSelectST()
        Int index = 0
        If (cbc0 < ComponentBehave.length - 2)
            cbc0 += 1
        Else
            cbc0 = 0
        EndIf
        ComponentChoice[index] = cbc0
        SetTextOptionValueST(ComponentBehave[cbc0])
        If ComponentChoice[index] != 0
            SetOptionFlagsST(OPTION_FLAG_NONE, false, "AutoSortState"+index)
            SetOptionFlagsST(OPTION_FLAG_NONE, false, "Weightless"+index)
            SetOptionFlagsST(OPTION_FLAG_NONE, false, "MerchExcl"+index)
            SetOptionFlagsST(OPTION_FLAG_NONE, false, "RedoItems"+index)
        Else
            AutoStoreChoice[index] = 0
            SetTextOptionValueST(AutoStoreBehave[0], false, "AutoSortState"+index)
            SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "AutoSortState"+index)

            WeightlesActive[index] = false
            SetToggleOptionValueST(WeightlesActive[index],false,"Weightless"+index)
            SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "Weightless"+index)

            MerchExclActive[index] = false
            SetToggleOptionValueST(MerchExclActive[index],false,"MerchExcl"+index)
            SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "MerchExcl"+index)

            RedoItemsActive[index] = false
            SetToggleOptionValueST(RedoItemsActive[index],false,"RedoItems"+index)
            SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "RedoItems"+index)
        EndIf
    EndEvent
    Event OnDefaultST()
        Int index = 0
        ComponentChoice[index] = 0
        SetTextOptionValueST(ComponentBehave[0])

        AutoStoreChoice[index] = 0
        SetTextOptionValueST(AutoStoreBehave[0], false, "AutoSortState"+index)
        SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "AutoSortState"+index)

        WeightlesActive[index] = false
        SetToggleOptionValueST(WeightlesActive[index],false,"Weightless"+index)
        SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "Weightless"+index)

        MerchExclActive[index] = false
        SetToggleOptionValueST(MerchExclActive[index],false,"MerchExcl"+index)
        SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "MerchExcl"+index)

        RedoItemsActive[index] = false
        SetToggleOptionValueST(RedoItemsActive[index],false,"RedoItems"+index)
        SetOptionFlagsST(OPTION_FLAG_DISABLED, false, "RedoItems"+index)
    EndEvent
    Event OnHighlightST()
        SetInfoText("$AlchToggleInfo")
    EndEvent
EndState

What this does is the user gets presented with a single active option to choose how the alchemy container works: "Not Used" or "Non-Quest Item"

Other similar containers also have a "Quest Item" selection. At any rate, if the user picks anything but "Not Used" (at index 0) the other options become active for selection.

 

The key here is the use of the OPTION_FLAG_DISABLED and OPTION_FLAG_NONE flags within the different MCM function calls. For more information:

Set Option Flags

 

 

 

In looking further at the MCM FAQ page, I did notice that within the very last entry is a suggestion to use WaitMenuMode. I have never used it, so cannot state whether it would work for your needs.

Link to comment
Share on other sites

ty for the helpful informative IsharaMeradin. I overlooked FISSES, this changes things. In meantime I'll be sure to give that last function a try.

Edited by 3aq
Link to comment
Share on other sites

well damn, stupid question; how do I attach FISSES into a script? The furthest I was able to do is extends SKI configbase.

 

I wish to perform that example posted in the spoiler. apologies, and thanks.

Link to comment
Share on other sites

well damn, stupid question; how do I attach FISSES into a script? The furthest I was able to do is extends SKI configbase.

 

I wish to perform that example posted in the spoiler. apologies, and thanks.

The FISSES description page indicates that for the API information one should check out the original FISS. Everything you need to know should be there.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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