Is there a script to manually load Switches?

I want to manually load the switches data from a savefile with a script

Im noob so i tried

StorageManager.loadFromLocalFile(1)

After of course i tried manually to save a file

StorageManager.saveToLocalFile(1,json) but json is not defined

But i failed at saving the file.

Please share any thoughts. Thanks.
It would help a lot if you add an explanation of what you want to achieve instead of how you want to do that.

There are a lot of possible side effects if switches are loaded without the rest of any savefiles data, and it is quite possible that you will fail to get what you want even if some one gives you the correct answer to the question, simply because you never said what the game effect should be.
Code:
var file = StorageManager.loadFromLocalFile(1);
var fileParse = JsonEx.parse (file);
var switches = file.switches;
Should work. Especially if you give enough time between the first two lines (separating by wait command)

Also, if you intend to use it through editor, then maybe you'd need to delete the var words.
@Andar It is in relation with this thread i made

https://forums.rpgmakerweb.com/inde...ck-from-options-scene-to-pre-title-map.89103/

I triggered a switch in-game. What I am trying to do with this script is have the game check if a switch is on at the very beginning of the game.

@Poryg Here is what it shows me

error.PNG

I first need to say that the switch isn,t saved by normal saving trough the Save Scene. I also need to save the switch manually first, if you would know how i can do that.

If there is a need I will show you my event, or better yet, provide a link to my game for you to understand better. If you want.
Saving switches manually first is a pain in the butt. It would be much better to save it to a totally external file.
Or you could use this plugin.
http://himeworks.com/2015/12/sync-save-data/

It has a plugin command that synchronizes these "global" switches and variables whenever you need to.
Oh I,ll look into it thanks.
I tried it worked, but i had to do this also.
wtf.PNG

But IDK WHY now my bgm that was right under does not play!!!

Srsly something is wrong the audio is cut off entirely with this plugin.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-script-to-manually-load-switches.89148/