Jump to content

(SOLVED) How to access MCM menu variables?


trepleen

Recommended Posts

So I made an MCM menu, but no where does it explain how to actually access the variables that get changed via the menu.

 

How can you access int aOID from other scripts in another quest? The SkyUI MCM Menu tutorial shows you how to make a menu, but not how to access the variables for actual use in your scripts.

 

scriptname kd_script_mcmmenu extends SKI_ConfigBase

int aOID

bool aVal = false

 

int function GetVersion()
return 1 ; Default version
endFunction

 

event OnPageReset(string a_page)

    SetCursorFillMode(TOP_TO_BOTTOM)

    AddHeaderOption("Player")
    aOID = AddToggleOption("Nord Male Short", true)

endEvent

event OnOptionHighlight(int a_option)

    if (a_option == aOID)
        SetInfoText("Check this if you've made your Nord male shorter in Character Maker Extended by a value of -0.02, this will ensure a different set of animations are played for the height adjustment.\nDefault: false")
    endIf

endEvent

event OnOptionSelect(int a_option)

    if (a_option == aOID)
        aVal = !aVal
        SetToggleOptionValue(aOID, aVal)
    endIf

endEvent

event OnOptionDefault(int a_option)

    if (a_option == aOID)
        aVal = false
        SetToggleOptionValue(aOID, aVal)
    endIf

endEvent



 

Link to comment

The OID is internal to the menu, and only used to identify the shown button in the menu. In your example the actual value you want to use is aVal. That you can access like any other variable in scripts, it's nothing more special than any other variable. Make it a property so you can use myMCMscript.aVal, or write a getter function for it.

Link to comment

declare aVal as a public variable

bool property aval auto

 

or make a function that serves the private variable

Function getVal()

return aVal

EndFunction

 

then in your other script:

kd_script_mcmmenu property mcmScript auto --> needs to be filled

 

and:

debug.notification(mcmScript.aVal) // or

debug.notification(mcmScript.getVal())

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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