Skip to content

nl_mcm_module

github-actions[bot] edited this page Jun 1, 2024 · 52 revisions

Documentation (nl_mcm_module)

Author: NeverLost

Version: 1.1.4

This documents the new API functions in nl_mcm.
For the original mcm Api, see link.
Only STATE api functions are supported as part of the new api.

Overview

Properties

Events

Functions

Properties

int property DEBUG_FLAG_E = 0x00 autoreadonly

Empty debug flag


int property DEBUG_FLAG_T = 0x01 autoreadonly

Trace debug flag


int property DEBUG_FLAG_N = 0x02 autoreadonly

Notification debug flag


int property OK = 1 autoreadonly

Error return code for general success


int property ERROR = 0 autoreadonly

Error return code for general errors


int property ERROR_MODULE_FULL = -1 autoreadonly

Error return code for max module/page limit being reached


int property ERROR_MODULE_TAKEN = -2 autoreadonly

Error return code for module/page name being taken


int property ERROR_MODULE_INIT = -3 autoreadonly

Error return code for the mcm not being initialized


int property ERROR_MODULE_NONE = -4 autoreadonly

Error return code for the mcm not containing the given module/page name


int property ERROR_MCM_NONEQUEST = -10 autoreadonly

Error return code for the mcm quest editorid not being found


int property ERROR_MCM_NONE = -20 autoreadonly

Error return code for the mcm quest not having a nl_mcm script attached


int property FONT_TYPE_DEFAULT = 0x00 autoreadonly

Default type font


int property FONT_TYPE_PAPER = 0x01 autoreadonly

Paper type font


nl_mcm property UNSAFE_RAW_MCM hidden

Grab the pointer to the main mcm script.
Note: You can speed up your script by using this, but you better know what you are doing.

Get: The nl_mcm script


bool property IsMCMInitialized hidden

Check if the mcm has actually finished initializing.

Get: Get the initialized status of the mcm


bool property IsMCMOpen hidden

Check if the mcm is open and in-focus by the user.

Get: Get the mcm open state


bool property IsModuleRegistered hidden

Check if the module is registered to a mcm.

Get: Get the module's state


bool property PlayerUpdatedOptions hidden

Check if the user has changed any of the mcm options.

Get: Get the update state for the current session


int property QuickHotkey hidden

If this hotkey is set, it allows the user to immediately open or close the mcm menu
by pressing the defined hotkey.

Get: Get the current quickhotkey for the mcm

Set: Set the new quickhotkey for the mcm


string property PageName

Get the current page name assigned to the module.

Get: Get the current page name assigned to the module

Set: !!!!DO NOT SET THIS PROPERTY OUTSIDE OF THE CREATION KIT!!!!


int property PageOrder

Get the current display order of the module's page name.

Get: Get the current display order of the module's page name

Set: !!!!DO NOT SET THIS PROPERTY OUTSIDE OF THE CREATION KIT!!!!


int property CurrentMCMID hidden

Useful to get the mcm's currently assigned mod id.
Note: Don't cache this, as it might change on gamereloads.

Get: Mcm id


int property CurrentFont hidden

Useful to check for the current font.

Get: Get the current font


int property OPTION_FLAG_NONE = 0x00 autoReadonly

See the original SkyUI API.


int property OPTION_FLAG_DISABLED = 0x01 autoReadonly

See the original SkyUI API.


int property OPTION_FLAG_HIDDEN = 0x02 autoReadonly

See the original SkyUI API.


int property OPTION_FLAG_WITH_UNMAP = 0x04 autoReadonly

See the original SkyUI API.


int property LEFT_TO_RIGHT = 1 autoReadonly

See the original SkyUI API.


int property TOP_TO_BOTTOM = 2 autoReadonly

See the original SkyUI API.


int property CurrentVersion hidden

NL_MCM's page based version of CurrentVersion.
See the original SkyUI Advanced Features.

Get: Refer to the SkyUI API


Events

event OnVersionUpdate(int new_version)

NL_MCM's page based version of OnVersionUpdate().
See the original SkyUI Advanced Features.

Flags:

  • Marked as override

