Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] Should be a simple MCM question


TigerCubofPNW
 Share

Recommended Posts

So, I have my MCM working and all, but what I want is for the toggle boxes to be unticked initially. This doesn't seem complicated, but it's proving to be and I'm hoping people will be able to tell me what needs to happen. I assumed it was where you define the bool property, as in:

bool Property EnableCompDial = false Auto

To my understanding, by setting the bool to false the toggle box should start unticked. That's not turning out to be true. Studying other MCM menus, it seems like it SHOULD be true, but it's not. To be absolutely sure, I even created a brand new character so the mod would load fresh and sure enough, toggle boxes are ticked. And now I'm getting ticked...

Anyway, I'm sure there's something obvious to do here but I'm out of ideas. Help?

Link to comment
Share on other sites

So, I have my MCM working and all, but what I want is for the toggle boxes to be unticked initially. This doesn't seem complicated, but it's proving to be and I'm hoping people will be able to tell me what needs to happen. I assumed it was where you define the bool property, as in:

bool Property EnableCompDial = false Auto

To my understanding, by setting the bool to false the toggle box should start unticked. That's not turning out to be true. Studying other MCM menus, it seems like it SHOULD be true, but it's not. To be absolutely sure, I even created a brand new character so the mod would load fresh and sure enough, toggle boxes are ticked. And now I'm getting ticked...

Anyway, I'm sure there's something obvious to do here but I'm out of ideas. Help?

So.... Here's the answer, if anyone is interested

I've been trained quite thoroughly to always, always ALWAYS go into properties and fill them. Always. Like, seriously.

Naturally, the MCM doesn't work that way and of course that's not mentioned anywhere.

When you create the bool property, CK helpfully supplies you with the option to fill it. DON'T!!!! That's where the issue came in. I have some half-baked theories on why, but I'll just leave it at if you want your ticky boxes to start empty, leave their bool properties unfilled.

Of course, that's the answer today. Tomorrow it could be entirely different....

Link to comment
Share on other sites

  • 1 month later...

Just normally making a property of any type, then filling it in the CK, has worked just fine for me. Are you sure you did not leave anything additional in the script that might have changed how it works? Declaring the Property the following way was enough:

Bool Property bSomeProperty Auto

And then filling it in the CK, while not doing anything else about it in the script (just declaring it, not setting a value). Excluding, of course, when the user changes the values by toggling a  tickbox.

Also, in case someone happens to read this, there is the feature provided by SkyUI/MCM that makes it possible to run scripts upon initialising the menu, also on every script version update (the version needs to be "changed" manually). It is all on the GitHub wiki for SkyUI: https://github.com/schlangster/skyui/wiki

; defines the current script version, you need to manually
; increment this when you want the OnVersionUpdate to be called
Int Function GetVersion()
    Return 1 ; first script version (1)
EndFunction

; config menu initialisation, dump everything here
Event OnConfigInit()
    bSomeProperty = False ; set the property to False
EndEvent

Event OnVersionUpdate(Int iVersion)
    ; new version is iVersion, old one CurrentVersion
    OnConfigInit() ; run the initialisation section
EndEvent

But just filling the properties in the CK worked for me when not doing anything about them in the script (excluding when user changes the options). And remember not to use OnInit with MCM scripts - use OnConfigInit instead, as explained in the documentation.

Hopefully you got it working somehow. Good luck with your project. :)

Edited by PhilippePetain
Ooops... Sorry, just realised this was over a month old post. *facepalm*
Link to comment
Share on other sites

Just normally making a property of any type, then filling it in the CK, has worked just fine for me. Are you sure you did not leave anything additional in the script that might have changed how it works? Declaring the Property the following way was enough:

Bool Property bSomeProperty Auto

And then filling it in the CK, while not doing anything else about it in the script (just declaring it, not setting a value). Excluding, of course, when the user changes the values by toggling a  tickbox.

Also, in case someone happens to read this, there is the feature provided by SkyUI/MCM that makes it possible to run scripts upon initialising the menu, also on every script version update (the version needs to be "changed" manually). It is all on the GitHub wiki for SkyUI: https://github.com/schlangster/skyui/wiki

; defines the current script version, you need to manually
; increment this when you want the OnVersionUpdate to be called
Int Function GetVersion()
    Return 1 ; first script version (1)
EndFunction

; config menu initialisation, dump everything here
Event OnConfigInit()
    bSomeProperty = False ; set the property to False
EndEvent

Event OnVersionUpdate(Int iVersion)
    ; new version is iVersion, old one CurrentVersion
    OnConfigInit() ; run the initialisation section
EndEvent

But just filling the properties in the CK worked for me when not doing anything about them in the script (excluding when user changes the options). And remember not to use OnInit with MCM scripts - use OnConfigInit instead, as explained in the documentation.

Hopefully you got it working somehow. Good luck with your project. :)

Well, since the tutorial by the SkyUI folks was useless to me, I used a couple of other mods to compare and contrast. Looking at toggle boxes they had as default off, my code was correct. And after some excruciating study, I was quite sure that yes, the text of the script was correct--create this Bool value and start it at false -- off. Unfortunately, once the mod started, the value was set to true.

Because of various weirdnesses with the mods I was working off of, I couldn't confirm my solution. However, I did run it once more with that Property filled (all you can do in the filling screen is check a tick box) and once again, the mod started with that toggle checked. It works fine the way I have it, so if it's not correct then I have no explanation. But my code matches working mod codes and the MCM operates the way I want it to so I'm calling it a win. :)

