Help involving ".ini" file(s)

I was wondering if there was anyway for me to create and freely edit a file that the game will read from and perform specific actions depending on what it reads from the file.

My main goal the games variables and switches and read them upon the games initial load up.

Example:

On a new game Switch1 is set to OFF

Later Switch1 has been set to ON 

Variable3 is set to 5

the game then stores that information into the file and the game continues as normal

the player decides to start a new game

the game reads the stored file information

Instead of Switch1 being OFF it remains as ON and Variable3 stays at 5 while everything the file doesn't specify retains the default​s

I have no idea if this is possible, and if it is how would I do this?

I'd prefer the file to be .ini as its easier for me to use

And sorry if this is a bad explanation I'm really tired, sick and this was hard to explain in the first place.



--This idea was inspired by a popular game known as Undertale
It can be done with scripts and scripts only, because you have to handle the files yourself.

If you search the forum and the master script list, you should be able to find scripts for "persistent switches" and similiar functions as others have wanted this before

I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.
You will need a global save file to do that.

Since you only want 2 global variables to be saved ($game_switches and $game_variables),  you should be able to save and load only that 2 variables.

I've done a similar script before but doing the exact opposite of what you want, (not saving variables and switches, but actor level and party items only).

http://forums.rpgmakerweb.com/index.php?/topic/45356-chapter-select/

As far as i can tell, you only want the global save file to effect new games and not all loaded games right?

Depending on your answer, the script will work differently.

And it can actually be done using eventing only, depending on your skill. (There's an example of it somewhere in the request board here)

But script will be easier and automatically set up the load sequence for you. You will still need eventing to decide when to save the file though. 

edit:

and you will be facing a logic error if you only want it for new game.

because any loaded game has a chance or overwriting that global save into something new.
You will need a global save file to do that.

Since you only want 2 global variables to be saved ($game_switches and $game_variables),  you should be able to save and load only that 2 variables.

I've done a similar script before but doing the exact opposite of what you want, (not saving variables and switches, but actor level and party items only).

http://forums.rpgmakerweb.com/index.php?/topic/45356-chapter-select/

As far as i can tell, you only want the global save file to effect new games and not all loaded games right?

Depending on your answer, the script will work differently.

And it can actually be done using eventing only, depending on your skill. (There's an example of it somewhere in the request board here)

But script will be easier and automatically set up the load sequence for you. You will still need eventing to decide when to save the file though. 

edit:

and you will be facing a logic error if you only want it for new game.

because any loaded game has a chance or overwriting that global save into something new.
I believe it should effect loaded games as well, in case something were to happen to the saved file, and when the game is loaded, and played.

If players played to a point and created the normal save file, while the global save had already saved and updated with new information so even if the player were to close the game and re-open it before they saved the normal file again, the global save would remember what the player had done (using the switches and variables saved within) 

The game itself would adapt based on the choices a player makes, and would remember those choices even if the player doesn't save the game themselves, and they use a new game.

The only way for the choices to be erased would be for the global save to be erased, completely.

So after looking at the link you had posted, I think what I would need is simply the portion of the script that allows for the; as you stated

"[4] Inheritable save files for each chapter."

but only one save file that will remain and constantly be edited and saved again.

Sorry if I'm not making sense.
Nope, if you want the load file to be involved, the system will be different from what my chapter select is doing.

The load method will need a good overwrite to load the global save file every time the player loads a file to actually read from 2 files instead of one. And the save method will need a good overwrite to separately save the datas into the global save and the normal save files. Not a hard thing to do, but i don't have the time for it today, so probably after new year.

I'll try to write the script as soon as i have free time tomorrow. Happy 2016!
So all you need is to retain certain variables/switches?
Happy 2016!

Made the script in 15mins before I head to bed, so it's not 100% tested.

Let me know if you run into any problem.

This script changes the Game Variables and Switches into global, and share it among all saves.

So whenever your player load a game or start a new game, the variable & switches are inherited and shared.

Global save is updated when a player save a game. Or when you call the force save script call.

edit:

It also remove the game switch and variables from the normal save to reduce save file size (because they are no longer needed in normal save)

The normal save file will not save extra data if not needed depending on which global save data you are using.

edit:

Note that Self-Switches are not global, they still save and load from the normal save files. Let me know if you want these to be changed to global too.

You can now choose whether to change switch/variable/self-switch into global in script settings.

You can force the global save file to save without having the player to save a game by using this script call:

force_global_saveScript:

http://forums.rpgmakerweb.com/index.php?/topic/54165-change-switchesself-switchesvariables-to-global-save-data/
Happy 2016!

Made the script in 15mins before I head to bed, so it's not 100% tested.

Let me know if you run into any problem.

This script changes the Game Variables and Switches into global, and share it among all saves.

So whenever your player load a game or start a new game, the variable & switches are inherited and shared.

Global save is updated when a player save a game. Or when you call the force save script call.

edit:

It also remove the game switch and variables from the normal save to reduce save file size (because they are no longer needed in normal save)

The normal save file will not save extra data if not needed depending on which global save data you are using.

edit:

Note that Self-Switches are not global, they still save and load from the normal save files. Let me know if you want these to be changed to global too.

You can now choose whether to change switch/variable/self-switch into global in script settings.

You can force the global save file to save without having the player to save a game by using this script call:

force_global_saveScript:

http://forums.rpgmakerweb.com/index.php?/topic/54165-change-switchesself-switchesvariables-to-global-save-data/
Seems to work great. Haven't run into any issues or anything, Thanks for your help. And taking the time to make this script; I appreciate the hard work, happy 2016 😀
You're welcome! 😉

Original thread: https://forums.rpgmakerweb.com/threads/help-involving-ini-file-s.53961/