MV [SOLVED] Help creating an option setting with YEP Options Core

Hello, everyone!

Recently in this thread, @Aerosys helped me creating a plugin that can change the IconSet image during gameplay (so that way I can make a few script calls for a new image to replace the default IconSet, or reset the original).

Said plugin is the next:

JavaScript:
(function() {
const _loadSystem = ImageManager.loadSystem;
ImageManager.loadSystem = function(filename) {
 
    return _loadSystem.call(
        this,
        filename.toLowerCase() == 'iconset' && $gameSystem._iconSetOverride
            ? $gameSystem._iconSetOverride
            : filename
    );
}
})()

And it uses the next script calls:

This one is to call a new IconSet image, and load it in the cache, to avoid it not showing the icons the first time you open a menu, or call for an icon image in a message (please, not that the "IconSet_KB" is a mockup of the image name called, and loaded).
JavaScript:
$gameSystem._iconSetOverride = "IconSet_KB"

ImageManager.loadSystem('IconSet_KB');
this.setWaitMode('image');

This other one is to reset the default IconSet image:
JavaScript:
$gameSystem._iconSetOverride = undefined

ImageManager.loadSystem('IconSet');
this.setWaitMode('image');

What I would like to do, now that this plugin can allow me to change the IconSet at will, is to give the players an option to select which IconSet images they desire to use. Why so? For some of the system/tutorial/dialogue texts in my game can reflect Keyboard, XBOX, or PlayStation 5 controller icons.

In the original thread, @alasth gave me some hints on how to create an option for the YEP Options Core plugin, but unfortunatelly, it requires more programming knowledge than that I have.

What I would like is to have an option that reflects 3 possibilities:
  1. To reset the default IconSet image (which will be for Keyboard key icons).
  2. To call for another IconSet image (which will be for the XBOX button icons).
  3. To call for another IconSet image (which will be for the PlayStation button icons).
This choice is to allow players to use the controllers they want, or the icons they can keep track of (some players are more used to PlayStation buttons than XBOX ones, and viceversa).

It would be appreciated if you could spare a moment, and try to help me in this quest.

Thank you very much in advance,
Oscar92player.
XBOX and PSX has different meaning (A and X for example.)
did Gimmer plugin not work that process the icons automatically
for you?

so you can simplify the optionCore easier to recognise if they
want to play keyboard or gamePad?
XBOX and PSX has different meaning (A and X for example.)
did Gimmer plugin not work that process the icons automatically
for you?

so you can simplify the optionCore easier to recognise if they
want to play keyboard or gamePad?

The only thing the plugin does is to allow me to call for different IconSet images at will, and each IconSet image I have prepared is different depending on the controller icon images I want to use.

That's basically what I asked for, because I find it easier to just call for a different IconSet image file depending on the icons I wanna allow the players to see in the game (by choosing them in the YEP Options Core menu).

That means I have 3 different IconSet images prepared:
  1. The default one for the Keyboard icons.
  2. The one for the XBOX icons.
  3. The one for the PlayStation icons.
And all that is left for me, is to create an option in the YEP Options Core, so I can give the three different settings of said option.

This will be a mockup image of what I need:

1755349428416.png


Wish I could build that option myself, but I do not have enough knowledge to set things up with the YEP Options Core, unless they are premade, unfortunatelly.
Check a Yanfly plugin where they've created option settings for more than 2 choices and copy the stuff there from the plugin file to a new Option Core option slot (draw, cursor left/right). I googled for you and 'Battle Animation Speed Options' is one such plugin.

EDIT: and change the codes you got there in the cursor left/right
Check a Yanfly plugin where they've created option settings for more than 2 choices and copy the stuff there from the plugin file to a new Option Core option slot (draw, cursor left/right). I googled for you and 'Battle Animation Speed Options' is one such plugin.
I've checked that one before opening this thread, but that option takes part of the code from other plugin to create that option, so it needs some editions if I want it to work with the plugin presented in this request.

Unfortunatelly, I do not have enough knowledge to make such changes, and I'm afraid it will take a lot of trial and error on my part, without being sure what I could be doing right or wrong.

