MV Why won't these options save when re-loading or restarting the game?

I'm using Yanfly's Options Core, found here:

http://www.yanfly.moe/wiki/Options_Core_(YEP)

I'm also using Galv's Message Sound Effects, found here:

https://galvs-scripts.com/2015/11/05/mv-message-sound-effects/

I use Message SFX to control the typing effect that plays when text is typed out during a show message event. It also makes it so that there's a confirm SFX played when the player advances dialog.

What I'm trying to do is have it so that players can turn both of these sound types on or off through the options menu, which I use the Yanfly plugin for.

I actually have it almost working. I can go into the options and turn off either of those sounds and they do indeed turn off, but then if I save and reload it is back to normal. Same thing if I restart the entire game.

Here's the different code that's used in the plugin settings for the Options plugin. I feel like it has to be something I'm doing wrong here. Maybe in the Save Config Code section?

PRESS OK CODE:

var index = this.index();

var symbol = this.commandSymbol(index);

var value = this.getConfigValue(symbol);

this.changeValue(symbol, !value);



var catalyst = $gameSwitches.value(6);

if (catalyst) {

$gameSwitches.setValue(6, false)



CallPluginCommand('MSGSE TALK 1');

;

} else {

$gameSwitches.setValue(6, true);



CallPluginCommand('MSGSE TALK 2');

}

CURSOR RIGHT CODE:

var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, value);
CallPluginCommand('MSGSE TALK CLEAR');

CURSOR LEFT CODE:

var index = this.index();

var symbol = this.commandSymbol(index);

var value = this.getConfigValue(symbol);

this.changeValue(symbol, value);

CallPluginCommand('MSGSE TALK CLEAR');

DEFAULT CONFIG CODE:

ConfigManager[symbol] = false;

SAVE CONFIG CODE:
''
LOAD CONFIG CODE:

var value = config[symbol];
if (value !== undefined) {
ConfigManager[symbol] = Number(value).clamp(0, 100);
} else {
ConfigManager[symbol] = 100;
}
If you have nothing in Save Config, then it will never save that option. Try reinstating the default:

config[symbol] = ConfigManager[symbol];
Basically, config here is the save data and ConfigManager is the game data.
If you have nothing in Save Config, then it will never save that option. Try reinstating the default:

config[symbol] = ConfigManager[symbol];

Basically, config here is the save data and ConfigManager is the game data.
This didn't fix it, unfortunately.

I think this might not even be workable. One thing I'm realizing is that the diag sounds are turned on and off by those MSG TALK sections, but that plugin always defaults to on when you reload or restart.
Spoiler: Original reply
OK, on closer inspection I think most of the code in your opening post needs a rewrite. 😅
  • It's currently an on/off setting but its value is loaded as a number from 1~100 (i.e. always true);
  • The talk/confirm message SE is not updated on config load to match the loaded value;
  • Pressing left/right clears the SE without changing the value;
  • Pressing OK toggles between talk SE 1 and 2 (via a switch rather than the current value?), then inverts the value (true <-> false);
  • There's a Draw Option Code section which I assume you've left at the default (ON/OFF).
Questions:
  1. It looks like Galv's plugin provides 4 "quick SE" options in its parameters for each SE type. How many different options do you want to offer the user?

  2. Do you want 2 separate options, 1 for the "talk" SE and 1 for "confirm"?

  3. How do you want the option(s) to be displayed? As an ON/OFF sort of thing or a number selection, e.g. OFF, 1, 2, 3?

  4. I notice you have this:

    var catalyst = $gameSwitches.value(6);

    Is that just something you added when trying to get the option to toggle as you wanted or does it have some other purpose?
(Personally I'd use Galv.pCmd.MSGSE(["TALK", "CLEAR"]) instead of CallPluginCommand("MSGSE TALK CLEAR"). I guess the latter is from another plugin...if it works for you then that's A-OK.)

[Edited question 3 for clarity.]
Edit: oh wait, sorry. If the plugin resets on new/load game (which makes sense) then you'll need some kind of additional plugin, either to run a common event to update the SE on load game, or to disable Galv's message SE reset on new/load game.

Original thread: https://forums.rpgmakerweb.com/threads/why-wont-these-options-save-when-re-loading-or-restarting-the-game.149385/