Carloss32 Posted October 10, 2014 Posted October 10, 2014 Hi all i have a mod and it runs ok the MCM and everything is functioning but i wanted to add an option to be able to enable/disable the mod from within the MCM i have looked but found little help on subject, my mod has a few different scripts all running from same quest that add or change items, has anyone got any suggestions or help with this??
RadioactiveSoup Posted October 11, 2014 Posted October 11, 2014 Sorry, but usually the only way to disable a mod through MCM is if the author of the mod puts the option to disable it. You can always just uninstall the mod, and if you're not using a mod manager, just disable the plugin.
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 Sorry, but usually the only way to disable a mod through MCM is if the author of the mod puts the option to disable it. You can always just uninstall the mod, and if you're not using a mod manager, just disable the plugin. i know this im the one creating the mod but im new to scripting and was asking for advice on how to add an enable/disable function
Veladarius Posted October 11, 2014 Posted October 11, 2014 If you want to disable things via a toggle in the MCM menu you will need to set up the toggle in the menu and all the changes you made have to be able to look at that and tell if it should run or not. Usually I have the MCM menu set a global value to either 0 (off) or 1 (on) then have an if statement in a script to look to see if it is a 1, if so then the script can proceed with the changes. If it is something that is outside of a script (or dialogue as you can look at the global in that) they you may have to make functions to make the changes to things for you.
Carabosse Posted October 11, 2014 Posted October 11, 2014 When I added a MCM menu to my mod I originally intended to include a "clean up" option to facilitate future updates. I couldn't figure out how to do it other than tracking every single object added by the mod, resetting every stage advancing triggerbox, every actor and on and on. I gave up on the idea. I'd love to know if there was a more straightforward option to remove all traces, so that I could use that then ask the player to save/update/reload. Is there a recommended alternative such as disabling the old version, cleaning the save with a savetool and then updating? (Sorry to hijack your post Carloss )
Veladarius Posted October 11, 2014 Posted October 11, 2014 You don't have to remove custom items and such, when the mod is uninstalled those will be removed. The things you want to shut down are scripts that are constantly looking for things or doing something in the background. I try to make everything as custom as possible in my mods so I don't have to modify something that may not be able to be undone on uninstallation.
aqqh Posted October 11, 2014 Posted October 11, 2014 What i did in mine was to untick "Start game enabled" in quest tab and then all mcm button does is <quest property>.Reset() After reset quest goes back to its default state - stage 0, disabled that is. All aliases are automatically cleared. But dunno if such thing would fit to your mod. It fits perfectly in mine. Quite sure for yours you would need plenty of lines like PlayerRef.RemovePerk/addperk etc
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 What i did in mine was to untick "Start game enabled" in quest tab and then all mcm button does is <quest property>.Reset() After reset quest goes back to its default state - stage 0, disabled that is. All aliases are automatically cleared. But dunno if such thing would fit to your mod. It fits perfectly in mine. Quite sure for yours you would need plenty of lines like PlayerRef.RemovePerk/addperk etc yea this was the way i was looking at doing it myself and yea hell of a lot of add/remove spells & perks
aqqh Posted October 11, 2014 Posted October 11, 2014 You got it all based on sexcounter right? Global variable wont reset - it would just stop to increase. so you could group those skills in a formlists and then on enable if sexcounter > 50 addperk(formlist5) endif if sexcounter > 40 addperk(formlist4) etc on disable i believe it could just be .removeperk(<formlist every-damn-single-one-of-them-at-once>) never did that myself but it should be doable
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 What i did in mine was to untick "Start game enabled" in quest tab and then all mcm button does is <quest property>.Reset() After reset quest goes back to its default state - stage 0, disabled that is. All aliases are automatically cleared. But dunno if such thing would fit to your mod. It fits perfectly in mine. Quite sure for yours you would need plenty of lines like PlayerRef.RemovePerk/addperk etc just trying to make sure its set correctly, what is the script code to set quest to active by clicking a option within the mcm
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 You got it all based on sexcounter right? Global variable wont reset - it would just stop to increase. so you could group those skills in a formlists and then on enable if sexcounter > 50 addperk(formlist5) endif if sexcounter > 40 addperk(formlist4) etc on disable i believe it could just be .removeperk(<formlist every-damn-single-one-of-them-at-once>) never did that myself but it should be doable that is one part of it, there is also buffs added upon creature animations ending, spells, that replace vanilla spells upon quest start, a new shout that is added upon quest start and more, the counter is just something that adds abit of depth to getting your new spells
aqqh Posted October 11, 2014 Posted October 11, 2014 just trying to make sure its set correctly, what is the script code to set quest to active by clicking a option within the mcm In MCM script int Enabled_OID_B bool property enabled auto enabled = false ;if you want mod to be disabled by defalut on first load. true otherwise Event OnPageReset(string page) Enabled_OID_B = AddToggleOption("Enable mod", Enabled) ... Event OnOptionHighlight(int option) If (option == Enabled_OID_B ) SetInfoText("Turns mod on/off") Return EndIf ... Event OnOptionSelect(int option) If ( option == Enabled_OID_B ) Enabled = !Enabled if enabled == false <quest property>.reset() else <function to enable things> endif SetTextOptionValue(Vanilla_OID_B, Enabled) ForcePageReset() Return this <function to enable things> would be something like that in theory if sexcounter > 50 addperk(formlist5) endif if sexcounter > 40 addperk(formlist4) etc
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 just trying to make sure its set correctly, what is the script code to set quest to active by clicking a option within the mcm In MCM script int Enabled_OID_B bool property enabled auto enabled = false ;if you want mod to be disabled by defalut on first load. true otherwise Event OnPageReset(string page) Enabled_OID_B = AddToggleOption("Enable mod", Enabled) ... Event OnOptionHighlight(int option) If (option == Enabled_OID_B ) SetInfoText("Turns mod on/off") Return EndIf ... Event OnOptionSelect(int option) If ( option == Enabled_OID_B ) Enabled = !Enabled if enabled == false <quest property>.reset() else <function to enable things> endif SetTextOptionValue(Vanilla_OID_B, Enabled) ForcePageReset() Return this <function to enable things> would be something like that in theory if sexcounter > 50 addperk(formlist5) endif if sexcounter > 40 addperk(formlist4) etc thanks man really appreciate all your help on my scripting questions edit -- 1 more thing how would i set thher options as greyed out in my MCM until they hit activate???
aqqh Posted October 11, 2014 Posted October 11, 2014 https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features Search for "OPTION_FLAG_DISABLED"
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features Search for "OPTION_FLAG_DISABLED" what would i put into the <questproperty>.reset() as i have multiple scripts and when i try and put the quest name itself i get an error on compiling
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 If you want to disable things via a toggle in the MCM menu you will need to set up the toggle in the menu and all the changes you made have to be able to look at that and tell if it should run or not. Usually I have the MCM menu set a global value to either 0 (off) or 1 (on) then have an if statement in a script to look to see if it is a 1, if so then the script can proceed with the changes. If it is something that is outside of a script (or dialogue as you can look at the global in that) they you may have to make functions to make the changes to things for you. what is the best way to go about doing it like this, all the things i want to run or stop are on scripts in the same quest
aqqh Posted October 11, 2014 Posted October 11, 2014 https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features Search for "OPTION_FLAG_DISABLED" what would i put into the <questproperty>.reset() as i have multiple scripts and when i try and put the quest name itself i get an error on compiling Not quest name but quest property. To make reference in a script to any form (be it actor, item, location, quest... anything) that comes from anywhere else that than script you need a property or alias. Usually property. Without them scripts just don't know what kind of forms do you want them to work with. So to make a script reference to creation kit form (quest for example) you need property. To make reference to form that comes from different script (like some variable for example) - you need a property as well. Leave script editor and in script window you got 3 buttons Add/Remove/Properties. Push Properties. Then Add Property. Type: Quest Name: whatever Push ok - something like this would be added to your script "Quest Property whatever auto" (that's a declaration of property) but don't mind that for now. When done, still in properties window click on that new property and push Edit Value button. Then find your quest in dropdown list. From now on you are allowed to make a reference to your quest in that script - for example to use "whatever.Reset()" function.
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 https://github.com/schlangster/skyui/wiki/MCM-Advanced-Features Search for "OPTION_FLAG_DISABLED" what would i put into the <questproperty>.reset() as i have multiple scripts and when i try and put the quest name itself i get an error on compiling Not quest name but quest property. To make reference in a script to any form (be it actor, item, location, quest... anything) that comes from anywhere else that than script you need a property or alias. Usually property. Without them scripts just don't know what kind of forms do you want them to work with. So to make a script reference to creation kit form (quest for example) you need property. To make reference to form that comes from different script (like some variable for example) - you need a property as well. Leave script editor and in script window you got 3 buttons Add/Remove/Properties. Push Properties. Then Add Property. Type: Quest Name: whatever Push ok - something like this would be added to your script "Quest Property whatever auto" (that's a declaration of property) but don't mind that for now. When done, still in properties window click on that new property and push Edit Value button. Then find your quest in dropdown list. From now on you are allowed to make a reference to your quest in that script - for example to use "whatever.Reset()" function. yea i thought it may be like this, only thing is then would it be better to have my MCM on its own quest to reference to my main quest or is it able to function from same quest??
aqqh Posted October 11, 2014 Posted October 11, 2014 MCM has to be on its own individual quest yes. For example "start game enabled" has to be selected in that quest if you want your menu to show up. You got guide there of how to set it up https://github.com/schlangster/skyui/wiki/MCM-Quickstart - Creating a new Config Menu
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 MCM has to be on its own individual quest yes. For example "start game enabled" has to be selected in that quest if you want your menu to show up. You got guide there of how to set it up https://github.com/schlangster/skyui/wiki/MCM-Quickstart - Creating a new Config Menu yea my prob was i had mine set to same quest as everything else, i had already set it to its own guest to try and sort this when you replied thanks again for helping out with my noob scripting questions
Carloss32 Posted October 11, 2014 Author Posted October 11, 2014 MCM has to be on its own individual quest yes. For example "start game enabled" has to be selected in that quest if you want your menu to show up. You got guide there of how to set it up https://github.com/schlangster/skyui/wiki/MCM-Quickstart - Creating a new Config Menu ok 1 more question is there a way to fire a script back up on the quest you set as disabled when you want to activate it again??
Recommended Posts
Archived
This topic is now archived and is closed to further replies.