mwse⚓︎
The mwse library provides methods for interacting with MWSE itself, rather than direct TES3 objects.
Properties⚓︎
mwse.buildDate
⚓︎
A numerical representation of the date that version of MWSE currently being used was built on.
Formatted as YYYYMMDD.
Returns:
result
(number)
Example: Check if the user has minimal required MWSE build installed.
-- Ensure we have the features we need.
if (mwse.buildDate == nil or mwse.buildDate < 20210817) then
mwse.log("[Example] Build date of %s does not meet minimum build date of 20210817.", mwse.buildDate)
return
end
mwse.buildNumber
⚓︎
Equal to the APPVEYOR_BUILD_NUMBER
in builds by AppVeyor (these builds are installed using the MWSE-Update). Equal to UINT_MAX
in regular builds. This number is used for mod metadata files, when a mod depends on MWSE being installed.
Returns:
result
(integer)
mwse.gameTimers
⚓︎
The mwseTimerController responsible for game-type timers.
Returns:
result
(mwseTimerController)
mwse.realTimers
⚓︎
The mwseTimerController responsible for real-type timers.
Returns:
result
(mwseTimerController)
mwse.simulateTimers
⚓︎
The mwseTimerController responsible for simulate-type timers.
Returns:
result
(mwseTimerController)
mwse.version
⚓︎
A numerical representation of the release version of MWSE currently being used.
Formatted as AAABBBCCC, where A is the major version, BBB is the minor version, and CCC is the patch version. BBB and CCC are forward-padded.
It is usually better to use mwse.buildDate
instead.
Returns:
result
(integer)
Functions⚓︎
mwse.clearScriptOverride
⚓︎
Configures MWSE to no longer execute a lua function instead when a script would run. This undoes the work of mwse.overrideScript
.
local success = mwse.clearScriptOverride(scriptId)
Parameters:
scriptId
(string)
Returns:
success
(boolean)
mwse.getCurrentMorrowindScriptState
⚓︎
This function returns information on the current mwscript execution state.
local script, reference = mwse.getCurrentMorrowindScriptState()
Returns:
script
(tes3script, nil): The currently executing mwscript script, or nil if none is presently being executed.reference
(tes3reference, nil): The currently executing mwscript script's associated reference. This will be nil for global scripts, or nil if no script is presently being executed.
mwse.getVersion
⚓︎
Equivalent to mwse.version.
local result = mwse.getVersion()
Returns:
result
(integer)
mwse.getVirtualMemoryUsage
⚓︎
Returns the amount of memory used, in bytes.
local result = mwse.getVirtualMemoryUsage()
Returns:
result
(number)
mwse.iconv
⚓︎
Converts the provided string in UTF8 encoding to Morrowind's codepage base encoding.
local converted = mwse.iconv(languageCode, utf8string)
Parameters:
languageCode
(tes3.languageCode): Determines the language (and appropriate encoding) to use. Maps to values intes3.languageCode
table.utf8string
(string): The string to convert
Returns:
converted
(string)
mwse.loadConfig
⚓︎
Loads a config table from Data Files\MWSE\config\{fileName}.json.
If the default values table is passed:
- Empty keys in the config will be filled in using its values.
- If no file exists, the function will return the default table.
- In json, tables can be either arrays with integer keys or dictionaries with string keys. If your configuration table is mixed (has both string and integer indices), saving and loading from json will effectively convert all your integer indices to strings. This function will convert your configuration table's integer indices back if defaults table is given.
local result = mwse.loadConfig(fileName, defaults)
Parameters:
fileName
(string): The non-extensioned name of the config file.defaults
(table): Optional. A table of default values.
Returns:
result
(table)
mwse.loadTranslations
⚓︎
Loads translations from the i18n folder for a given mod. This is locale-aware, using the result from tes3.getLanguage()
. See the mod translations guide for more information.
local i18n = mwse.loadTranslations(mod)
Parameters:
mod
(string): Name of the folder that your main.lua mod can be found in.
Returns:
i18n
(fun(key: string, data: any): string): The callable translation results.
mwse.log
⚓︎
This function writes information to the mwse.log file in the user's installation directory.
The message accepts formatting and additional parameters matching string.format's usage.
mwse.log(message, ...)
Parameters:
message
(string)...
(any): Optional. Formatting arguments. These are passed tostring.format
.
mwse.longToString
⚓︎
Converts a TES3 object type (e.g. from tes3.objectType) into an uppercase, 4-character string.
local result = mwse.longToString(type)
Parameters:
type
(tes3.objectType, number)
Returns:
result
(string)
mwse.mcm.createActiveInfo
⚓︎
Creates a new ActiveInfo inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, ActiveInfo's UI element tree won't be created. To do so, use ActiveInfo's create
method:
local myActiveInfo = mwse.mcm.createActiveInfo({ ... })
myActiveInfo:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local info = mwse.mcm.createActiveInfo(parent, { label = ..., text = ..., description = ..., variable = ..., defaultSetting = ..., inGameOnly = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createActiveInfo.data, string): The UI element inside which the new ActiveInfo will be created.data
(table, string): Optional. If passing only a string, it will be used as the ActiveInfo's label.label
(string): Optional. The ActiveInfo's label.text
(string): Optional. The ActiveInfo's text.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value.inGameOnly
(boolean): Default:false
.indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMActiveInfo)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
info
(mwseMCMActiveInfo)
mwse.mcm.createButton
⚓︎
Creates a new Button inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, Button's UI element tree won't be created. To do so, use Button's create
method:
local myButton = mwse.mcm.createButton({ ... })
myButton:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local button = mwse.mcm.createButton(parent, { label = ..., buttonText = ..., description = ..., leftSide = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createButton.data): The UI element inside which the new Button will be created.data
(table): Optional.label
(string): Optional. Text shown next to the button.buttonText
(string): Optional. Text shown inside the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMButton)): Optional. The custom function called when the player interacts with this Button.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMButton)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
button
(mwseMCMButton)
mwse.mcm.createColorPicker
⚓︎
Creates a new Color picker inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, Color picker's UI element tree won't be created. To do so, use Color picker's create
method:
local myColorPicker = mwse.mcm.createColorPicker({ ... })
myColorPicker:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local picker = mwse.mcm.createColorPicker(parent, { label = ..., description = ..., alpha = ..., vertical = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createColorPicker.data): The UI element inside which the new ColorPicker will be created.data
(table): Optional.label
(string): Optional. Text shown on the top of the picker.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.alpha
(boolean): Default:false
. Iftrue
the picker will also allow picking an alpha value.vertical
(boolean): Default:false
. Iftrue
, saturation, hue and alpha bars and color previews are created in the second row below the main picker. Iffalse
they are created in the same row as the main picker. Color picker is a large widget and as such, might not fit into a sidebar page or a filter page. It's useful to passvertical = true
to make it fit on those pages.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(mwseColorTable, mwseColorATable): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMColorPicker)): Optional. The custom function called when the player interacts with this Color picker.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMColorPicker)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
picker
(mwseMCMColorPicker)
mwse.mcm.createColorPickerButton
⚓︎
Creates a new ColorPickerButton inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, ColorPickerButton's UI element tree won't be created. To do so, use ColorPickerButton's create
method:
local myColorPickerButton = mwse.mcm.createColorPickerButton({ ... })
myColorPickerButton:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local pickerButton = mwse.mcm.createColorPickerButton(parent, { label = ..., description = ..., alpha = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createColorPickerButton.data): The UI element inside which the new ColorPickerButton will be created.data
(table): Optional.label
(string): Optional. Text shown on the top of the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.alpha
(boolean): Default:false
. Iftrue
the picker will also allow picking an alpha value.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(mwseColorTable, mwseColorATable): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMColorPickerButton)): Optional. The custom function called when the player interacts with this Color picker button.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMColorPickerButton)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
pickerButton
(mwseMCMColorPickerButton)
mwse.mcm.createConfigVariable
⚓︎
Creates a new ConfigVariable.
local variable = mwse.mcm.createConfigVariable({ id = ..., path = ..., defaultSetting = ..., inGameOnly = ..., numbersOnly = ..., restartRequired = ..., restartRequiredMessage = ..., converter = ... })
Parameters:
variable
(table)id
(string): Key in the config file used to store the variable.path
(string): Location of the config file relative to DataFiles/MWSE/config/
.defaultSetting
(unknown): Optional. If there is no value stored by theid
key in the config file, it will be initialized to this value.inGameOnly
(boolean): Default:false
. If true, the setting containing this variable will be disabled if the game is on main menu.numbersOnly
(boolean): Default:false
. If true, only numbers will be allowed for this variable in TextFields.restartRequired
(boolean): Default:false
. If true, updating the setting containing this variable will notify the player to restart the game.restartRequiredMessage
(string): Optional. The default text is a localized version of: "The game must be restarted before this change will come into effect.".converter
(fun(newValue): unknown): Optional. This function is called when the value of the variable is changed. The function can modify the new value before it is saved.
Returns:
variable
(mwseMCMConfigVariable)
mwse.mcm.createCustom
⚓︎
Creates a new Custom variable.
local variable = mwse.mcm.createCustom({ id = ..., getter = ..., setter = ..., inGameOnly = ..., numbersOnly = ..., restartRequired = ..., restartRequiredMessage = ..., converter = ... })
Parameters:
variable
(table)id
(string): Optional. The unique identifier for the variable.getter
(fun(self: mwseMCMCustomVariable): unknown): The custom getter function.setter
(fun(self: mwseMCMCustomVariable, newValue: unknown)): The custom setter function.inGameOnly
(boolean): Default:false
. If true, the setting containing this variable will be disabled if the game is on main menu.numbersOnly
(boolean): Default:false
. If true, only numbers will be allowed for this variable in TextFields.restartRequired
(boolean): Default:false
. If true, updating the setting containing this variable will notify the player to restart the game.restartRequiredMessage
(string): Optional. The default text is a localized version of: "The game must be restarted before this change will come into effect.".converter
(fun(newValue): unknown): Optional. This function is called when the value of the variable is changed. The function can modify the new value before it is saved.
Returns:
variable
(mwseMCMCustomVariable)
mwse.mcm.createCycleButton
⚓︎
Creates a new mwseMCMCycleButton inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, cycle button's UI element tree won't be created. To do so, use cycle button's create
method:
local myButton = mwse.mcm.createCycleButton({ ... })
myButton:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local button = mwse.mcm.createCycleButton(parent, { label = ..., description = ..., options = ..., leftSide = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createCycleButton.data): The UI element inside which the new cycle button will be created.data
(table): Optional.label
(string): Optional. Text shown next to the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.options
(tes3uiCycleButtonOption[]): This table holds the text and variable value for each of the cycle button's options.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMCycleButton)): Optional. The custom function called when the player interacts with this cycle button.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMCycleButton)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
button
(mwseMCMCycleButton)
mwse.mcm.createDropdown
⚓︎
Creates a new Dropdown inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, Dropdown's UI element tree won't be created. To do so, use Dropdown's create
method:
local myDropdown = mwse.mcm.createDropdown({ ... })
myDropdown:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local dropdown = mwse.mcm.createDropdown(parent, { label = ..., description = ..., options = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., idleColor = ..., overColor = ..., pressedColor = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createDropdown.data): The UI element inside which the new Dropdown will be created.data
(table): Optional.label
(string): Optional. The text shown above the dropdown.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.options
(mwseMCMDropdownOption[]): This table holds the text and variable value for each of the dropdown's options.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.idleColor
(number[]): Default:tes3ui.getPalette(tes3.palette.normalColor)
. The idle color for dropdown. Needs to be an RGB trio in the range [0.0, 1.0].overColor
(number[]): Default:tes3ui.getPalette(tes3.palette.normalOverColor)
. The color used when the mouse if hovering over the dropdown. Needs to be an RGB trio in the range [0.0, 1.0].pressedColor
(number[]): Default:tes3ui.getPalette(tes3.palette.normalPressedColor)
. The color used when the dropdown is being pressed. Needs to be an RGB trio in the range [0.0, 1.0].callback
(fun(self: mwseMCMDropdown)): Optional. The custom function called when the player interacts with this Setting.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMDropdown)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
dropdown
(mwseMCMDropdown)
mwse.mcm.createGlobal
⚓︎
Creates a new mwseMCMGlobal variable.
local variable = mwse.mcm.createGlobal({ id = ..., numbersOnly = ..., converter = ... })
Parameters:
variable
(table, string): If passing only a string, it will be used as variable's id.id
(string): The id of the Morrowind Global.numbersOnly
(boolean): Default:false
. If true, only numbers will be allowed for this variable in TextFields.converter
(fun(newValue): unknown): Optional. This function is called when the value of the variable is changed. The function can modify the new value before it is saved.
Returns:
variable
(mwseMCMGlobal)
mwse.mcm.createGlobalBoolean
⚓︎
Creates a new GlobalBoolean variable.
local variable = mwse.mcm.createGlobalBoolean({ id = ... })
Parameters:
variable
(table, string): If passing only a string, it will be used as variable's id.id
(string): The id of the Morrowind Global.
Returns:
variable
(mwseMCMGlobalBoolean)
mwse.mcm.createHyperlink
⚓︎
Creates a new Hyperlink inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, Hyperlink's UI element tree won't be created. To do so, use Hyperlink's create
method:
local myHyperlink = mwse.mcm.createHyperlink({ ... })
myHyperlink:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local hyperlink = mwse.mcm.createHyperlink(parent, { text = ..., description = ..., url = ..., label = ..., inGameOnly = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createHyperlink.data): The UI element inside which the new Hyperlink will be created.data
(table): Optional.text
(string): The Hyperlink's text.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.url
(string): The URL for this hyperlink.label
(string): Optional. The Hyperlink's label. Shown above the Hyperlink's text.inGameOnly
(boolean): Default:false
.indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMHyperlink)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
hyperlink
(mwseMCMHyperlink)
mwse.mcm.createInfo
⚓︎
Creates a new Info inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, Info's UI element tree won't be created. To do so, use Info's create
method:
local myInfo = mwse.mcm.createInfo({ ... })
myInfo:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local info = mwse.mcm.createInfo(parent, { label = ..., text = ..., description = ..., variable = ..., defaultSetting = ..., inGameOnly = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createInfo.data, string): The UI element inside which the new Info will be created.data
(table, string): Optional. If passing only a string, it will be used as the Info's label.label
(string): Optional. The Info's label.text
(string): Optional. The Info's text.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value.inGameOnly
(boolean): Default:false
.indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMInfo)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
info
(mwseMCMInfo)
mwse.mcm.createKeyBinder
⚓︎
Creates a new KeyBinder inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, KeyBinder's UI element tree won't be created. To do so, use KeyBinder's create
method:
local myKeyBinder = mwse.mcm.createKeyBinder({ ... })
myKeyBinder:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local button = mwse.mcm.createKeyBinder(parent, { label = ..., description = ..., allowCombinations = ..., allowMouse = ..., keybindName = ..., leftSide = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createKeyBinder.data): The UI element inside which the new KeyBinder will be created.data
(table): Optional.label
(string): Optional. Text shown next to the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.allowCombinations
(boolean): Default:true
. If true, the KeyBinder will let the user use modification keys: Shift, Ctrl, and Alt when rebinding.allowMouse
(boolean): Default:false
. If true, the KeyBinder will let the user use mouse buttons and scroll wheel in this keybinder. In that case the variable will have mwseKeyMouseCombo layout, mwseKeyCombo otherwise.keybindName
(string): Optional. The keybind name. Shown in the popup menu header. This string is formatted into a localized version of "SET %s KEYBIND.". If none is provided the popup has "SET NEW KEYBIND." as header text.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMKeyBinder)): Optional. The custom function called when the player interacts with this KeyBinder.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMKeyBinder)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
button
(mwseMCMKeyBinder)
mwse.mcm.createMouseBinder
⚓︎
Creates a new MouseBinder inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, MouseBinder's UI element tree won't be created. To do so, use MouseBinder's create
method:
local myMouseBinder = mwse.mcm.createMouseBinder({ ... })
myMouseBinder:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local button = mwse.mcm.createMouseBinder(parent, { label = ..., description = ..., allowCombinations = ..., allowButtons = ..., allowWheel = ..., keybindName = ..., leftSide = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createMouseBinder.data): The UI element inside which the new MouseBinder will be created.data
(table): Optional.label
(string): Optional. Text shown next to the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.allowCombinations
(boolean): Default:true
. If true, the MouseBinder will let the user use modification keys: Shift, Ctrl, and Alt when rebinding.allowButtons
(boolean): Default:true
. If true, the MouseBinder will let the user bind mouse buttons.allowWheel
(boolean): Default:false
. If true, the MouseBinder will let the user bind mouse wheel scroll up or down.keybindName
(string): Optional. The keybind name. Shown in the popup menu header. This string is formatted into a localized version of "SET %s KEYBIND.". If none is provided the popup has "SET NEW KEYBIND." as header text.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMMouseBinder)): Optional. The custom function called when the player interacts with this MouseBinder.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMMouseBinder)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
button
(mwseMCMMouseBinder)
mwse.mcm.createMouseOverInfo
⚓︎
Creates a new MouseOverInfo inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, MouseOverInfo's UI element tree won't be created. To do so, use MouseOverInfo's create
method:
local myMouseOverInfo = mwse.mcm.createMouseOverInfo({ ... })
myMouseOverInfo:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local info = mwse.mcm.createMouseOverInfo(parent, { label = ..., text = ..., description = ..., variable = ..., defaultSetting = ..., inGameOnly = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createMouseOverInfo.data, string): The UI element inside which the new MouseOverInfo will be created.data
(table, string): Optional. If passing only a string, it will be used as the MouseOverInfo's label.label
(string): Optional. The MouseOverInfo's label.text
(string): Optional. The MouseOverInfo's text.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value.inGameOnly
(boolean): Default:false
.indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMMouseOverInfo)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
info
(mwseMCMMouseOverInfo)
mwse.mcm.createOnOffButton
⚓︎
Creates a new OnOffButton inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, OnOffButton's UI element tree won't be created. To do so, use OnOffButton's create
method:
local myOnOffButton = mwse.mcm.createOnOffButton({ ... })
myOnOffButton:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local button = mwse.mcm.createOnOffButton(parent, { label = ..., description = ..., leftSide = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createOnOffButton.data): The UI element inside which the new OnOffButton will be created.data
(table): Optional.label
(string): Optional. Text shown next to the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.callback
(fun(self: mwseMCMOnOffButton)): Optional. The custom function called when the player interacts with this Button.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMOnOffButton)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
button
(mwseMCMOnOffButton)
mwse.mcm.createParagraphField
⚓︎
Creates a new ParagraphField inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, ParagraphField's UI element tree won't be created. To do so, use ParagraphField's create
method:
local myParagraphField = mwse.mcm.createParagraphField({ ... })
myParagraphField:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local paragraphField = mwse.mcm.createParagraphField(parent, { label = ..., buttonText = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., numbersOnly = ..., description = ..., height = ..., sNewValue = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createParagraphField.data): The UI element inside which the new ParagraphField will be created.data
(table): Optional.label
(string): Optional. Text shown above the text field.buttonText
(string): Optional. The text shown on the button next to the input field. The default text is a localized version of: "Submit".variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.numbersOnly
(boolean): Default:false
. If true, only numbers will be allowed in this TextField.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.height
(integer): Optional. Fixes the height of the paragraph field to a custom value.sNewValue
(string): Optional. The message shown after a new value is submitted. This can be formatted with a '%s' which will be replaced with the new value. The default text is a localized version of: "New value: '%s'".callback
(fun(self: mwseMCMParagraphField)): Optional. This allows overriding the default implementation of this methodinGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMParagraphField)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
paragraphField
(mwseMCMParagraphField)
mwse.mcm.createPercentageSlider
⚓︎
Creates a new PercentageSlider
inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, PercentageSlider
's UI element tree won't be created. To do so, use PercentageSlider
's create
method:
local mySlider = mwse.mcm.createPercentageSlider({ ... })
mySlider:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local slider = mwse.mcm.createPercentageSlider(parent, { label = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., min = ..., max = ..., step = ..., jump = ..., decimalPlaces = ..., description = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., convertToLabelValue = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createPercentageSlider.data): The UI element inside which the newPercentageSlider
will be created.data
(table): Optional.label
(string): Optional. Text shown above the slider. If left as a normal string, it will be shown in the form: [label
]: [self.variable.value
]. If the string contains a '%s' format operator, the value will be formatted into it.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.min
(number): Default:0
. Minimum value of slider.max
(number): Default:1
. Maximum value of slider.step
(number): Default:0.01
. How far the slider moves when you press the arrows.jump
(number): Default:0.05
. How far the slider jumps when you click an area inside the slider.decimalPlaces
(integer): Default:2
. The number of decimal places of precision. Must be a positive integer.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.callback
(fun(self: mwseMCMPercentageSlider)): Optional. The custom function called when the player interacts with this Setting.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.convertToLabelValue
(fun(self: mwseMCMPercentageSlider, variableValue: number): number, string): Optional. Define a custom formatting function for displaying variable values.postCreate
(fun(self: mwseMCMPercentageSlider)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
slider
(mwseMCMPercentageSlider)
mwse.mcm.createPlayerData
⚓︎
Creates a new PlayerData variable.
local variable = mwse.mcm.createPlayerData({ id = ..., path = ..., defaultSetting = ..., restartRequired = ..., restartRequiredMessage = ..., converter = ... })
Parameters:
variable
(table)id
(string): Key of entry used on thetes3.player.data
table.path
(string): Path toid
relative totes3.player.data
. The subtable keys need to be split by dots. It's best to at least store all your mwseMCMPlayerData fields in a table named after your mod to avoid conflicts.defaultSetting
(unknown): Optional. Ifid
does not exist in thetes3.player.data
field, it will be initialized to this value. It's best to initialize this yourself though, as this will not create the value until you've entered the MCM.restartRequired
(boolean): Default:false
. If true, updating the setting containing this variable will notify the player to restart the game.restartRequiredMessage
(string): Optional. The default text is a localized version of: "The game must be restarted before this change will come into effect.".converter
(fun(newValue): unknown): Optional. This function is called when the value of the variable is changed. The function can modify the new value before it is saved.
Returns:
variable
(mwseMCMPlayerData)
mwse.mcm.createSlider
⚓︎
Creates a new Slider inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, Slider's UI element tree won't be created. To do so, use Slider's create
method:
local mySlider = mwse.mcm.createSlider({ ... })
mySlider:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local slider = mwse.mcm.createSlider(parent, { label = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., min = ..., max = ..., step = ..., jump = ..., decimalPlaces = ..., description = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., convertToLabelValue = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createSlider.data): The UI element inside which the new Slider will be created.data
(table): Optional.label
(string): Optional. Text shown above the slider. If left as a normal string, it will be shown in the form: [label
]: [self.variable.value
]. If the string contains a '%s' format operator, the value will be formatted into it.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.min
(number): Default:0
. Minimum value of slider.max
(number): Default:100
. Maximum value of slider.step
(number): Default:1
. How far the slider moves when you press the arrows.jump
(number): Default:5
. How far the slider jumps when you click an area inside the slider.decimalPlaces
(integer): Default:0
. The number of decimal places of precision. Must be a nonnegative integer.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.callback
(fun(self: mwseMCMSlider)): Optional. The custom function called when the player interacts with this Setting.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.convertToLabelValue
(fun(self: mwseMCMSlider, variableValue: number): number, string): Optional. Define a custom formatting function for displaying variable values.postCreate
(fun(self: mwseMCMSlider)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
slider
(mwseMCMSlider)
Example: DecimalSlider
The following example shows how to create a slider that keeps the variable value a floating point number with precision of 2 decimal places.
--- @type tes3uiElement, table
local myPage, myConfig
mwse.mcm.createSlider{
parent = myPage,
label = "My slider",
variable = mwse.mcm.createTableVariable{ id = "someval", table = myConfig },
min = 0.00,
max = 1.00,
step = 0.01,
jump = 0.05,
decimalPlaces = 2
}
Example: DistanceSlider
The following example shows how the convertToLabelValue
parameter can be used to create a slider for a config setting that handles distances. The config setting will be stored using game units, but the displayed value will be in real-world units. Recall that 1 game unit corresponds to 22.1 feet, and 1 foot is 0.3048 meters.
--- @type tes3uiElement, table
local myPage, myConfig
mwse.mcm.createSlider{
parent = myPage,
label = "My distance slider",
variable = mwse.mcm.createTableVariable{ id = "distance", table = myConfig },
convertToLabelValue = function(self, variableValue)
local feet = variableValue / 22.1
local meters = 0.3048 * feet
if self.decimalPlaces == 0 then
return string.format("%i ft (%.2f m)", feet, meters)
end
return string.format(
-- if `decimalPlaces == 1, then this string will simplify to
-- "%.1f ft (%.3f m)"
string.format("%%.%uf ft (%%.%uf m)", self.decimalPlaces, self.decimalPlaces + 2),
feet, meters
)
end,
max = 22.1 * 10, -- max is 10 feet
step = 22.1, -- increment by 1 foot
jump = 22.1 * 5,
}
Example: SkillSlider
Here is an (admittedly less practical) example to help highlight the different ways convertToLabelValue
can be used. In this example, it will be used to create a slider that stores a tes3.skill
constant in the config, and then displays the name of the corresponding skill.
--- @type tes3uiElement, table
local myPage, myConfig
mwse.mcm.createSlider{
parent = myPage,
label = "My skill slider",
variable = mwse.mcm.createTableVariable{ id = "skillId", table = myConfig },
convertToLabelValue = function(self, variableValue)
local skillName = tes3.getSkillName(math.round(variableValue))
if skillName then
return skillName
end
return "N/A"
end,
max = 26 -- there are 27 skills and indexing starts at 0
}
mwse.mcm.createTableVariable
⚓︎
Creates a new TableVariable.
local variable = mwse.mcm.createTableVariable({ id = ..., table = ..., defaultSetting = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., converter = ... })
Parameters:
variable
(table)id
(string, number): Key in the config file used to store the variable.table
(table): The table to save the data to.defaultSetting
(unknown): Optional. Ifid
does not exist in the table, it will be initialised to this value.inGameOnly
(boolean): Default:false
. If true, the setting containing this variable will be disabled if the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating the setting containing this variable will notify the player to restart the game.restartRequiredMessage
(string): Optional. The default text is a localized version of: "The game must be restarted before this change will come into effect.".converter
(fun(newValue): unknown): Optional. This function is called when the value of the variable is changed. The function can modify the new value before it is saved.
Returns:
variable
(mwseMCMTableVariable)
mwse.mcm.createTemplate
⚓︎
Creates a new Template.
local template = mwse.mcm.createTemplate({ name = ..., label = ..., config = ..., defaultConfig = ..., showDefaultSetting = ..., headerImagePath = ..., onClose = ..., searchChildLabels = ..., searchChildDescriptions = ..., onSearch = ..., pages = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., inGameOnly = ..., postCreate = ... })
Parameters:
data
(table, string): If passing only a string, it will be used as the Template's name.name
(string): Optional. The name field is the mod name, used to register the MCM, and is displayed in the mod list on the lefthand pane.label
(string): Optional. Used in place ofname
if that argument isn't passed. You need to pass at least one of thename
andlabel
arguments. IfheaderImagePath
is not passed, a UI element will be created withlabel
as text.config
(table): Optional. Stores a config that should be used by this modsSetting
s. Sub-configs can be accessed by passing aconfigKey
to anyPage
s nested inside this template. If provided, this config will be used to generatemwseMCMTableVariable
s for the anymwseMCMSetting
s made inside this template.defaultConfig
(table): Optional. Stores a default config that should be used by this modsSetting
s. This will initialize thedefaultSetting
field of anymwseMCMTableVariable
s created for this mod.showDefaultSetting
(boolean): Optional. Iftrue
, then eachPage
created inside thisTemplate
will haveshowDefaultSetting = true
. This is equivalent to manually writingshowDefaultSetting = true
in the constructor of eachPage
created in thisTemplate
.headerImagePath
(string): Optional. Set it to display an image at the top of your menu. Path is relative toData Files/
. The image must have power-of-2 dimensions (i.e. 16, 32, 64, 128, 256, 512, 1024, etc.).onClose
(fun(modConfigContainer: tes3uiElement)): Optional. Set this to a function which will be called when the menu is closed. Useful for saving variables, such as TableVariable.searchChildLabels
(boolean): Default:true
. If true, default search handler will search through all the page and settinglabel
andtext
fields in this MCM template.searchChildDescriptions
(boolean): Default:true
. If true, default search handler will search through all the page and settingdescription
fields in this MCM template.onSearch
(fun(searchText: string): boolean): Optional. A custom search handler function. This function should return true if this mod Template should show up in search results for givensearchText
.pages
(mwseMCMPage.new.data[]): Optional. You can create pages for the template directly here. The entries in the array must specify the class of the page.indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.inGameOnly
(boolean): Default:false
.postCreate
(fun(self: mwseMCMTemplate)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
template
(mwseMCMTemplate)
mwse.mcm.createTextField
⚓︎
Creates a new TextField inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, TextField's UI element tree won't be created. To do so, use TextField's create
method:
local myTextField = mwse.mcm.createTextField({ ... })
myTextField:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local textField = mwse.mcm.createTextField(parent, { label = ..., buttonText = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., showDefaultSetting = ..., numbersOnly = ..., description = ..., press = ..., sNewValue = ..., minHeight = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createTextField.data): The UI element inside which the new TextField will be created.data
(table): Optional.label
(string): Optional. Text shown above the text field.buttonText
(string): Optional. The text shown on the button next to the input field. The default text is a localized version of: "Submit".variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.showDefaultSetting
(boolean): Default:parentComponent.showDefaultSetting
. Iftrue
, and in a Sidebar Page, then thedefaultSetting
of this setting'svariable
will be shown below itsdescription
. ThedefaultSetting
will be formatted in accordance with theconvertToLabelValue
function. Note: This parameter does not update thedescription
field.numbersOnly
(boolean): Default:false
. If true, only numbers will be allowed in this TextField.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.press
(fun(self: mwseMCMTextField)): Optional. This allows overriding the default implementation of this method. Can be overriden to add a confirmation message before updating. This function should callself:update()
at the end.sNewValue
(string): Optional. The message shown after a new value is submitted. This can be formatted with a '%s' which will be replaced with the new value. The default text is a localized version of: "New value: '%s'".minHeight
(integer): Optional. The minimum height set on theself.element.border
UI element.callback
(fun(self: mwseMCMTextField)): Optional. This allows overriding the default implementation of this method. See its description.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMTextField)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
textField
(mwseMCMTextField)
mwse.mcm.createVariable
⚓︎
Creates a new Variable.
local variable = mwse.mcm.createVariable({ id = ..., inGameOnly = ..., numbersOnly = ..., restartRequired = ..., restartRequiredMessage = ..., converter = ... })
Parameters:
variable
(table, string): Optional. If passing only a string, it will be used as variable's id.id
(string): Optional. The unique identifier for the variable.inGameOnly
(boolean): Default:false
. If true, the setting containing this variable will be disabled if the game is on main menu.numbersOnly
(boolean): Default:false
. If true, only numbers will be allowed for this variable in TextFields.restartRequired
(boolean): Default:false
. If true, updating the setting containing this variable will notify the player to restart the game.restartRequiredMessage
(string): Optional. The default text is a localized version of: "The game must be restarted before this change will come into effect.".converter
(fun(newValue): unknown): Optional. This function is called when the value of the variable is changed. The function can modify the new value before it is saved.
Returns:
variable
(mwseMCMVariable)
mwse.mcm.createYesNoButton
⚓︎
Creates a new YesNoButton inside given parent
menu.
The canonical way to use this function is to pass a parent
and data
arguments. If passing only data
table, YesNoButton's UI element tree won't be created. To do so, use YesNoButton's create
method:
local myYesNoButton = mwse.mcm.createYesNoButton({ ... })
myYesNoButton:create(parent)
The same is done by this function if you pass both parent
and data
arguments.
local button = mwse.mcm.createYesNoButton(parent, { label = ..., description = ..., leftSide = ..., variable = ..., config = ..., defaultConfig = ..., configKey = ..., converter = ..., defaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ... })
Parameters:
parent
(tes3uiElement, mwse.mcm.createYesNoButton.data): The UI element inside which the new YesNoButton will be created.data
(table): Optional.label
(string): Optional. Text shown next to the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting. If not provided, this setting will try to create a variable using theconfig
andconfigKey
parameters, if possible.config
(table): Default:parentComponent.config
. The config to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override the config stored inparentComponent
. Otherwise, the value inparentComponent
will be used.defaultConfig
(table): Default:parentComponent.defaultConfig
. ThedefaultConfig
to use when creating amwseMCMTableVariable
for thisSetting
. If provided, it will override thedefaultConfig
stored inparentComponent
. Otherwise, the value inparentComponent
will be used.configKey
(string, number): Optional. TheconfigKey
used to create a newmwseMCMTableVariable
s. If this is provided, along with aconfig
(which may be inherited from theparentComponent
), then a newmwseMCMTableVariable
s variable will be created for this setting.converter
(fun(newValue: unknown): unknown): Optional. A converter to use for this component'svariable
.defaultSetting
(unknown): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value indefaultConfig
will be used, if possible.callback
(fun(self: mwseMCMYesNoButton)): Optional. The custom function called when the player interacts with this Button.inGameOnly
(boolean): Default:false
. If true, the setting is disabled while the game is on main menu.restartRequired
(boolean): Default:false
. If true, updating this Setting will notify the player to restart the game.restartRequiredMessage
(string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."indent
(integer): Default:12
. The left padding size in pixels. Only used if thechildIndent
isn't set on the parent component.childIndent
(integer): Optional. The left padding size in pixels. Used on all the child components.paddingBottom
(integer): Default:4
. The bottom border size in pixels. Only used if thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMYesNoButton)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.
Returns:
button
(mwseMCMYesNoButton)
mwse.mcm.getKeyComboName
⚓︎
This function returns a localized name for a key combination.
local result = mwse.mcm.getKeyComboName(keyCombo)
Parameters:
keyCombo
(mwseKeyCombo, mwseKeyMouseCombo): Optional.
Returns:
result
(string, nil)
mwse.mcm.getMouseButtonName
⚓︎
This function returns a localized name of the mouse button. You can pass mouseButton
field of mwseKeyMouseCombo
or e.button
from mouseButtonDown
event data.
local result = mwse.mcm.getMouseButtonName(buttonIndex)
Parameters:
buttonIndex
(integer): Optional.
Returns:
result
(string, nil)
mwse.mcm.getMouseWheelName
⚓︎
This function returns a localized name for the mouse wheel direction. You can pass mouseWheel
field of mwseKeyMouseCombo
or e.delta
from mouseWheel
event data.
local result = mwse.mcm.getMouseWheelName(mouseWheel)
Parameters:
mouseWheel
(integer): Optional.
Returns:
result
(string, nil)
mwse.mcm.register
⚓︎
A convenience function that registers the mod's configuration menu using its mwseMCMTemplate.
You don't need to call mwse.registerModConfig
if calling this function.
mwse.mcm.register(template)
Parameters:
template
(mwseMCMTemplate)
mwse.mcm.testKeyBind
⚓︎
This function checks whether a certain key combination is currently pressed. It will only check ctrl, shift and alt modifier keys. It doesn't check mouse.
local pressed = mwse.mcm.testKeyBind(keybind)
Parameters:
keybind
(mwseKeyCombo)
Returns:
pressed
(boolean)
mwse.overrideScript
⚓︎
Configures MWSE to execute a given function instead when a script would run.
In most cases its intended to stop the execution of the original global mwscript. You can do so in the callback function by calling mwscript.stopScript()
.
local success = mwse.overrideScript(scriptId, callback)
Parameters:
scriptId
(string)callback
(fun(e: mwseOverrideScriptCallbackData))
Returns:
success
(boolean)
Example: Here is an example of the most common use case for this function.
-- In this example, the vanilla "RaceCheck" script is overridden
-- with our own raceCheck() function that does the same thing.
local raceCheckScriptID = "RaceCheck"
local raceMap = {
["argonian"] = 1,
["breton"] = 2,
["dark elf"] = 3,
["high elf"] = 4,
["imperial"] = 5,
["khajiit"] = 6,
["nord"] = 7,
["orc"] = 8,
["redguard"] = 9,
["wood elf"] = 10,
}
local function raceCheck()
-- It's almost always the desired behavior to stop the mwscript,
-- since we are overriding it.
---@diagnostic disable-next-line: deprecated
mwscript.stopScript({ script = raceCheckScriptID })
local pcRaceID = tes3.player.object.race.id:lower()
local PCRace = tes3.findGlobal("PCRace")
PCRace.value = raceMap[pcRaceID]
end
-- Script overrides can be queued when initialited event triggers.
event.register(tes3.event.initialized, function()
mwse.overrideScript(raceCheckScriptID, raceCheck)
end)
mwse.registerModConfig
⚓︎
This is the main function to register a mod's configuration. Only registered configurations appear in the Mod Config menu.
mwse.registerModConfig(name, { onCreate = ..., onSearch = ..., onClose = ... })
Parameters:
name
(string)package
(table)onCreate
(fun(modConfigContainer: tes3uiElement)): The function that creates the mod's configuration menu inside givenmodConfigContainer
.onSearch
(fun(searchText: string): boolean): Optional. A custom search handler function. This function should return true if this mod should show up in search results for givensearchText
.onClose
(fun(modConfigContainer: tes3uiElement)): Optional. This function is called when the mod's configuration menu is closed. Typically, it's used to save the current config table.
mwse.saveConfig
⚓︎
Saves a config table to Data Files\MWSE\config\{fileName}.json. The config is converted to JSON during saving.
mwse.saveConfig(fileName, config, jsonOptions)
Parameters:
fileName
(string): Usually named after your mod.config
(table): The config table to save.jsonOptions
(table): Optional. Encoding options. These get passed to thedkjson
encoder.
mwse.stack.clear
⚓︎
Purges all elements from the stack.
mwse.stack.clear()
mwse.stack.dump
⚓︎
Prints all values on the stack in hex format to the log file.
mwse.stack.dump()
mwse.stack.empty
⚓︎
Determines if the stack is empty.
local result = mwse.stack.empty()
Returns:
result
(boolean)
mwse.stack.popFloat
⚓︎
Pops a value of mwscript type "float" off of the stack.
local unnamed1 = mwse.stack.popFloat()
Returns:
unnamed
(number): Optional.
mwse.stack.popLong
⚓︎
Pops a value of mwscript type "long" off of the stack.
local unnamed1 = mwse.stack.popLong()
Returns:
unnamed
(number): Optional.
mwse.stack.popObject
⚓︎
Pops a value of mwscript type "long" off of the stack, and tries to reinterpret as a game object.
local unnamed1 = mwse.stack.popObject()
Returns:
unnamed
(tes3baseObject): Optional.
mwse.stack.popShort
⚓︎
Pops a value of mwscript type "short" off of the stack.
local unnamed1 = mwse.stack.popShort()
Returns:
unnamed
(number): Optional.
mwse.stack.popString
⚓︎
Pops a value of mwscript type "long" off of the stack, and tries to reinterpret as a string.
local unnamed1 = mwse.stack.popString()
Returns:
unnamed
(string): Optional.
mwse.stack.pushFloat
⚓︎
Pushes a value of mwscript type "float" onto the stack.
local result = mwse.stack.pushFloat(value)
Parameters:
value
(number)
Returns:
result
(nil)
mwse.stack.pushLong
⚓︎
Pushes a value of mwscript type "long" onto the stack.
local result = mwse.stack.pushLong(value)
Parameters:
value
(number)
Returns:
result
(nil)
mwse.stack.pushObject
⚓︎
Pushes a value of mwscript type "long" onto the stack, which matches the address of a given game object.
local result = mwse.stack.pushObject(value)
Parameters:
value
(tes3baseObject)
Returns:
result
(nil)
mwse.stack.pushShort
⚓︎
Pushes a value of mwscript type "short" onto the stack.
local result = mwse.stack.pushShort(value)
Parameters:
value
(number)
Returns:
result
(nil)
mwse.stack.pushString
⚓︎
Adds a string to mwse's string storage, and pushes a value of mwscript type "long" onto the stack that represents the string.
local result = mwse.stack.pushString(value)
Parameters:
value
(string)
Returns:
result
(nil)
mwse.stack.size
⚓︎
Returns the number of elements currently on the stack.
local result = mwse.stack.size()
Returns:
result
(number)
mwse.string.create
⚓︎
Creates a string in storage, and returns the numerical key for it.
If the string is already in storage, the previous key will be returned.
local result = mwse.string.create(value)
Parameters:
value
(string)
Returns:
result
(number)
mwse.string.get
⚓︎
Returns the numerical key for a given string in storage, or nil if the string isn't in storage.
local unnamed1 = mwse.string.get(id)
Parameters:
id
(number): Optional.
Returns:
unnamed
(string)
mwse.stringToLong
⚓︎
Converts an uppercase, 4-character string into a TES3 object type.
local result = mwse.stringToLong(tag)
Parameters:
tag
(string)
Returns:
result
(number)
mwse.virtualKeyPressed
⚓︎
Determines whether a key is pressed. A wrapper for GetAsyncKeyState
function in Win32 API.
local result = mwse.virtualKeyPressed(VK_key)
Parameters:
VK_key
(integer)
Returns:
result
(boolean)