EDIT 1:

I could make some minor editions of the "Battle Animation Speed Options" and I got this result:

1755444889204.png


However, none of the options seem to be selected, and I still need to figure out how to add the script calls for the plugin that would make this option to work.

This is the codes I used to create an option:

Make Option Code:
Code:
this.addCommand(name, symbol, enabled, ext);

Draw Option Code:
Code:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var quarterWidth = statusWidth / 4;
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changePaintOpacity(value === 4);
var text = "XBOX";
this.drawText(text, titleWidth + quarterWidth * 0, rect.y, quarterWidth, 'center');
this.changePaintOpacity(value === 3);
var text = "PS5";
this.drawText(text, titleWidth + quarterWidth * 1, rect.y, quarterWidth, 'center');
this.changePaintOpacity(value === 2);
var text = "PS4";
this.drawText(text, titleWidth + quarterWidth * 2, rect.y, quarterWidth, 'center');
this.changePaintOpacity(value === 1);
var text = "Teclado";
this.drawText(text, titleWidth + quarterWidth * 3, rect.y, quarterWidth, 'center');

Process OK Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value -= 1;
if (value <= 0) value = 4;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

Cursor Right Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value -= 1;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

Cursor Left Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += 1;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

I would still need some help here, if possible, please.
Hmmm, try putting like this to create 3 options. Seemed to work for me, but I'm not 100% sure if I'm forgetting to paste something here. Then add the codes depending on what value (1-3) the setting is in the cursor right/left. Not sure about the waitmode 'image' stuff though.

Draw:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);

var option1 = "Set 1";
var option2 = "Set 2";
var option3 = "Set 3";
var thirdStatusWidth = this.statusWidth() / 3;
this.resetTextColor();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
(value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');

Cursor Right:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value += 1;
value = value.clamp(1, 3);
this.changeValue(symbol, value);

Cursor Left:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value -= 1;
value = value.clamp(1, 3);
this.changeValue(symbol, value);

Default:
ConfigManager[symbol] = 1;
Hmmm, try putting like this to create 3 options. Seemed to work for me, but I'm not 100% sure if I'm forgetting to paste something here. Then add the codes depending on what value (1-3) the setting is in the cursor right/left. Not sure about the waitmode 'image' stuff though.

Draw:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);

var option1 = "Set 1";
var option2 = "Set 2";
var option3 = "Set 3";
var thirdStatusWidth = this.statusWidth() / 3;
this.resetTextColor();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
(value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');

Cursor Right:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value += 1;
value = value.clamp(1, 3);
this.changeValue(symbol, value);

Cursor Left:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value -= 1;
value = value.clamp(1, 3);
this.changeValue(symbol, value);

Default:
ConfigManager[symbol] = 1;

Tried your test (though in my case I added a fourth option), and it seems like it doesn't show the options at all (it's the one called "Guía de botones TEST"):

1755461196048.png