Params:

  • new_version - Refer to the SkyUI API

event OnGameReload()

NL_MCM's page based version of OnGameReload.
Does not require you to call parent.OnGameReload() as with SkyUI.
See the original SkyUI Advanced Features.

Flags:

  • Marked as override

event OnConfigClose()

See the original SkyUI API.

Flags:

  • Marked as override

event OnPageInit()

NL_MCM's page based version of OnConfigInit.
See the original SkyUI API.

Flags:

  • Marked as override

event OnPageDraw()

NL_MCM's page based version of OnPageReset.
See the original SkyUI API.

Flags:

  • Marked as override

event OnDefaultST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnHighlightST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnSelectST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnSliderOpenST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnMenuOpenST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnColorOpenST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnSliderAcceptST(string state_id, float f)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states
  • f - Refer to the SkyUI API

event OnMenuAcceptST(string state_id, int i)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states
  • i - Refer to the SkyUI API

event OnColorAcceptST(string state_id, int col)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states
  • col - Refer to the SkyUI API

event OnInputOpenST(string state_id)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states

event OnInputAcceptST(string state_id, string str)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states
  • str - Refer to the SkyUI API

event OnKeyMapChangeST(string state_id, int keyCode)

See the original SkyUI API.

Flags:

  • Marked as override

Params:

  • state_id - The nl_mcm advanced state id. Ignore this variable if you are not using advanced states
  • keycode - Refer to the SkyUI API

Functions

string function DEBUG_MSG(string msg = "", int flag = 0x01)

Debug helper function for error messages.
Prints to a given debug channel in the format "NL_MCM(ModName, ScriptName, PageName): msg".

Params:

  • msg - Error message
  • flag - Which debug channel to use.
    Use either Empty, Trace, Notifications, or combinations (just add the flags together) FLAG_T + FLAG_N

Return: The concatted error message


int function RegisterModule(string page_name, int z = 0, string quest_editorid = "")

Register the module/page to a mcm.

Params:

  • page_name - The page name to display in the mcm
  • z - The z index of the module/page in the mcm page list. Lower values will appear first
  • quest_editorid - The editor id of the quest containing the nl_mcm script. Defaults to the same quest as the module is attached to

Return: The error code


int function RenameModule(string page_name)

Rename the module's page name in the attached mcm.

Params:

  • page_name - The new page name

Return: The error code


nl_mcm_module function GetOtherModule(string page_name)

Get another module/page from the attached mcm.

Return: The nl_mcm_module script. Remember to cast this value to your own extending script type


int function UnregisterModule()

Unregister the module/page from the attached mcm.

Return: The error code


int function UnregisterAllModules()

Unregister all modules/pages from the attached mcm.

Return: The error code


string function FONT_PRIMARY(string text = "")

Wraps a string in the FONT_PRIMARY type formatting.
Switches automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color

string function FONT_SECONDARY(string text = "")

Wraps a string in the FONT_SECONDARY type formatting.
Switches automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color

string function FONT_SUCCESS(string text = "")

Wraps a string in the FONT_SUCCESS type formatting.
Switches automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color

string function FONT_DANGER(string text = "")

Wraps a string in the FONT_DANGER type formatting.
Switches automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color

string function FONT_WARNING(string text = "")

Wraps a string in the FONT_WARNING type formatting.
Switches automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color

string function FONT_INFO(string text = "")

Wraps a string in the FONT_INFO type formatting.
Switches automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color

string function FONT_CUSTOM(string text = "", string color)

Wraps a string in a custom font type formatting.
Does not switch automatically depending on the installed UI skin.

