Hi, first of all thanks for this great plugin, NippleClippingEliminator has been a must-have in my session plugins for some time now.
Lately I've been trying to develop my own plugins and have started to use this plugin to check logs:
DebugConsole
It made debugging my code so much easier for a number of reasons, one of which is that it reveals hidden errors that VaM isn't showing on the usual interface. This has helped me pinpoint some weak spots in my code. The bad news is that it has also flagged up hidden errors in other plugins, sadly this is the case with NippleClippingEliminator - but there is good news too. Since I'm doing this as a learning exercise I decided to try to understand and bugfix what I'd found. I hope that is ok. I think I have successfully worked out 2 bugs that I found which were not showing in the usual error logs. I've tested by editing a local copy of
NippleClippingEliminator.cs. I have attached in case you want to incorporate the changes into your code going forward.
I did some short screen recordings as I thought that was the easiest way to show what I had found. I've used a clean install of the latest VaM version with no other plugins present other than the DebugConsole plugin to show the errors. I've loaded the shipped default scene.
Bug 1 JSONStorableBool registration duplicate
View attachment 570210
There were 2 bools both being registered with the same name "Enable" so the second one was failing to register. Therefore the "Enable Pubic" wasn't available to the trigger system. I've simply named them uniquely. They now both show & function as expected in triggers.
Bug 2 missing storable parameters on clothing items
View attachment 570211
This potentially has more impact since it's causing hundreds of exceptions to be thrown internally per second, and that was just with the default scene/clothes which are minimal. It was harder to figure out because I couldn't understand why a missing parameter was not being caught in the usual catch/try. It turns out GetBoolParamValue in Assembly-CSharp JSONStorable.cs looks like this:-
View attachment 570212
You can see where the error was coming from. GetBoolParamValue is returning a bool value of 'false' even though the named parameter doesn't exist and is causing an error to be thrown. Then the error won't get caught in the plugin script. It's sort of ok functionally since it sets the missing values to false rather than them being null. In order to tidy it up and stop the errors I've used GetBoolParamNames which returns all the bool value parameter names for the clothing item, then a string comparison to see if the desired parameter name exists for that clothing item - if it does, then and only then, attempt to get the value. This eliminates the error.
I've tried to make the code changes minimal and concise, and I've commented everywhere I have changed/added lines - just search for "B69" to find the commented code. I've done some testing and as far as I can tell the only thing my changes would impact is any existing use of the triggers system if people have them saved - pointing to the old Storable bool "Enable", they would need repointing to "Enable Nipple" in my version of the code. You may prefer to just rename the second one for pubic enable - it currently isn't accessible from triggers, so giving that a new name and not altering the original nipple enable at all should mean zero impact on existing saves.
Video showing my custom code test
View attachment 570222