The previous one, that uses part of the code of the Battle Animation Speed Option plugin seems to draw the four options, but none of them look selected (keep in mind that I still didn't figure out how to use the script calls, so this is just for the option to appear in the menu first).

I'm running out of ideas here, and I'm not sure how to proceed to make my request possible.
Well, it seemed to work for me, though like I said I might have missed something when I posted it here, I can probably check it sometimes tommorrow, unless someone else shows you how to do it.

I didn't check the code you copied and tried yourself, but I think the reason it's not selecting anything is because the value starts undefined and then when you add to it a number it becomes NaN. At least I had that problem and had to change it. The 2-options ON/OFF stuff changes between true and false, so it doesn't matter there.
Well, it seemed to work for me, though like I said I might have missed something when I posted it here, I can probably check it sometimes tommorrow, unless someone else shows you how to do it.

I didn't check the code you copied and tried yourself, but I think the reason it's not selecting anything is because the value starts undefined and then when you add to it a number it becomes NaN. At least I had that problem and had to change it. The 2-options ON/OFF stuff changes between true and false, so it doesn't matter there.


Got your code to work, after realizing that you shared with me the default Draw Code and an addition to the Draw code, but I did not add the entire Draw code, which would be like this:

Code:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
var option1 = "Set 1";
var option2 = "Set 2";
var option3 = "Set 3";
var thirdStatusWidth = this.statusWidth() / 3;
this.resetTextColor();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
(value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');


Now the "Set 1", "Set 2" and "Set 3" options show, but all of them are still grey, as if none were enabled (they only change once you move the cursor to the right or the left):

1755466644937.png



This is how it shows when you move the cursor to the right:

1755466731879.png



EDIT 1:

Got the highlined options to work this time, with the next codings:

Draw Option Code:

Code:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
var option1 = "Set 1";
var option2 = "Set 2";
var option3 = "Set 3";
var option4 = "Set 4";
var thirdStatusWidth = this.statusWidth() / 4;
this.resetTextColor();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
(value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 4 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option4, titleWidth + 3*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');

Process OK Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, !value);

Cursor Right Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value += 1;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

Cursor Left Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value -= 1;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

Default Config Code:
Code:
ConfigManager[symbol] = 1;

Save Config Code:
Code:
config[symbol] = ConfigManager[symbol];

Load Config Code:
Code:
var value = config[symbol];
if (value !== undefined) {
  ConfigManager[symbol] = Number(value).clamp(0, 4);
} else {
  ConfigManager[symbol] = 1;
}

The major change was with the Load Config Code, which is what loads the option when you execute the app/game.

Still, I need to figure out how to apply the options for the script calls:

For the game to replace the defgault IconSet with the PlayStation 4, PlayStation 5, and Keyboard icons:
Code:
$gameSystem._iconSetOverride = "IconSet_KB"

ImageManager.loadSystem('IconSet_KB');
this.setWaitMode('image');

For the game to show the default IconSet with the XBOX icons:
Code:
$gameSystem._iconSetOverride = undefined

ImageManager.loadSystem('IconSet');
this.setWaitMode('image');
You can put that stuff at the bottom of the cursor left/right. Just make conditionals there like

if (value === 3)
{CODE STUFF}
etc

But like I said to my understanding that waitmode stuff doesn't work there. Ask the coder dudes how to put some kind of load listener or whatever there, if possible or necessary.

PS. If you want to use the 'process ok' codes, you should change it to match the multiple options too (like what was in the plugin file where you copied stuff).
your load config should match

Code:
var value = config[symbol];
if (value !== undefined) {
  ConfigManager[symbol] = Number(value).clamp(0, 4); // <=  should be 1, 4
} else {
  ConfigManager[symbol] = 1;
}

but adding the icons there, you might look at SRD_WindowSkinOptions
how its done for YEP options, so you might be do the same for your
controller icons?
You can put that stuff at the bottom of the cursor left/right. Just make conditionals there like

if (value === 3)
{CODE STUFF}
etc

But like I said to my understanding that waitmode stuff doesn't work there. Ask the coder dudes how to put some kind of load listener or whatever there, if possible or necessary.

PS. If you want to use the 'process ok' codes, you should change it to match the multiple options too (like what was in the plugin file where you copied stuff).

your load config should match

Code:
var value = config[symbol];
if (value !== undefined) {
  ConfigManager[symbol] = Number(value).clamp(0, 4); // <=  should be 1, 4
} else {
  ConfigManager[symbol] = 1;
}

but adding the icons there, you might look at SRD_WindowSkinOptions
how its done for YEP options, so you might be do the same for your
controller icons?


Thank you both for your help, but I'm kind of stuck. I still don't know how to implement the script calls along with the codes for the images to load so the new IconSet images show without issues.

Unfortunatelly, from the SRD_WindowSkinOptions plugin, I don't have enough info from the code in the Plugin Parameters that can help me to get this working.

This is the Process OK Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += 1;
if (value > 26) {
  value = 0;
}
value = value.clamp(0, 26);
this.changeValue(symbol, value);

The Cursor Right Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value += 1;
value = value.clamp(0, 26);
this.changeValue(symbol, value);

The Cursor Left Code:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
value -= 1;
value = value.clamp(0, 26);
this.changeValue(symbol, value);


Keep in mind that this code is adapted for the number of Window Skins I setup for my game, and part of the code to call for the those window styles is imported from the SRD plugin itself, so not all the info is in these Plugin Parameters.

I would definitely need more help to get this working properly.
checking SRD_WindowSkinOptions has a list, restruct this
can go way down (inside a struct).

adding the same way around (without parameters) if you have some knowledge,
is to add an iconSheet array (use the index +1 based on configManager).

from there, it can be adopted like above 🙂

I don't have the time currently to get it done, but I don't get a part
in his code how it exactly read the params with switches.
Bumping this.

I still need all possible help.
Completely untested, but maybe:
  1. Use RMMV's reserve mechanic to persistently load all custom icon sheets on session boot. E.g. add to the end of Default Config:
    JavaScript:
    ImageManager.reserveSystem("IconSet_P4");
    ImageManager.reserveSystem("IconSet_P5");
    ImageManager.reserveSystem("IconSet_KB");

  2. Skip the wait mode part, because the images should now get reserved in advance.

  3. Try to sync the per-playthrough value $gameSystem._iconSetOverride to the config value, e.g. on:
    • New game, e.g. a script call in an autorun event on the starting map; and
    • Config change, i.e. Process OK, Cursor Left, and Cursor Right.
    E.g. add to the end of those bits of code:
    JavaScript:
    var img;  // default, undefined
    switch (ConfigManager[symbol]) {
      case 2:
        img = "IconSet_P4"; break;
      case 3:
        img = "IconSet_P5"; break;
      case 4:
        img = "IconSet_KB"; break;
    }
    $gameSystem._iconSetOverride = img;
Completely untested, but maybe:
  1. Use RMMV's reserve mechanic to persistently load all custom icon sheets on session boot. E.g. add to the end of Default Config:
    JavaScript:
    ImageManager.reserveSystem("IconSet_P4");
    ImageManager.reserveSystem("IconSet_P5");
    ImageManager.reserveSystem("IconSet_KB");

  2. Skip the wait mode part, because the images should now get reserved in advance.

  3. Try to sync the per-playthrough value $gameSystem._iconSetOverrideto the config value, e.g. on:
    • New game, e.g. a script call in an autorun event on the starting map; and
    • Config change, i.e. Process OK, Cursor Left, and Cursor Right.
    E.g. add to the end of those bits of code:
    JavaScript:
    var img;  // default, undefined
    switch (ConfigManager[symbol]) {
      case 2:
        img = "IconSet_P4"; break;
      case 3:
        img = "IconSet_P5"; break;
      case 4:
        img = "IconSet_KB"; break;
    }
    $gameSystem._iconSetOverride = img;


Okay, so correct me if I'm wrong, because I still need to figure things out with this setup.

You say that the codes for the option should look like this?

Make Option Code:
JavaScript:
this.addCommand(name, symbol, enabled, ext);

Draw Option Code:
JavaScript:
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawOptionsName(index);
var option1 = "XBOX";
var option2 = "PS4";
var option3 = "PS5";
var option4 = "Teclado";
var thirdStatusWidth = this.statusWidth() / 4;
this.resetTextColor();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
(value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
value === 4 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
this.drawText(option4, titleWidth + 3*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');

Process OK Code:
JavaScript:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, !value);

Cursor Right Code:
JavaScript:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value += 1;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

var img;  // default, undefined
switch (ConfigManager[symbol]) {
  case 2:
    img = "IconSet_P4"; break;
  case 3:
    img = "IconSet_P5"; break;
  case 4:
    img = "IconSet_KB"; break;
}
$gameSystem._iconSetOverride = img;

Cursor Left Code:

JavaScript:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol) || 1;
value -= 1;
value = value.clamp(1, 4);
this.changeValue(symbol, value);

var img;  // default, undefined
switch (ConfigManager[symbol]) {
  case 2:
    img = "IconSet_P4"; break;
  case 3:
    img = "IconSet_P5"; break;
  case 4:
    img = "IconSet_KB"; break;
}
$gameSystem._iconSetOverride = img;

Default Config Code:
JavaScript:
ConfigManager[symbol] = 1;

ImageManager.reserveSystem("IconSet_P4");
ImageManager.reserveSystem("IconSet_P5");
ImageManager.reserveSystem("IconSet_KB");

Save Config Code:
JavaScript:
config[symbol] = ConfigManager[symbol];

Load Config Code:
JavaScript:
var value = config[symbol];
if (value !== undefined) {
  ConfigManager[symbol] = Number(value).clamp(0, 4);
} else {
  ConfigManager[symbol] = 1;
}

If I'm missing something, I would like to know, because this is too tricky for me, and unfortunatelly my idea and knowledge of coding is near to "null" (except for some things that can be copy-pasted, or pre-made).

Also, I would like to know the reason behind why I should make an auto-run event on the New Game with the script call $gameSystem._iconSetOverride (and if I need to add it as the $gameSystem._iconSetOverride = undefined), because I didn't understand that part very well.

Thank you in advance.
those are on scene boot (seperate plugin)
JavaScript:
ImageManager.reserveSystem("IconSet_P4");
ImageManager.reserveSystem("IconSet_P5");
ImageManager.reserveSystem("IconSet_KB");

//like
    let Alias_SB_start = Scene_Boot.prototype.start;
        Scene_Boot.prototype.start = function() {
           ImageManager.reserveSystem("IconSet_P4");
           ImageManager.reserveSystem("IconSet_P5");
           ImageManager.reserveSystem("IconSet_KB");
            Alias_SB_start .apply(this, arguments);
                
        };

this is so to preload the image correctly on usage (as I I preload the image
automatically from custom folder, so you can also extend it, and add the
entire system folder as preload to load on boot, so it works.

Galve ImageCache can do this as well, just add the image to preload on boot.

your load config should match (0-4 = 5, 1-4 = 4)

Code:
var value = config[symbol];
if (value !== undefined) {
  ConfigManager[symbol] = Number(value).clamp(1, 4);
} else {
  ConfigManager[symbol] = 1;
}

but that should do the trick hopefully.
those are on scene boot (seperate plugin)
JavaScript:
ImageManager.reserveSystem("IconSet_P4");
ImageManager.reserveSystem("IconSet_P5");
ImageManager.reserveSystem("IconSet_KB");

//like
    let Alias_SB_start = Scene_Boot.prototype.start;
        Scene_Boot.prototype.start = function() {
           ImageManager.reserveSystem("IconSet_P4");
           ImageManager.reserveSystem("IconSet_P5");
           ImageManager.reserveSystem("IconSet_KB");
            Alias_SB_start .apply(this, arguments);
         
        };

this is so to preload the image correctly on usage (as I I preload the image
automatically from custom folder, so you can also extend it, and add the
entire system folder as preload to load on boot, so it works.

Galve ImageCache can do this as well, just add the image to preload on boot.

your load config should match (0-4 = 5, 1-4 = 4)

Code:
var value = config[symbol];
if (value !== undefined) {
  ConfigManager[symbol] = Number(value).clamp(1, 4);
} else {
  ConfigManager[symbol] = 1;
}

but that should do the trick hopefully.
Completely untested, but maybe:
  1. Use RMMV's reserve mechanic to persistently load all custom icon sheets on session boot. E.g. add to the end of Default Config:
    JavaScript:
    ImageManager.reserveSystem("IconSet_P4");
    ImageManager.reserveSystem("IconSet_P5");
    ImageManager.reserveSystem("IconSet_KB");

  2. Skip the wait mode part, because the images should now get reserved in advance.

  3. Try to sync the per-playthrough value $gameSystem._iconSetOverrideto the config value, e.g. on:
    • New game, e.g. a script call in an autorun event on the starting map; and
    • Config change, i.e. Process OK, Cursor Left, and Cursor Right.
    E.g. add to the end of those bits of code:
    JavaScript:
    var img;  // default, undefined
    switch (ConfigManager[symbol]) {
      case 2:
        img = "IconSet_P4"; break;
      case 3:
        img = "IconSet_P5"; break;
      case 4:
        img = "IconSet_KB"; break;
    }
    $gameSystem._iconSetOverride = img;

Unless I'm doing something wrong, I'm not getting this working, the IconSets aren't being replaced, and pressing the OK/Confirm button makes all the selections to look "unselected" in grey.

Pressing the OK/Confirm button makes all the selections to look "unselected" in grey, not sure why didn't I notice this issue before.
(Fixed this by adding the same parameters for the load of images in the Left and Right Cursor codes).

I've changed the value in the Load Config Code, and seems to work properly.

This is what the Process OK Code looks like:
Code:
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, !value);

Also, I still don't know where, of all the code sections of the plugin parameters from YEP Options Core do I need to put the $gameSystem._iconSetOverride script call.


EDIT 1: Okay, my bad, it seems that it is calling the IconSet properly using the Left and Right keys/buttons, but the selected IconSet (for PS4, PS5 or Keyboard) does not prevail when you close the game, and open it again, so it starts showing the default IconSet image again (the XBOX one) despite the other options being selected in the menu.

EDIT 2: And the same happens when you load or start a new game.

I do hope we are getting close now.
OK, so I've noticed a problem with my previous suggestion. Aerosys's plugin references $gameSystem, which is saved per-playthrough. But you want to reference a game option, which is the same for all playthroughs.

I see a couple of possible approaches here:
  1. Find a way to synchronise the value on both new game and load game; or
  2. Edit Aerosys's plugin to reference your new in-game option instead of $gameSystem.
The second one looks much easier! Here's an edit of Aerosys's code (untested), including image reservation on game boot:
Spoiler: plugin code
JavaScript:
;(function() {
"use strict";
  // Plugin config.
  /** Internal symbol for the "iconset" in-game option. @type {string} */
  const SYMBOL = "icons";
  /** Ordered list of alternative iconset image filenames. @type {string[]} */
  const IMAGES = [,, "IconSet_P4", "IconSet_P5", "IconSet_KB"];

  // Patch - redirect IconSet.png based on custom option value.
  const _loadSystem = ImageManager.loadSystem;
  ImageManager.loadSystem = function(filename) {
    if (filename.toLowerCase() == "iconset") {
      const value = IMAGES[ConfigManager[SYMBOL]];
      if (value)
        filename = value;
    }
    return _loadSystem.call(this, filename);
  }

  // Patch - reserve alternative iconsets on boot.
  const _loadSystemImages = Scene_Boot.loadSystemImages;
  Scene_Boot.loadSystemImages = function() {
    _loadSystemImages.apply(this, arguments);
    for (const img of IMAGES)
      if (img)
        ImageManager.reserveSystem(img);
  };

})();
Here I have assumed that:
  • Your option's SYMBOL (defined in a YEP_OptionsCore parameter) is icons.
  • Your custom iconset IMAGES are named IconSet_P4.png, IconSet_P5.png, and IconSet_KB.png.
Replace any of those as needed.

For the YEP_OptionsCore settings, I'd suggest:
  • Make Option (no change):
    JavaScript:
    this.addCommand(name, symbol, enabled, ext);
  • Draw Option (no change - could be neater but why risk breaking things):
    Spoiler: copy of the draw option code you posted
    JavaScript:
    var rect = this.itemRectForText(index);
    var statusWidth = this.statusWidth();
    var titleWidth = rect.width - statusWidth;
    this.resetTextColor();
    this.changePaintOpacity(this.isCommandEnabled(index));
    this.drawOptionsName(index);
    var option1 = "XBOX";
    var option2 = "PS4";
    var option3 = "PS5";
    var option4 = "Teclado";
    var thirdStatusWidth = this.statusWidth() / 4;
    this.resetTextColor();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol);
    (value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
    value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
    value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
    value === 4 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option4, titleWidth + 3*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
  • Process OK (remove $gameSystem stuff, add wrap):
    JavaScript:
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol) || 1;
    value += 1;
    if (value > 4)  // wrap: 1, 2, 3, 4, 1, 2, etc
      value = 1;
    else
      value = value.clamp(1, 4);
    this.changeValue(symbol, value);
  • Cursor Left (remove $gameSystem stuff):
    JavaScript:
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol) || 1;
    value -= 1;
    value = value.clamp(1, 4);
    this.changeValue(symbol, value);
  • Cursor Right (remove $gameSystem stuff):
    JavaScript:
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol) || 1;
    value += 1;
    value = value.clamp(1, 4);
    this.changeValue(symbol, value);
  • Default Config (remove ImageManager stuff):
    JavaScript:
    ConfigManager[symbol] = 1;
  • Save Config (no change):
    JavaScript:
    config[symbol] = ConfigManager[symbol];
  • Load Config (remove redundant "else" - handled by Default - and add paranoid type check):
    JavaScript:
    var value = config[symbol];
    if (value !== undefined) {
      ConfigManager[symbol] = Number(value).clamp(1, 4) || 1;  // interpret NaN as 1
    }
