sevencardz Posted September 23, 2016 Share Posted September 23, 2016 Hi there, I'm trying to set up an MCM menu with pages where the menu automatically loads the first page when you open it, rather than the standard functionality where it loads a blank page or a graphic. For example, I have this: event OnPageReset(string a_page) if a_page == "" OnPageReset("Options") elseIf a_page == "Options" ; show the options page This sort-of works as it shows all the correct options on the "Options" page, however, the "Options" page itself is not automatically selected. Instead, the MCM still 'thinks' that it's on the default blank page, so the title shows the mod name, rather than the page name and the "Options" page is not shown as selected, unless the user actually selects it. I've read all the documentation and been through the source code, but there seems to be no way to programmatically select an MCM page? SKI_ConfigBase has a CurrentPage property, but it's read only and always returns ""? What? I guess they are forcibly injecting the CurrentPage value into the script via SKSE magic somehow? Have I completely missed something obvious or did the SkyUI guys really just totally leave out the option to set a default MCM page?Thank you for reading and/or responding! :) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 23, 2016 Share Posted September 23, 2016 You just have to put all your options in the empty page rather than a page that has an assigned name. Event OnPageReset(string page) If page == "" AddHeaderOption("$Options") AddKeyMapOptionST("SomeKeyBindState", "Key Bind Choice", KeyCodeOne) ;etc EndIf EndEvent Link to comment Share on other sites More sharing options...
sevencardz Posted September 23, 2016 Author Share Posted September 23, 2016 Right, I could do that, but then there's no way for the user to select the empty/default page after the user has selected another page. User has to back out of the mod's MCM and then go back into it just to switch back to the first page. Honestly, I'd rather just keep the current functionality where the title on the page mysteriously changes than create a situation where the user can't find the first page because it's hidden under the blank page option that can't be selected (unless I add a blank page option which is asinine).There really should be a way to set the default page in OnConfigInit. Why the CurrentPage value is set to "" and can't be changed baffles me. It would seem to be a rather simple solution to just let the implementing class set that to "Options" or whatever default page you want it to go to instead. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 23, 2016 Share Posted September 23, 2016 Why do you need an empty/default page for the user to go back to? That default first page is a title page by design, no one should have to go back to it. Not sure what you are wanting to achieve. Link to comment Share on other sites More sharing options...
sevencardz Posted September 23, 2016 Author Share Posted September 23, 2016 I actually want to cut out the title page entirely and forward the user directly to the first options page instead. I don't want to have a title page, but I still want to be able to organize the options for my mod into multiple pages. To your point, it seems that I am fighting against the intended MCM design here. My pages are setup like this: Pages[0] = "Options" Pages[1] = "Hotkeys" Pages[2] = "Advanced" Link to comment Share on other sites More sharing options...
lofgren Posted September 23, 2016 Share Posted September 23, 2016 Just make your page checks say if(a_page == "Options" || a_page == "") Link to comment Share on other sites More sharing options...
sevencardz Posted September 24, 2016 Author Share Posted September 24, 2016 I appreciate the suggestion lofgren, but that's just a different way to write my original solution. With that solution, here's what the user sees upon first entering the MCM menu: http://i.imgur.com/16JsDq0.jpg Instead of that, what I want to see is the "Options" page selected and the "Options" title to appear on that page. Basically, I want it to look like this instead: http://i.imgur.com/rxYQWon.jpg Of course, when the user actually selects the "Options" page, that's what they will see, but I want that to happen by default. Guess I could chalk it up to first world problems, but it'd be nice to just have the script select a page for the user by default and have it actually appear to be selected. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 25, 2016 Share Posted September 25, 2016 I don't know how helpful this might be. I extracted the SkyUI BSA and decompiled the ski_configbase.pex file with Champollion. Also dug into the GitHub files for SkyUI to confirm. There is a function on the ski_configbase script called SetPage. It has the following parameters: SetPage(string a_page, int a_index) You might then be able to do the following somewhere, possibly in the OnConfigInit event:parent.SetPage("Options",0) However, I have no idea how it would affect the rest of the menu. So you'll have to test. Link to comment Share on other sites More sharing options...
sevencardz Posted September 25, 2016 Author Share Posted September 25, 2016 Well that's a rather deviously clever find there, Ishara. :) Unfortunately, it seems I can't call that function from my MCM script as the compiler tells me it doesn't exist. I also noticed in the decompiled version of SKI_ConfigBase that the CurrentPage property actually returns an internal _currentPage variable rather than a blank string. It seems the SkyUI guys have devised some way to make private functions in Papyrus by somehow having a script act entirely differently internally than it does externally to any other script. I also tried this, but no dice: (self as SKI_ConfigBase).SetPage("Options", 0) Well played, SkyUI. Well played. Link to comment Share on other sites More sharing options...
lofgren Posted September 25, 2016 Share Posted September 25, 2016 This is standard behavior for any MCM without a splash page, which is most of them. Just live with it. Users won't even notice. Link to comment Share on other sites More sharing options...
Recommended Posts