Skip to content

mwseMCMPlayerData⚓︎

Stores the variable on the Player reference.data table. This results in the value of the variable being local to the loaded save file. If users may want different values set for different games, this is a good Variable to use.

Settings using mwseMCMPlayerData are in-game only by default, as the Player reference can only be accessed while a game is loaded.

This type inherits the following: mwseMCMVariable

Properties⚓︎

class⚓︎

The type of the variable.

Returns:

  • result (string)

componentType⚓︎

The type of this component.

Returns:

  • result ("Variable")

converter⚓︎

This function is called when the value of the variable is changed. The function can modify the new value before it is stored.

Returns:

  • result (fun(newValue): unknown)

defaultSetting⚓︎

If id does not exist in the tes3.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.

Returns:

  • result (unknown)

id⚓︎

Key of entry used on the tes3.player.data table.

Returns:

  • result (string)

inGameOnly⚓︎

Read-only. Always true for this variable type, since tes3.player.data can only be changed while the game is loaded.

Returns:

  • result (true)

path⚓︎

Path to id relative to tes3.player.data. The subtable keys need to be split by dots.

Returns:

  • result (string)

restartRequired⚓︎

If true, updating the setting containing this variable will notify the player to restart the game.

Returns:

  • result (boolean)

restartRequiredMessage⚓︎

The default text is a localized version of: "The game must be restarted before this change will come into effect.".

Returns:

  • result (string)

value⚓︎

The value stored in the variable.

Returns:

  • result (unknown)

Methods⚓︎

get⚓︎

Returns the value stored in the variable.

local value = myObject:get()

Returns:

  • value (unknown)

new⚓︎

Creates a new variable of this type.

local variable = myObject:new({ id = ..., path = ..., defaultSetting = ..., restartRequired = ..., restartRequiredMessage = ..., converter = ... })

Parameters:

  • variable (table)
    • id (string): Key of entry used on the tes3.player.data table.
    • path (string): Path to id relative to tes3.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. If id does not exist in the tes3.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:


set⚓︎

Changes the value stored in the variable. Calls the converter function with the new value before saving.

myObject:set(newValue)

Parameters:

  • newValue (unknown)