Params:

  • text - The string to wrap in color
  • color - The color code, RGB format (#FFFFFF)

string function GetCommonStore(bool lock)

Get the shared common store string.
NOTE: Always lock the storage if you are planning on using SetCommonStore afterwards.

Params:

  • lock - If the shared common store should lock changes from other pages

Return: The common store string


function SetCommonStore(string new_value)

Set the shared common store string.
NOTE: This will always unlock the common store

Params:

  • new_value - The new string

function SetModName(string name)

Set the mod page name. Can only be used before the mcm has been initialized.

Params:

  • name - The mod's name

function SetLandingPage(string page_name)

Set the mcm landing page.

Params:

  • page_name - The landing page's name

function SetSplashScreen(string path, float x = 0.0, float y = 0.0)

Set a splash screen to use for the "" page of the mcm menu.

Params:

  • path - File path of the splash screen
  • x - The x position of the splash screen
  • y - The y position of the splash screen

function SetFont(int font = 0x00)

Set font type.
See: Default Color and Paper Color.

Params:

  • font - The new font type

function SetPersistentMCMPreset(string preset_path)

Set the preset file path that will be used to persist user settings across save games.

Params:

  • preset_path - The path to the preset to save and load settings to/from

function AddParagraph(string text, string format = "", int flags = 0x01)

A convenience function to add a paragraph of text to the mcm page.
Text splitting occurs when the max line length is reached,or when a newline character (\n) is encountered.
NOTE: You need to use the format parameter for fonts

Params:

  • text - The text to add as a paragraph to the page
  • format - The format/font to wrap the text in.
  • flags - The default flag of the added text options

function SetSliderDialog(float value, float range_start, float range_end, float interval, float default = 0.0)

A convenience function to set all of the slider data using only 1 function.

Params:

  • value - The value the slider is set at
  • range_start - The start value of the slider
  • range_end - The end value of the slider
  • interval - The interval at which increments/decrements are done to the value
  • default - The default value of the slider

function SetMenuDialog(string[] options, int start_i, int default_i = 0)

A convenience function to set all of the menu data using only 1 function.

Params:

  • options - The array containig the options for the menu
  • start_i - The start selection/index of the menu
  • default_i - The default selection/index for the menu

function ForcePageListReset(bool stay = true)

Refreshes the mod's mcm page list.
Useful for situations where new pages/modules have been registered whilst the player is still in the mod's mcm menu,
which will require the page list to be refreshed.

Params:

  • stay - Should the user stay on the page

function GoToPage(string page_name)

Go to a given mcm page.

Params:

  • page_name - The page to go to

function OpenMCM(string landing_page_name = "")

Open the attached mcm.

Params:

  • landing_page_name - If set to a valid page name, it will open the mcm at this page

function CloseMCM(bool close_journal = false)

Close the attached mcm.

Params:

  • close_journal - If set to true, it will close the quest journal too

string function GetFullMCMPresetPath(string preset_path)

Gets the full path for a given preset_path

Params:

  • preset_path - The local path to the stored preset

Return: The full preset path


function SaveMCMToPreset(string preset_path)

Calls the local SaveData function on all module scripts, storing the resulting JObjects under the given file name.

Params:

  • preset_path - The path to the preset to store the settings under

function LoadMCMFromPreset(string preset_path)

Calls the local LoadData function on all module scripts, using the JObjects loaded from the given file.

Params:

  • preset_path - The path to the preset to load settings from

int function GetNumMCMSavedPresets(string dir_path = "")

Get the number of saved presets.

Params:

  • dir_path - The directory path of the presets. Defaults to current mcm menu directory

Return: Number of saved presets at given path


string[] function GetMCMSavedPresets(string default, string dir_path = "")

Get an array containing the name of all saved presets.

Params:

  • default - A default string to fill the list with. Used to create a "fake exit" button for mcm menus
  • dir_path - The directory path of the presets. Defaults to current mcm menu directory

Return: Saved preset names at given path


function DeleteMCMSavedPreset(string preset_path)

Delete a given preset from the settings folder.

Params:

  • preset_path - The path to the preset to delete

function SetCursorFillMode(int a_fillMode)

See the original SkyUI API.

Params:

  • a_fillMode - Refer to the SkyUI API

int function AddHeaderOption(string a_text, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_text - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

Return: Refer to the SkyUI API


int function AddEmptyOption()

See the original SkyUI API.

Return: Refer to the SkyUI API


function AddTextOptionST(string a_stateName, string a_text, string a_value, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_value - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function AddToggleOptionST(string a_stateName, string a_text, bool a_checked, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_checked - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function AddSliderOptionST(string a_stateName, string a_text, float a_value, string a_formatString = "{0}", int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_value - Refer to the SkyUI API
  • a_formatString - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function AddMenuOptionST(string a_stateName, string a_text, string a_value, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_value - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function AddColorOptionST(string a_stateName, string a_text, int a_color, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_color - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function AddKeyMapOptionST(string a_stateName, string a_text, int a_keyCode, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_keyCode - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function AddInputOptionST(string a_stateName, string a_text, string a_value, int a_flags = 0)

See the original SkyUI API.

Params:

  • a_stateName - Refer to the SkyUI API
  • a_text - Refer to the SkyUI API
  • a_value - Refer to the SkyUI API
  • a_flags - Refer to the SkyUI API

function SetOptionFlagsST(int a_flags, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_flags - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetTextOptionValueST(string a_value, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetToggleOptionValueST(bool a_checked, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_checked - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetSliderOptionValueST(float a_value, string a_formatString = "{0}", bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API
  • a_formatString - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetMenuOptionValueST(string a_value, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetColorOptionValueST(int a_color, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_color - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetKeyMapOptionValueST(int a_keyCode, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_keyCode - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetInputOptionValueST(string a_value, bool a_noUpdate = false, string a_stateName = "")

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API
  • a_noUpdate - Refer to the SkyUI API
  • a_stateName - Refer to the SkyUI API

function SetSliderDialogStartValue(float a_value)

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API

function SetSliderDialogDefaultValue(float a_value)

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API

function SetSliderDialogRange(float a_minValue, float a_maxValue)

See the original SkyUI API.

Params:

  • a_minValue - Refer to the SkyUI API
  • a_maxValue - Refer to the SkyUI API

function SetSliderDialogInterval(float a_value)

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API

function SetMenuDialogStartIndex(int a_value)

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API

function SetMenuDialogDefaultIndex(int a_value)

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API

function SetMenuDialogOptions(string[] a_options)

See the original SkyUI API.

Params:

  • a_options - Refer to the SkyUI API

function SetColorDialogStartColor(int a_color)

See the original SkyUI API.

Params:

  • a_color - Refer to the SkyUI API

function SetColorDialogDefaultColor(int a_color)

See the original SkyUI API.

Params:

  • a_color - Refer to the SkyUI API

function SetInputDialogStartText(string a_value)

See the original SkyUI API.

Params:

  • a_value - Refer to the SkyUI API

function SetCursorPosition(int a_position)

See the original SkyUI API.

Params:

  • a_position - Refer to the SkyUI API

function SetInfoText(string a_text)

See the original SkyUI API.

Params:

  • a_text - Refer to the SkyUI API

function ForcePageReset()

See the original SkyUI API.


function LoadCustomContent(string a_source, float a_x = 0.0, float a_y = 0.0)

See the original SkyUI API.

Params:

  • a_source - Refer to the SkyUI API
  • a_x - Refer to the SkyUI API
  • a_y - Refer to the SkyUI API

function UnloadCustomContent()

See the original SkyUI API.


bool function ShowMessage(string a_message, bool a_withCancel = true, string a_acceptLabel = "$Accept", string a_cancelLabel = "$Cancel")

See the original SkyUI API.

Params:

  • a_message - Refer to the SkyUI API
  • a_withCancel - Refer to the SkyUI API
  • a_acceptLabel - Refer to the SkyUI API
  • a_cancelLabel - Refer to the SkyUI API

Return: Refer to the SkyUI API


int function GetVersion()

NL_MCM's page based version of GetVersion().
See the original SkyUI Advanced Features.

Flags:

  • Marked as override

Return: Refer to the SkyUI API


int function SaveData()

Requires JContainers to function.
Function to save the page's/module's data to a MCM preset. Use jContainers to create a object type of your choice and store the data in it.

Flags:

  • Marked as override

Return: Your jContainer object id


function LoadData(int jObj)

Requires JContainers to function.
Function to load the page's/module's data from a MCM preset. Use jContainers to load the object data you previously stored in SaveData().

Flags:

  • Marked as override

Params:

  • jObj - The jContainer object id returned from loading the preset data

Clone this wiki locally