Reading a Saved File's Switch ID / Variable ID's value

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I would like to know how can I read a certain saved file's switches and variables' value. For example, I changed the value of variable 1 to 90. After that, I saved it. On the title screen, I am trying to read that saved file's variables or switches and store it to a value in Game System or Game Temp for example.

My question is, how can I read a certain saved file's specific variable ID / switch ID and store it into another created variable?

Thanks in advance.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
856
First Language
German
Primarily Uses
var data = JsonEx.parse(StorageManager.load(savefileId));
// data.switches -> switches


// data.variables -> variables

Afterwards, do with it whatever you want.
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Yay, thanks, this helped a lot. All I have to do is to loop it to check each and every value to see which switch is turned on :D
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV
Yay, thanks, this helped a lot. All I have to do is to loop it to check each and every value to see which switch is turned on :D
If you are looking for a specific switch, and know its ID you can just do

data.switches.value(IDHERE);
To get the value.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Okay here's a problem. What if I want to check a certain switch on ALL existing saved files? How can I do that? Because it throws me an unexpected end of input when a saved file is not existent. So my problem is, how can I check ALL existing saved file's specific switch ID?
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
856
First Language
German
Primarily Uses
Code:
DataManager.loadGlobalInfo();
This gives you an array containing the header (what you can see in the save/load screen) of all existing savefiles.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I see. What is the proper check for this?

Parsing the JSON depends on which index my commands are placed. For example, command1 is switch 1. However, I want to load all existing saved files and load to see if switch value is on.

Will I have to store this 

DataManager.loadGlobalInfo()on a new array? If so, how can I completely loop it to check them individually if such switch is on?

Any help on this is appreciated.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Started playing Danganronpa 3 in French - Eyes started bleeding in less than 5 minutes - Installed English text instead.
Why, translator, whyyyy???
-_- Now we have punishments for skipping meals, specially breakfast. At least let me sleep on Fridays -_-
colorize an old sketch
Welp... with numerous plugins and a bit of Javascript help, I've simulated an AP system in battle. Proud of myself honestly.
Why most of games like to give a horrible control to an aircraft vehicle? can I get a simplified control that does not require me to roll first just to change my direction?

Forum statistics

Threads
93,431
Messages
912,301
Members
122,941
Latest member
insani1022
Top