(Hopefully I haven't typo'd anything there.)

[Edit: corrected a couple of typos! Added another comma (undefined) at the start of IMAGES, and corrected .prototype.loadSystemImages to .loadSystemImages.]
OK, so I've noticed a problem with my previous suggestion. Aerosys's plugin references $gameSystem, which is saved per-playthrough. But you want to reference a game option, which is the same for all playthroughs.

I see a couple of possible approaches here:
  1. Find a way to synchronise the value on both new game and load game; or
  2. Edit Aerosys's plugin to reference your new in-game option instead of $gameSystem.
The second one looks much easier! Here's an edit of Aerosys's code (untested), including image reservation on game boot:
Spoiler: plugin code
JavaScript:
;(function() {
"use strict";
  // Plugin config.
  /** Internal symbol for the "iconset" in-game option. @type {string} */
  const SYMBOL = "icons";
  /** Ordered list of alternative iconset image filenames. @type {string[]} */
  const IMAGES = [, "IconSet_P4", "IconSet_P5", "IconSet_KB"];

  // Patch - redirect IconSet.png based on custom option value.
  const _loadSystem = ImageManager.loadSystem;
  ImageManager.loadSystem = function(filename) {
    if (filename.toLowerCase() == "iconset") {
      const value = IMAGES[ConfigManager[SYMBOL]];
      if (value)
        filename = value;
    }
    return _loadSystem.call(this, filename);
  }

  // Patch - reserve alternative iconsets on boot.
  const _loadSystemImages = Scene_Boot.prototype.loadSystemImages;
  Scene_Boot.prototype.loadSystemImages = function() {
    _loadSystemImages.apply(this, arguments);
    for (const img of IMAGES)
      if (img)
        ImageManager.reserveSystem(img);
  };

})();
Here I have assumed that:
  • Your option's SYMBOL (defined in a YEP_OptionsCore parameter) is icons.
  • Your custom iconset IMAGES are named IconSet_P4.png, IconSet_P5.png, and IconSet_KB.png.