Link to comment
Share on other sites

Great! :thumbup:

But if you need help with anything MCM-related, just ask. I myself like it more when things are also done 'the right way', according to the documentation, in addition to working correctly. And usually, when doing this the way described in the documentation, it usually works pretty much automatically. I have only done one MCM menu myself, but I did it from scratch, with all the features added, like full localisation support, so I think I know how to make them. Somehow.

Link to comment
Share on other sites

Great! :thumbup:

But if you need help with anything MCM-related, just ask. I myself like it more when things are also done 'the right way', according to the documentation, in addition to working correctly. And usually, when doing this the way described in the documentation, it usually works pretty much automatically. I have only done one MCM menu myself, but I did it from scratch, with all the features added, like full localisation support, so I think I know how to make them. Somehow.

Works automatically? HAHAHAHAHAHA!!!! Oh if only I had that experience in Skyrim.... like once.... :)

Looking at your code, you bring up some interesting ideas, and things I considered, like using the OnConfigInit. However, looking at MCM codes for working mods and even the obtuse and unhelpful "tutorial" on the SkyUI site, nothing like that was even hinted at. OnConfigInit was never used to do anything with the toggle values. All the MCM menus I looked at declared whether the Bool value was True or False. Every one. Like I said, line by line, my code was identical.

The code translates to: Create the Bool Value, set it to False, when the user clicks the tick box set it to the opposite of whatever it's current value is.

There is nothing in the code that should have automatically changed the value from False to True on first set up. Nothing. Congfig Init had nothing in it to do it, not the OnPageReset either. I had to parse the code down to the letter until I absolutely understood what every last bit was, checking with my coder boyfriend to be sure.

That's what led me to, "The code is correct. What else could it be?" The Property was all that was left. 

Link to comment
Share on other sites

Hmm. But have you tried it without initialising the moment you declare it? You had this in your example:

Bool Property EnableCompDial = False Auto

But have you tried this (and then filling it in the CK):

Bool Property EnableCompDial Auto

Just being curious, as I think it has worked for me without further hassle. Or at least any I would have noticed. So I just cannot see why it could not work. Argh. Maybe I need to make a small MCM to prove it works the way I did it. That would solve it. Unless, of course, I fail to make it work somehow, and end up embarrassing myself here. :P

Edited by PhilippePetain
fixed a typo
Link to comment
Share on other sites

Hmm. But have you tried it without initialising the moment you declare it? You had this in your example:

Bool Property EnableCompDial = False Auto

But have you tried this (and then filling it in the CK):

Bool Property EnableCompDial Auto

Just being curious, as I think it has worked for me without further hassle. Or at least any I would have noticed. So I just cannot see why it could not work. Argh. Maybe I need to make a small MCM to prove it works the way I did it. That would solve it. Unless, of course, I fail to make it work somehow, and end up embarrassing myself here. :P

No, I didn't. Not sure what you mean by "filling it in the CK." Like I said, when you go to fill the property, there is just this one ticky box there to check. I don't remember the syntax next to the ticky box.

More importantly, all the MCM menus I looked at that had their CheckBoxes set to be initially off ALL had their scripts set up with the BOOL value = False Auto. One of them I think also had Hidden tacked on there, which I'm not sure what that does. But like I said, the script I used was identical to working MCM scripts.

I did a lot of playing around with the code so it's possible that somewhere in there I just messed up the set up of the MCM, but like I said, the script was the same as other MCM scripts so the code itself is the one thing I have confidence in. :)

Link to comment
Share on other sites

  • 4 months later...

Aaaaaaaaand apologies to everyone. I hope this is not too bad of a "thread necro" or something. Totally forgot this, and then real life and mod projects kept me busy for a while. But I finally got around to making that example MCM toggle option I mentioned. What a job it was, took me a grand total of five minutes. Derpityderp. Should have done it earlier. :P

But in case you are still interested, I will try to attach the archive in this post (which would at least appear to be possible here) so that you can see how I have done it. When the menu has been registered automatically, and when you enter it, the toggle option (the only thing there is) should be off. I have tested, and it works on my end just fine. I have even used that exactly the same method in a released mod of mine that has MCM, and it works just fine. There is no initialisation in the property itself, just a declaration:

Bool Property bToggleTest Auto

That has been set to False (un-ticked) in the Creation Kit. And that is all, it should work, and I still firmly believe it does, so there you go, I hope the attached test thingy proves it. Yes, I can be stubborn, especially when I think something should work for others the way it has worked for me. :happy:

And now that I think of it, could it be possible that, whatever you have done, has gone this way:

  • have the MCM registered in-game
  • change the Property value either in declaration or the CK
  • load the MCM in-game, but nothing happens

Because, from what I have noticed, once a variable has been initialised, it stays that way, and is not re-initialised in-game when the value is changed elsewhere. If you have issues with that, you could see about adding something like

bYourToggleValue = False

in your OnVersionUpdate function, and then incrementing the version number returned by GetVersion by one so that OnVersionUpdate gets called. Or just call the OnConfigInit on each version update, and add all the intended default initialisations (and everything related) in that one. See the (hopefully) attached example for some reference.

Hopefully that helps a little, albeit being somewhat late. My bad. :thumbup:

MCMTest.rar

Edited by Contrathetix
Typoooooooooos! Arrrrrrgh.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...