Difference between revisions of "GetModName - Game"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Wafflesalot
(Created page with "Category:Scripting Category:Papyrus Category:SKSE '''SKSE Member of:''' Game Script Returns the name of the mod at the specified Index. (This function require...")
 
imported>Pickysaurus
m (→‎Notes: ESL/ESLP clarification)
 
(3 intermediate revisions by one other user not shown)
Line 18: Line 18:
== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">
int Numberofmods
String Nameofmod
String Nameofmod
String NameofAuth
String Description


Function PrintModlist()
Function ModName()
Numberofmods = Game.GetModCount() ;The number of active mods.
Nameofmod = Game.GetModName(0) ;Gets Name of Mod eg. Skyrim.esm, Update.esm, Hearthfire.esm, etc.(In this case it should return Skyrim.esm)
while NumberofMods
Debug.Trace("The zeroth index contains " + NameofMod)  
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
EndFunction
</source>
</source>
Line 39: Line 28:


== Notes ==
== Notes ==
* This function, doesn't actually return the real name of the mod it returns the .esm or .esps in your load order. (eg. Skyrim.esm, Update.esm, Hearthfire.esm.)
* This function can be a little misleading, it returns the .esm or .esp in your load order, eg. Skyrim.esm. A mod however could be named, for example "Fall of Saber" and have a esp called "Tigers.esp". This would return "Tigers.esp" and not "Fall of Saber".
* This function does not appear to work for ESLs or light flagged ESPs as they all load in slot 254.


== See Also ==
== See Also ==

Latest revision as of 04:25, 6 June 2020

SKSE Member of: Game Script

Returns the name of the mod at the specified Index. (This function requires SKSE)

Syntax[edit | edit source]

string Function GetModName(int modIndex) native global

Parameter[edit | edit source]

  • modIndex = Number of the mod.

Return Value[edit | edit source]

Returns the name of the mod at the specified index.

Examples[edit | edit source]

String Nameofmod

Function ModName()
	Nameofmod = Game.GetModName(0) ;Gets Name of Mod eg. Skyrim.esm, Update.esm, Hearthfire.esm, etc.(In this case it should return Skyrim.esm)
	Debug.Trace("The zeroth index contains " + NameofMod)    
EndFunction


Notes[edit | edit source]

  • This function can be a little misleading, it returns the .esm or .esp in your load order, eg. Skyrim.esm. A mod however could be named, for example "Fall of Saber" and have a esp called "Tigers.esp". This would return "Tigers.esp" and not "Fall of Saber".
  • This function does not appear to work for ESLs or light flagged ESPs as they all load in slot 254.

See Also[edit | edit source]