Replace any of those as needed.

For the YEP_OptionsCore settings, I'd suggest:
  • Make Option (no change):
    JavaScript:
    this.addCommand(name, symbol, enabled, ext);
  • Draw Option (no change - could be neater but why risk breaking things):
    Spoiler: copy of the draw option code you posted
    JavaScript:
    var rect = this.itemRectForText(index);
    var statusWidth = this.statusWidth();
    var titleWidth = rect.width - statusWidth;
    this.resetTextColor();
    this.changePaintOpacity(this.isCommandEnabled(index));
    this.drawOptionsName(index);
    var option1 = "XBOX";
    var option2 = "PS4";
    var option3 = "PS5";
    var option4 = "Teclado";
    var thirdStatusWidth = this.statusWidth() / 4;
    this.resetTextColor();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol);
    (value === 1 || value === undefined) ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option1, titleWidth, rect.y, thirdStatusWidth, 'center');
    value === 2 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option2, titleWidth + thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
    value === 3 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option3, titleWidth + 2*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
    value === 4 ? this.changePaintOpacity(1) : this.changePaintOpacity(0);
    this.drawText(option4, titleWidth + 3*thirdStatusWidth, rect.y, thirdStatusWidth, 'center');
  • Process OK (remove $gameSystem stuff, add wrap):
    JavaScript:
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol) || 1;
    value += 1;
    if (value > 4)  // wrap: 1, 2, 3, 4, 1, 2, etc
      value = 1;
    else
      value = value.clamp(1, 4);
    this.changeValue(symbol, value);
  • Cursor Left (remove $gameSystem stuff):
    JavaScript:
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol) || 1;
    value -= 1;
    value = value.clamp(1, 4);
    this.changeValue(symbol, value);
  • Cursor Right (remove $gameSystem stuff):
    JavaScript:
    var index = this.index();
    var symbol = this.commandSymbol(index);
    var value = this.getConfigValue(symbol) || 1;
    value += 1;
    value = value.clamp(1, 4);
    this.changeValue(symbol, value);
  • Default Config (remove ImageManager stuff):
    JavaScript:
    ConfigManager[symbol] = 1;
  • Save Config (no change):
    JavaScript:
    config[symbol] = ConfigManager[symbol];
  • Load Config (remove redundant "else" - handled by Default - and add paranoid type check):
    JavaScript:
    var value = config[symbol];
    if (value !== undefined) {
      ConfigManager[symbol] = Number(value).clamp(1, 4) || 1;  // interpret NaN as 1
    }
