yep_option core switches (solved)

I followed the code from here,trying to get a switch option of on/off to work.
but it does't work.
I have everything in check,i even have olivia's meta controls.
i used hime works sync save data,i deleted it,also tried turning it off,but nothing too.
either together or not,it fails. I also tried turning off most of my plugins (except the ones
necessary for this),and nothing.

1711755572894.png


here's everything,i don't get where the error is since idk code myself.
i just copy pasted from the thread.

1711755120791.png
1711755151094.png

1711755194734.png


1711755214150.png


1711755251230.png

(the left one is the exact same but with false)
1711755305484.png
1711755336485.png


anyone pls,help!! this shouldn't be so hard it's just a simple switch 🙁
There might be other mistakes, but the one the error message is referring to is "symbol" being re-declared. Try removing const and var before your symbol = ... lines.
I know that @TheAM-Dol said that code works for his project, but I can verify that syntax doesn't work for me, either.

If it does, in fact, work for him, it must be because he has a newer version of NW.js and they changed how that syntax works.

You need to change your processOk to say var symbol instead of const symbol (and same for the other lines).

You can also just do plain symbol, as it has already been declared by the plugin function that's evaluating this code; but it won't hurt anything to use var, whereas it will throw an error to use const.

Also, you can get rid of a variable and make the bottom of your code shorter. In processOk, delete everything from const catalyst down and replace it with
Code:
$gameSwitches.setValue(10, !$gameSwitches.value(10));
There might be other mistakes, but the one the error message is referring to is "symbol" being re-declared. Try removing const and var before your symbol = ... lines.
well it works now! but there's a little quirk now-
so I made a dummy npc to check if the switch worked and,it technically does.
it should be off at a new game being made,with 0 saves.
but when I go to the options menu it says it's on,and even weirder,the npc detects it as off because the off text is triggered
1711757193473.png

once i flip it again the npc recognizes them correctly.
but it's kinda annoying that it's technically off but still says on until you manually switch it??
i think it woud confuse players...
Try deleting everything in your save folder. There should be a config and possibly a global file. Then try to playtest.

Also what does your default config look like?
As @Slaughty says, your game options (config) is stored separately from any save files.
I know that @TheAM-Dol said that code works for his project, but I can verify that syntax doesn't work for me, either.

If it does, in fact, work for him, it must be because he has a newer version of NW.js and they changed how that syntax works.

You need to change your processOk to say var symbol instead of const symbol (and same for the other lines).

You can also just do plain symbol, as it has already been declared by the plugin function that's evaluating this code; but it won't hurt anything to use var, whereas it will throw an error to use const.

Also, you can get rid of a variable and make the bottom of your code shorter. In processOk, delete everything from const catalyst down and replace it with
Code:
$gameSwitches.setValue(10, !$gameSwitches.value(10));
I tried what you said and it also fixed the error i told @Mac1500190 about! thnx
Try deleting everything in your save folder. There should be a config and possibly a global file. Then try to playtest.

Also what does your default config look like?
i did delete everything there as a "what if it works" and it did lol
it goes to false by default now 😀
i don't think it needs any more fixes but here u go just in case
1711758357483.png

Original thread: https://forums.rpgmakerweb.com/threads/yep_option-core-switches-solved.167304/