Jump to content

MCM doesn't display multiple pages.


LagiaDOS

Recommended Posts

Int function GetVersion()
    return 2 ; Default version
endFunction

Event OnVersionUpdate(int version)
    If version > 1
        OnConfigInit()
    EndIf
EndEvent

Define the value in the GetVersion() function and that value will affect what happens in the OnVersionUpdate event. The above is a very simple example that will force an update whenever the version value is greater than 1. This is what I used in my Inventory Management System mod as I built it. I rolled the value back before actual release as users would be running it for the first time.

 

More in depth explanation and examples can be found here: https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features#Versioning

Link to comment
Share on other sites

That's good to know about versioning. Does running OnConfigInit again make new pages show up in a save where the MCM is already there? I noticed that when I add pages directly in the Creation Kit, the new ones don't show up if the mod was already active. To get around this, I make a version global variable. I set it at 1 in the CK for initial release. Then if I need to update it, I set it higher in the CK and use a script on a new quest to stop, then start the MCM quest, which makes the new pages show up.

 

 

 

Scriptname MyUpdateScript Extends Quest

Quest Property MyMcmQuest Auto 
GlobalVariable Property MyModVersion Auto

Event OnInit()
    Utility.Wait(1) 
    If MyModVersion.GetValue() < 2 ;this will be less than 2 if the mod was already installed
        MyMcmQuest.Stop() 
        Utility.Wait(1)
        MyMcmQuest.Start()
        MyModVersion.SetValue(2)     
    Endif 

    Utility.Wait(1)
    Self.Stop()
EndEvent

If running OnConfigInit again works though, I may have to switch to that in the future.
Link to comment
Share on other sites

Ok so i did some testing. If you set the pages string array in the CK, as I tend to do, new pages won't show up when updating. If however, you set your pages in the script's OnConfigInit event, new pages do show up when using the MCM's internal versioning.

Link to comment
Share on other sites

Int function GetVersion()
    return 2 ; Default version
endFunction

Event OnVersionUpdate(int version)
    If version > 1
        OnConfigInit()
    EndIf
EndEvent

Define the value in the GetVersion() function and that value will affect what happens in the OnVersionUpdate event. The above is a very simple example that will force an update whenever the version value is greater than 1. This is what I used in my Inventory Management System mod as I built it. I rolled the value back before actual release as users would be running it for the first time.

 

More in depth explanation and examples can be found here: https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features#Versioning

 

 

 

Hi, sorry for answering late, I went to sleep, it was late at night. I've edited my code to now look like this

Int function GetVersion()
    return 2 ; Default version
endFunction

Event OnVersionUpdate(int version)
    If version > 1
        OnConfigInit()
			Pages = new string[2]
			Pages[0] = "Towns"
			Pages[1] = "Settlements"
			;Pages[2] = "Skyrim"
    EndIf

EndEvent

I've put this instead of

Event OnConfigInit()
	Pages = new string[2]
	Pages[0] = "Towns"
	Pages[1] = "Settlements"
	;Pages[2] = "Skyrim"
EndEvent

It still doesn't update, I guess I've put that code in the wrong place.

Link to comment
Share on other sites

Hello, instead you can just put:

 

Event OnConfigInit()
    Pages = new string[2]
    Pages[0] = "Towns"
    Pages[1] = "Settlements"
    ;Pages[2] = "Skyrim"
EndEvent 

Int function GetVersion()
    return 2 ; Default version
endFunction

Event OnVersionUpdate(int version)
    If version > 1
        OnConfigInit()
    Endif
EndEvent
Whenever you add a page, and the mod has already been active in a save, you need to increase the version number in the get version function. I would only do this if you are releasing new versions to the public though. If you are simply testing or building the mod I would just load the same or previous saves where the mod hasn't been active yet.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...