(Hopefully I haven't typo'd anything there.)

Thank you very much! It now saves the selected option, and the replaced IconSet remains when you close and open the app again, start a new game, or load a new one!

That said... there's an issue: the XBOX option shows the PS4 buttons; the PS4 option shows the PS5 buttons; the PS5 option doesn't show the icons at first, and after trying again, it loads the iconset image and shows the Keyboard buttons; the "Teclado" option shows the XBOX buttons.

I'm sure I copied everything that you shared with me properly...


EDIT 1: I think I fixed the incorrect button icons by changing a bit your plugin, @caethyril, it was because of this line:

Code:
  const IMAGES = [, "IconSet_P4", "IconSet_P5", "IconSet_KB"];

I edited it, leaving it like this:

Code:
  const IMAGES = [, "IconSet", "IconSet_PS4", "IconSet_PS5", "IconSet_KB"];

With that order, it will show the default IconSet image with the XBOX button icons with the first option (XBOX), the IconSet image with the PS4 button icons with the second option (PS4), the IconSet image with the PS5 button icons with the third option (PS5), and the IconSet image with the Keyboard key icons with the fourth option (Teclado).

As for the loading of IconSets (the issue for which the images didn't load and the game shows an empty space where the icon has to be), I enabled again the plugin that @ShadowDragon shared before (with a few changes):

Code:
let Alias_SB_start = Scene_Boot.prototype.start;
    Scene_Boot.prototype.start = function() {
        ImageManager.reserveSystem("IconSet");
        ImageManager.reserveSystem("IconSet_PS4");
        ImageManager.reserveSystem("IconSet_PS5");
        ImageManager.reserveSystem("IconSet_KB");
        Alias_SB_start .apply(this, arguments);
             
    };

To make sure things works as expected, I kept the two plugins (the one from Aerosys and your edits, and the loader from ShadowDragon) together in the plugin manager:

1755987618771.png


And with that... it is done! Or it seems so!

I don't know how to thank you, @Aerosys, @rpgLord69, @ShadowDragon, and @caethyril for all the help you've provided, and all the patience you got with all my askings and replies.

I really hope this thread could be of use to other users around there, because for me, it has been a lifesaver.

Thank you very much for all your help!

Original thread: https://forums.rpgmakerweb.com/threads/solved-help-creating-an-option-setting-with-yep-options-core.179599/