IModList

class mobase.IModList

Bases: object

Interface to the mod-list.

All api functions in this interface work need the internal name of a mod to find a mod. For regular mods (mods the user installed) the display name (as shown to the user) and internal name are identical. For other mods (non-MO mods) there is currently no way to translate from display name to internal name because the display name might not me un-ambiguous.

Methods Summary

allMods()

returns

A list containing the internal names of all installed mods.

displayName(name)

Retrieve the display name of a mod from its internal name.

onModMoved(callback)

Install a handler to be called when a mod is moved.

onModStateChanged(callback)

Install a handler to be called when a mod state changes (enabled/disabled, endorsed, …).

priority(name)

Retrieve the priority of a mod.

setActive(name, active)

Enable or disable a mod.

setPriority(name, priority)

Change the priority of a mod.

state(name)

Retrieve the state of a mod.

Methods Documentation

allMods()
Returns

A list containing the internal names of all installed mods.

Return type

List[str]

displayName(name)

Retrieve the display name of a mod from its internal name.

If you received an internal name from the API (e.g. IPluginList.origin) then you should use that name to identify the mod in all other api calls but use this function to retrieve the name to show to the user.

Parameters

name – Internal name of the mod.

Returns

The display name of the given mod.

Return type

str

onModMoved(callback)

Install a handler to be called when a mod is moved.

Parameters

callback – The function to call when a mod is moved. The first argument is the internal name of the mod, the second argument the old priority and the third argument the new priority.

Returns

True if the handler was installed properly (there are currently no reasons for this to fail).

Return type

bool

onModStateChanged(callback)

Install a handler to be called when a mod state changes (enabled/disabled, endorsed, …).

Parameters

callback – The function to call when the state of a mod changes. The first argument is the internal mod name, and the second one the new state of the mod.

Returns

True if the handler was installed properly (there are currently no reasons for this to fail).

Return type

bool

priority(name)

Retrieve the priority of a mod.

Parameters

name – Internal name of the mod.

Returns

The priority of the given mod.

Return type

int

setActive(name, active)

Enable or disable a mod.

Calling this will cause MO to re-evaluate its virtual file system so this is a fairly expensive call.

Parameters
  • name – Internal name of the mod to enable or disable.

  • active – True to enable the mod, False to disable it.

Returns

True on success, False otherwise.

Return type

bool

setPriority(name, priority)

Change the priority of a mod.

priority is the new priority after the move. Keep in mind that the mod disappears from its old location and all mods with higher priority than the moved mod decrease in priority by one.

Parameters
  • name – Internal name of the mod.

  • priority – The new priority of the mod.

Returns

True if the priority was changed, False otherwise (if the name or priority were invalid).

Return type

bool

state(name)

Retrieve the state of a mod.

Parameters

name – Internal name of the mod.

Returns

The state of the given mod.

Return type

int