GetModCount - Game

From the CreationKit Wiki
Jump to navigation Jump to search

SKSE Member of: Game Script

Returns the number of mods currently active. (This function requires SKSE)

Syntax[edit | edit source]

int Function GetModCount() native global

Return Value[edit | edit source]

Returns the number of mods currently active.

Examples[edit | edit source]

int Numberofmods
String Nameofmod
String NameofAuth
String Description

Function PrintModlist()
	Numberofmods = Game.GetModCount() ;The number of active mods.
	while NumberofMods
		NumberofMods -= 1
		Nameofmod = Game.GetModName(NumberofMods) ;Gets Name of Mod eg. Skyrim.esm, Update.esm, Hearthfire.esm, etc.
		NameofAuth = Game.GetModAuthor(NumberofMods) ; If a Author is specified then it will return a name if not will be blank
		Description = Game.GetModDescription(NumberofMods) ;If a Description is available then it will be shown otherwise will be blank
		Debug.Trace(NumberofMods + "th index contains " + NameofMod)
		Debug.Trace("Author: " + NameofAuth)
		Debug.Trace("Description: " + Description)
	EndWhile
EndFunction


Notes[edit | edit source]

  • By number of mods, it refers to the amount of .esm and .esp files in the load order, as mods can have multiple .esps or .esms the number that is returned can be higher than actual mods.

See Also[edit | edit source]