MV YEP Option Core: How to add a new option to the menu that controls a switch &/or variable?
BMM Archive · July 15, 2026
Original Source
- Original title: MV YEP Option Core: How to add a new option to the menu that controls a switch &/or variable?
- Original author: TheAM-Dol
- Original date: July 18, 2022
- Source thread: https://forums.rpgmakerweb.com/threads/yep-option-core-how-to-add-a-new-option-to-the-menu-that-controls-a-switch-or-variable.149571/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support
Summary
I have decided to repurpose my thread on this problem in hopes that the SEO will have it turn up in google searches more easily. Hopefully those who hit the same brick wall as myself will find this thread and utilize it to overcome that hurdle without having to spend money to fix it (like I wound up having to do). If you want to know more about my original problem, I stuffed my original post into a spoiler tag at the bottom of this post. So, in the end,...
Archived First Post
So, in the end, I decided to commission someone to help me do this since I didn't get any answers here, nor could I find any answers about this through googling.
I'm posting what I commissioned here because I am hoping that anyone who is also looking for this answer will now stumble across what I paid money for:
Requirements:
Before showing the code, it's important to note that without the access to global switches and variables, this won't work. In order to use global variables and switches, you will need Olivia's meta controls which you can find here:
Olivia's Meta Controls
And obviously, all of this require's YEP Option Core:
YEP Option Core
The Code:
This is the code for for menu options that utilize switches:
I'm pasting all the code for the entire thing, even if most of it is default code that doesn't need to be changed. This is to help those who are dumb with coding (like myself) hopefully feel more confident that this is the correct answer.
"Make Option Code"
this.addCommand(name, symbol, enabled, ext);
"Draw Option 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);
this.drawOptionsOnOff(index);
"Process OK Code"
const index = this.index();
symbol = this.commandSymbol(index);
const value = this.getConfigValue(symbol);
this.changeValue(symbol, !value);
const catalyst = $gameSwitches.value(38);
if (catalyst) {
$gameSwitches.setValue(38, false);
} else {
$gameSwitches.setValue(38, true);
}
"Cursor Right Code"
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, true);
$gameSwitches.setValue(38, true);
"Cursor Left Code"
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
this.changeValue(symbol, false);
$gameSwitches.setValue(38, false);
"Default Config Code"
ConfigManager[symbol] = false;
"Save Config Code"
config[symbol] = ConfigManager[symbol];
ConfigManager[symbol] = !!config[symbol];
Setting Default Values
For setting the "Default" value to "TRUE", there seems to be a poor interaction between YEP Option Core and rpg_managers which disables the ability to assign a default value. This discovery is thanks Palin via this thread linked. (the thread will also be linked in the troubleshooting section of this post).
Set the "Default Config Code" to "true"
ConfigManager[symbol] = true;
var value = config[name];
if (value !== undefined) {
ConfigManager[name] = value;
} else {
ConfigManager[name] = true;
}
I have not tested this with variables, thus it has been hidden in the "switch" spoiler tag.
This is the code for menu options that utilize variables:
I'm pasting all the code for the entire thing, even if most of it is default code that doesn't need to be changed. This is to help those who are dumb with coding (like myself) hopefully feel more confident that this is the correct answer.
"Make Option Code"
this.addCommand(name, symbol, enabled, ext);
"Draw Option 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 value = this.getConfigValue(symbol);
var rate = ((value) / 3).clamp(0, 1);
if (value > 6) {
var gaugeColor1 = this.textColor(15);
var gaugeColor2 = this.textColor(0);
} else {
var gaugeColor1 = this.textColor(15);
var gaugeColor2 = this.textColor(0);
}
this.drawOptionsGauge(index, rate, gaugeColor1, gaugeColor2);
this.drawText(" ", titleWidth, rect.y, statusWidth, 'center');
"Process OK Code"
const index = this.index();
symbol = this.commandSymbol(index);
let value = this.getConfigValue(symbol);
value += 1;
if (value > 3) {
value = 0;
}
value = value.clamp(1, 3);
$gameVariables.setValue(40, value);
this.changeValue(symbol, value);
1) Please note the line "$gameVariables.setValue(40,value);" The number 40 is the variable ID number I am controlling in my game. You will need to change this number to match your game.
2) The number of "ticks" this bar can do is controlled here. The "if (value > 3)" line is part of the maximum value the bar can show. Below that, you find this line: "value = value.clamp(1, 3);" clamp is the limiter here. 1 is going to be the lowest possible value, and 3 is going to be the highest possible value. Change this according to your game. (Can't confirm since I am a dummy, but you may need to adjust the clamp value in the "Draw Option Code" as well)
"Cursor Right Code"
const index = this.index();
symbol = this.commandSymbol(index);
let value = this.getConfigValue(symbol);
value += 1;
value = value.clamp(1, 3);
$gameVariables.setValue(40, value);
this.changeValue(symbol, value);
"Cursor Left Code"
const index = this.index();
symbol = this.commandSymbol(index);
let value = this.getConfigValue(symbol);
value -= 1;
value = value.clamp(1, 3);
$gameVariables.setValue(40, value);
this.changeValue(symbol, value);
"Default Config Code"
ConfigManager[symbol] = 0;
"Save Config Code"
config[symbol] = ConfigManager[symbol];
"Load Config Code"
var value = config[symbol];
if (value !== undefined) {
ConfigManager[symbol] = Number(value).clamp(1, 3);
} else {
ConfigManager[symbol] = 1;
}
In addition to the filter that I wanted to integrate into my option menu, I also wanted to integrate a "Full screen" option to the menu. Yes, we all know you can press f4 to go full screen, but I wanted to make my game as close to professional as I can reasonably afford, so providing a clear option in the menu is a step closer towards that.
So, Synrec helped me build a brand new full screen option into the game using YEP's OptionCore. This full screen option does not require the SRD plugin.
"Make Option Code"
this.addCommand(name, symbol, enabled, ext);
"Draw Option 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);
this.drawOptionsOnOff(index);
"Process OK Code"
const index = this.index();
symbol = this.commandSymbol(index);
const value = this.getConfigValue(symbol);
this.changeValue(symbol, !value);
if(!value){
Graphics._requestFullScreen();
}else if(value){
Graphics._cancelFullScreen();
}
"Cursor Right Code"
const index = this.index();
symbol = this.commandSymbol(index);
const value = this.getConfigValue(symbol);
this.changeValue(symbol, true);
Graphics._requestFullScreen();
"Cursor Left Code"
const index = this.index();
symbol = this.commandSymbol(index);
const value = this.getConfigValue(symbol);
this.changeValue(symbol, false);
Graphics._cancelFullScreen();
"Default Config Code"
ConfigManager[symbol] = false;
if(ConfigManager[symbol]){
Graphics._requestFullScreen();
}else if(!ConfigManager[symbol]){
Graphics._cancelFullScreen();
}
"Save Config Code"
config[symbol] = ConfigManager[symbol];
"Load Config Code"
ConfigManager[symbol] = !!config[symbol];
if(ConfigManager[symbol]){
Graphics._requestFullScreen();
}else if(!ConfigManager[symbol]){
Graphics._cancelFullScreen();
}
Credit:
All of the code above was written by Synrec, I just paid him to make it. It would be nice to receive credit (both Synrec and myself - please credit me as "Nolan Alighieri" and not my username) if you use it, but it's not necessary.
Troubleshooting:
If you are still struggling with this, unfortunately I likely won't be able to troubleshoot any problems. As I mentioned, I'm a coding dummy. However, there have been some links posted in this thread that may help you as well. Rather than have you scroll through this entire thread looking for them, allow me to summarize:
This video is a tutorial on how to set up a switch in YEP Options core.
I had originally used this video to set up the switch, and it works fine, however the video doesn't really explain a lot about what it is you are writing, so it's not useful for learning, only useful for imitating.
And some of the code shared in the two threads below may be helpful to some (I had used some of it originally before ultimately deciding to scrap it all and just go to Synrec)
This thread
and
this thread
Additionally, this thread linked, was used to set default values for menu options that control switches.
If you are still struggling to get whatever it is you are trying to get working, I would recommend starting a new thread, rather than posting here. Sharing this thread may help others know what you are working from.
Here is the end result:
I created a visual filter for my game, but I can easily imagine some folks might not enjoy it, so I wanted to allow people to either turn it on or off.
I thought YEP Option core would do the trick, but I don't know what I am doing with it
(but I do like the make over the option menu got!)So here's how I would like to break it down:
1 option is to simply toggle the effect on or off. So in the option menu this would just turn a switch on or off.
The second option would control the intensity of the effect through a variable. Where setting the variable to 1 is a lower intensity, 2 is moderate, and 3 is the full effect. (Would be great if I could rename these values too to something like "low, medium, high"
)Thank you for your help

edit 08/03/2022
Added troubleshooting to set default values for menu options that utilize switches.
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Credit: All of the code above was written by Synrec, I just paid him to make it. It would be nice to receive credit (both Synrec and myself - please credit me as "Nolan Alighieri" and not my username) if you use it, but it's not necessary. Troubleshooting: If you are still struggling with this, unfortunately I likely won't be able to troubleshoot any problems. As I mentioned, I'm a coding dummy. However, there have been some links posted in...
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
Topic Summary
Loading summary...