Also, this is obviously first pass, there is some stuff I would like to tweak. I just threw this together with the debugger in 5 minutes
Ok, here you go. This may have a bug or two since I didn't test it and the thread for the settings manager framework is here: https://forums.uberent.com/threads/rel-settings-manager-v1-4-0-58772.54588/ The framework doesn't support checkboxes so I used a drop down but that means you can easily add other styles in the future. (Like no border transparent, hint, hint.) Add these two lines to your modinfo.json: Code: "settings": [ "coui://ui/mods/ID/Settings.js" ], "requires": [ "rSettingsManager" ] Make the settings.js file as listed in step one and put this code in it: Code: (function () { model.addSetting_DropDown("Transparency: ", "cBBB_Trans", "UI", ["Transparent", "Invisible"], 0, "Better Build Bar"); })(); Now add this line before the first line that reads the setting in your main js file: Code: initialSettingValue("cBBB_Trans", 0); Now use this line to get the index of the current selected value: (0 = "Transparent", 1 = "Invisible") Code: var value = settings.cBBB_Trans; Realize that it wasn't that hard and be glad you didn't have to write something like the monster of a settings.js file that I wrote for my custom unit names mod. Basicly what is happening here is you are using the settings framework mod from raevn to add a new settings group and item when the settings menu is loaded. (Same way the main part of your mod works.) The framework also takes care of saving that setting using the localstorage functions in js. Then in the main js file you use the initialSettingValue function to set the default value in case the user hasn't loaded the settings menu yet. Finally, you read the value from the localstorage using settings.id and use it for your UI.
after much frustration I found there is something wrong with your code at some point, this is because it says settings is not defined from step 4, any ideas?
oops, stupid me. I just released that I mixed raevn's example code and my code in the wrong way there. Replace settings with localStorage and it should work.
okay, well i am still having problems the variable is still undefined, can you look at this @LavaSnake i have my wip attached
thanks @Corang ! by the way I like to be referred to as tatsu rather than tatsujb, just a heads up now that we know each other better
hey, no problem, I enjoy doing this, after I get this all sorted out with settings manager I will start trying to get the auto commander select to work.
I looked it over real quick and it seems to be an issue with the ID. I'll look into it more when I get the time and post the fixed version here.
Fixed it. There were two issues. First, we were using the wrong command to get the value in settings. We should have used this command: Code: decode(localStorage.settings).cBBB_Trans; Second the value we get is actually the text and not the index of the selection. I've uploaded the fixed version.