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:
Spoiler
In my game, I created a video effect filter to add a little spice to my game. This option in my option menu gives the player the option to turn the filter off in the game if they find the effect too distracting or just prefer a cleaner looking image overall. Both the enabling of this filter (seen here) and the intensity of the filter (seen below in the variable option menu) are controlled through a parallel common event.
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"
"Draw Option Code"
"Process OK Code"
"Cursor Right Code"
"Cursor Left Code"
"Default Config Code"
"Save Config Code"
"Load Config Code" (If you wish to set the default value to "TRUE" (on) instead of "FALSE" (off), do not use this code. Please read the "Default value" section below.
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"
I have not tested this with variables, thus it has been hidden in the "switch" spoiler tag.
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"
Code:
this.addCommand(name, symbol, enabled, ext);"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);
this.drawOptionsOnOff(index);"Process OK Code"
Code:
Please note the number 38 in this code. The number 38 is associated with my game's switch ID number. This number needs to be changed for your game!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"
Code:
Same note as above: change the number 38 to match the switch ID number of your game.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"
Code:
Same note as above: change the number 38 to match the switch ID number of your game.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"
Code:
ConfigManager[symbol] = false;"Save Config Code"
Code:
config[symbol] = ConfigManager[symbol];Code:
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"
Code:
then change the "Load Config Code" to this:ConfigManager[symbol] = true;Code:
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:
Spoiler
In my game, I created a video effect filter to add a little spice to my game. This option in my option menu gives the player the option to change the "intensity" of the filter effect in the event the player likes the effect, but finds it default setting either too weak to enjoy or too intense to use. Both the enabling of this filter (seen above in the switch menu option) and the intensity of the filter (seen here) are controlled through a parallel common event.
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"
"Draw Option Code"
"Process OK Code"
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"
"Cursor Left Code"
"Default Config Code"
"Save Config Code"
"Load Config Code"
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"
Code:
this.addCommand(name, symbol, enabled, ext);"Draw Option Code"
Code:
the numbers you see next to "this.textColor" are the numbers pulled from your img/system image file. If you want to change the look of the gradient on the option bar, change these numbers.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"
Code:
There are 2 things you need to adjust here for your game.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"
Code:
Once again, you will need to change: 1) the number 40 to match your game's variable ID number. 2) the clamp values.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"
Code:
Once again, you will need to change: 1) the number 40 to match your game's variable ID number. 2) the clamp values.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"
Code:
ConfigManager[symbol] = 0;"Save Config Code"
Code:
config[symbol] = ConfigManager[symbol];"Load Config Code"
Code:
Once again, make sure to change the clamp values here.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.
Spoiler
Originally, I had been using SRD Fullscreen option as a plugin to add the option to the vanilla option menu, however, YEP's OptionCore overrides the default option menu and therefore overrode SRD Fullscreen.
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"
"Draw Option Code"
"Process OK Code"
"Cursor Right Code"
"Cursor Left Code"
"Default Config Code"
"Save Config Code"
"Load Config Code"
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"
Code:
this.addCommand(name, symbol, enabled, ext);"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);
this.drawOptionsOnOff(index);"Process OK Code"
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"
Code:
const index = this.index();
symbol = this.commandSymbol(index);
const value = this.getConfigValue(symbol);
this.changeValue(symbol, true);
Graphics._requestFullScreen();"Cursor Left Code"
Code:
const index = this.index();
symbol = this.commandSymbol(index);
const value = this.getConfigValue(symbol);
this.changeValue(symbol, false);
Graphics._cancelFullScreen();"Default Config Code"
Code:
ConfigManager[symbol] = false;
if(ConfigManager[symbol]){
Graphics._requestFullScreen();
}else if(!ConfigManager[symbol]){
Graphics._cancelFullScreen();
}"Save Config Code"
Code:
config[symbol] = ConfigManager[symbol];"Load Config Code"
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:
Original Post
Hi,
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 :LZSlol: (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" :LZSwink:)
Thank you for your help:LZSproud:
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 :LZSlol: (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" :LZSwink:)
Thank you for your help:LZSproud:
edit 08/03/2022
Added troubleshooting to set default values for menu options that utilize switches.