BlahBlahDEEBlahBlah Posted January 20, 2017 Share Posted January 20, 2017 (edited) Should anything be stopping me doing the install and uninstall of custom my menu this way? Keeping in mind that I have complete control over the worldspaces and interiors in my mod, they are fully separate from the Commonwealth.Script attached to a trigger encompassing the entirety of each of my worldspace and interior settlements: Scriptname ASmallAddition:ASAInstallMenuScript extends ReferenceAlias Group VanillaWorkshopMenus FormList property WorkshopMenuMain auto const EndGroup Group CustomWorkshopMenus FormList property ASmallAdditionCategoriesMenuFormList auto const EndGroup Group OtherItems Actor Property PlayerREF Auto Keyword Property LocTypeWorkshopSettlement Auto Const EndGroup bool uninstallCheckRunning = false Event OnLocationChange(Location akOldLoc, Location akNewLoc) if aknewloc.HasKeyword(LocTypeWorkshopSettlement) install() else uninstall_manually() endif checkForUninstall() EndEvent Function install() WorkshopMenuMain.addForm(ASmallAdditionCategoriesMenuFormList) Debug.Notification("A SmallAddition Categories Installed A SmallAddition Categories Installed A SmallAddition Categories Installed A SmallAddition Categories Installed A SmallAddition Categories Installed") EndFunction Function uninstall_manually() WorkshopMenuMain.RemoveAddedForm(ASmallAdditionCategoriesMenuFormList) Debug.Notification("Uninstalled A Small Addition Categories Uninstalled A Small Addition Categories Uninstalled A Small Addition Categories Uninstalled A Small Addition CategoriesUninstalled A Small Addition Categories") EndFunction Function checkForUninstall() if (!uninstallCheckRunning) uninstallCheckRunning = true while (Game.IsPluginInstalled("asmalladdition.esp")) Utility.wait(60) endwhile removeNoneValues(WorkshopMenuMain) uninstallCheckRunning = false endif EndFunction Function removeNoneValues(Formlist flst) Formlist temp = flst WorkshopMenuMain.revert() int i = 0 while (i < temp.getSize()) if (temp.getAt(i)) flst.addForm(temp.getAt(i)) endif i+=1 endwhile EndFunction I used a good bit of http://www.nexusmods.com/fallout4/mods/12192/? , by the way, as a starting point or basis for this script. It does work (upon preliminary testing, at least), to install on trigger entry and uninstall on trigger exit...so far.But, again, should I be wary of anything or am I asking for trouble from somewhere I haven't thought of yet? Point of this way is to make it as easy for the user to uninstall as possible. No chems, messages, or extra files...just (hopefully) a note to not be in one of the settlements in the mod, or to exit to the Commonwealth entirely before uninstalling. Edit: Yeah, I screwed up all the indents. =/ Edited January 25, 2017 by BlahBlahDEEBlahBlah Link to comment Share on other sites More sharing options...
kitcat81 Posted January 21, 2017 Share Posted January 21, 2017 It`s just interesting to me do you have a few plugins for your mod? I mean the way you implemented checking if the plugin is installed. I`m just not sure that I understand that bit and how it supposed to work. Sorry for my curiosity, but I`m trying to learn all things ;) I`m not an experienced modder, can`t tell anything about triggers and if they can fail or not...The only thing I see is that your users can start to complain that they want to use your menu while being in another worldspace :) In general users tend to forget that they have to do something before uninstalling, so making it easier for them has 2 sides One is the good side as your mod becomes more user friendly, another side is that when they don`t have to install the menu themselves, they are more likely to forget or miss the deinstallation part, so it` hard to tell what is better. Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted January 21, 2017 Author Share Posted January 21, 2017 That install check section is from the Custom Categories template (I linked it up above).That part is actually quite elegant, so I'll probably leave it in as a safe guard. The inability to be built outside the mod's areas will be addressed by a standalone Mod of just the build bits (which I just released the first object, and is using the full Custom Categories template...but hopefully not for long).But there will be some caveats in what can be built outside...which may, as you surmise, piss some people off. =P Link to comment Share on other sites More sharing options...
kitcat81 Posted January 21, 2017 Share Posted January 21, 2017 That install check section is from the Custom Categories template (I linked it up above).That part is actually quite elegant, so I'll probably leave it in as a safe guard. The inability to be built outside the mod's areas will be addressed by a standalone Mod of just the build bits (which I just released the first object, and is using the full Custom Categories template...but hopefully not for long).But there will be some caveats in what can be built outside...which may, as you surmise, piss some people off. =PI understand , I would not worry as long as your trigger works. And I saw that template, I just don`t really understand how that part is supposed to work. I mean if the script is inside the mod and the plugin is not installed all your objects will dissapear and stop to check for anything.Am I missing something? Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted January 25, 2017 Author Share Posted January 25, 2017 So, this (in a reference alias on the Quest Alias tab of the quest) is what I'm going with. Clears up the "but why no worky in other settlements" comments you foresee, but also allows for the only requirement to uninstall being to "Not be in any settlement location" (roughly).Still borrows heavily from the Custom Categories Template, so I should still credit them. =) ...not really easier, I guess. =P...but oh well...it's an alternative. ;-) Scriptname ASmallAddition:ASAInstallMenuScript extends ReferenceAlias Group VanillaWorkshopMenus FormList property WorkshopMenuMain auto const EndGroup Group CustomWorkshopMenus FormList property ASmallAdditionCategoriesMenuFormList auto const EndGroup Group OtherItems Actor Property PlayerREF Auto Keyword Property LocTypeWorkshopSettlement Auto Const EndGroup bool uninstallCheckRunning = false Event OnLocationChange(Location akOldLoc, Location akNewLoc) if aknewloc.HasKeyword(LocTypeWorkshopSettlement) install() else uninstall_manually() endif checkForUninstall() EndEvent Function install() WorkshopMenuMain.addForm(ASmallAdditionCategoriesMenuFormList) Debug.Notification("A SmallAddition Categories Installed A SmallAddition Categories Installed A SmallAddition Categories Installed A SmallAddition Categories Installed A SmallAddition Categories Installed") EndFunction Function uninstall_manually() WorkshopMenuMain.RemoveAddedForm(ASmallAdditionCategoriesMenuFormList) Debug.Notification("Uninstalled A Small Addition Categories Uninstalled A Small Addition Categories Uninstalled A Small Addition Categories Uninstalled A Small Addition CategoriesUninstalled A Small Addition Categories") EndFunction Function checkForUninstall() if (!uninstallCheckRunning) uninstallCheckRunning = true while (Game.IsPluginInstalled("asmalladdition.esp")) Utility.wait(60) endwhile removeNoneValues(WorkshopMenuMain) uninstallCheckRunning = false endif EndFunction Function removeNoneValues(Formlist flst) Formlist temp = flst WorkshopMenuMain.revert() int i = 0 while (i < temp.getSize()) if (temp.getAt(i)) flst.addForm(temp.getAt(i)) endif i+=1 endwhile EndFunction So, the lame part about adding objects into vanilla lists is that when you uninstall the mod out from under those objects, the scripts leave a "none" value in the vanilla list.This is because while uninstalling the esp will get rid of the actual script, the things it was doing are still 'doing' in your save game...except now the Buildable Big Red Ball (*for example*) it was doing things with is no longer there....so "None" values are created and screw everything up. So, since the script is still running (again, regardless if the actual script still exists on your computer), it's free to check and see if its own uninstallation has screwed anything up and able to correct them. ...at least that's how I understand it. .........that is, if I didn't screw anything up myself, of course. =P Link to comment Share on other sites More sharing options...
kitcat81 Posted January 25, 2017 Share Posted January 25, 2017 (edited) I know about the menu dissapearing, and I find your way with triggers quite cool , especially if you make it fit the mod ( some game fitting explanation of why people can`t build it elsewhere) :smile: Though I have added a pill to my small mod . Could make it through quest but I like to have more control so I gave full control to my users to install and uninstall it. So, since the script is still running (again, regardless if the actual script still exists on your computer), it's free to check and see if its own uninstallation has screwed anything up and able to correct them. ...at least that's how I understand it. I understood the idea now , makes sence. Not sure that it will work but hopefully it will. Edited January 25, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
damanding Posted January 25, 2017 Share Posted January 25, 2017 I can't script or program to save my life despite numerous attempts in my professional life so I'm no help on that front. But I can tell you from a purely technical support perspective that I've seen the threads on people screwing up their menus by uninstalling mods improperly drop off drastically. I suspect that a lot of people are now learning to pay more attention to that, as well as there now being so many threads on how to fix it that people can easily figure out how to fix it on their own. I have to confess that for various reasons I've improperly uninstalled *my own bleeping mod* 3 times now. :pinch: So I've gotten pretty good at fixing it. :D Link to comment Share on other sites More sharing options...
BlahBlahDEEBlahBlah Posted January 25, 2017 Author Share Posted January 25, 2017 (edited) Yeah, I haven't seen as many threads as I used to, either.I'd hope that making it even easier to remember (if location based, might even just be outseide the area by luck alone) would cut the remaining threads down even more. Anywho, both sets of code work (the first one built to place in a trigger, the second to install/uninstall based on loctypeworkshopsettlement keyword and placed in a player refalias in a quest).They are both for outside of my mod also, in these versions (depending on where you put the trigger or what keywords you use)..Though, the backup uninstall bit on the bottom from http://www.nexusmods.com/fallout4/mods/12192/? is proving hard to test. =/ Figure I was debating whether more people would forget to use a chem or forget to exit the settlement location, but I guess it doesn't matter as long I've clearly noted it on the page. Also...if I'm being honest, I liked finding a new way to do it. Someone could get really creative with this. The first set of code could easily be used to add buildable objects to menus as the object is found out in the open and xx amount at a time.Say, like my world, where I want to be able to add a toy car (for example)...walk up to the car, "Examine it" (click on it), now it's an option to build it in your settlements.Lots of different ways, though...I'd love to get it working with IsWithinBuildableArea, too.OnItemAdd would be a good way too. Say for finding a blueprint ("You can build this now!") and "Drop"ing the blueprint to uninstall. However, if I'm being really *really* honest, I just don't know why we glommed onto the chem based uninstall thing...it's just lame in so many ways and almost always out of place...and more compicated. =PI'm not a big "Must be lore friendly" or "For teh ammersionz!" person, but the chem thing always bothered me. Edited January 25, 2017 by BlahBlahDEEBlahBlah Link to comment Share on other sites More sharing options...
damanding Posted January 25, 2017 Share Posted January 25, 2017 Well even if it's not the best method it's become a standard method and there's definitely something good to be said for standardizing some things like that. Makes it easier on the end users and the troubleshooters. :D Link to comment Share on other sites More sharing options...
kitcat81 Posted January 25, 2017 Share Posted January 25, 2017 I can gree that it can be a bit out of place... I have not heard of drugs that give you menu visions yet ...But may be these are special drugs :)..But it`s definatelly the easiest method that requires only a chem, a magic effect and a craftable recipe. And it saves some PC memnory too. If you add a whole location and quests then it makes sence to adjust the way of installing the menu and to make it creative. if you just add more things for crafting then I see no point to make it complicated. Link to comment Share on other sites More sharing options...
Recommended Posts