Adding an extra command to Yanfly's System Options with Fullscreen++ Add-on

Hello all! I'd like to request an extra command be added to Yanfly Engine Ace - System Options v1.00 Add-on++(EDITED by Oscar92player). The idea is to have the Yanfly System Options also customize keybindings. During research, I found this file and these set of scripts.


Essentially, it's a combo of scripts that open an in-game window to customize your keybindings (an alternative to F1). In the manual for the scripts, it says this.

Code:
#-------------------------------------------------------------------------------

# * < Script Calls >

#-------------------------------------------------------------------------------

# * To open the control configuration menu manually, use this script call:

#

#     SceneManager.call(ConfScene)

#

#   No further explanation should be needed for this.

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I was hoping to make Yanfly System Options open the control configuration menu somehow but it's beyond my coding ability. Would anyone be able to assist in adding another command to yanfly engine system options? Here's some images of what I'm imagining.

test2.jpg


A command in Yanfly System options called Controls would open up to the keybindings scene. I'm assuming that pressing ESC would return back to the options screen but I don't know 😅

test1.jpg


edit: Oh, and here's a link to the orginal Yanfly Engine Ace - System Options v1.00 and the Add-On utilizing the Fullscreen++ script.


I am not allowed to say anything here about what you did wrong as other people don't like it when I help members understand the forum rules and mods don't want me to do their job. I could report the problem and let a mod inform you of the issue, so watch for it. Nothing big, just procedures.

Adding anything to Yanfly system option requires several parts changed.
You found the command and that's sometimes one of the hard parts.
The short answer to your question (and to help you do it yourself) is to follow the same process that OscarPlayer92 did.
The long answer is this.
In your command section add in the command you want to use.
Whatever you want to call it, e.g. :keys,
Next is the command vocab.
copy and paste one of the options. fullscreen is fine, blank is also fine and even window_red.
The part to be concerned with is the option1 and option 2. they should say none like the others do. The first part will be the command text to show up and the last part is the text in the help window.
Follow so far?
Next is the hard parts.
Down into the script around line 588, there is ok_enabled? method
In there is to_title and shutdown.
We will be going through and adding your command name to all the locations where to_title is found.
This is because the command you want to perform is going to another scene and is actiated by pressing the ok button while on the option, there is no adjusting the value like the sound or colours.
Just add :keys after the shutdown. Don't forget to add the comma.
Next is around line 612, repeat adding command name.
Next is around line 665,repeat adding command name.
Last is the actual command addition.
Around line 983 is create_command_window
Copy and paste one of the command lines and just change the command to reflect your new command. But also give it a unique method name. e.g.
@command_window.set_handler(:keys, method(:command_input_config))
and finally copy and paste one of the methods for the command such as command_to_title.
Except you don't need the fadeout_all, delete that part in your new method.
Your new method will be called the same as the name you just wrote down in the @command_window part. e.g. command_input_config
and you change the SceneManager call for the scene that you mentioned in the script.
SceneManager.call(ConfScene)

Questions?
I am not allowed to say anything here about what you did wrong as other people don't like it when I help members understand the forum rules and mods don't want me to do their job. I could report the problem and let a mod inform you of the issue, so watch for it. Nothing big, just procedures
Understood. I saw rules/etiquette for this part of the forum a while back but couldn't find them again before posting. I found them. Apologies for any rules broken. Think I spotted the problem and fixed my original post. Hopefully - let me know!

Questions?
Wow! That really did it! Thank you so much for the thorough instructions!

I do have a question since you ask 😉 It maybe hard. Is it possible to control what command is selected (in the system options) after exiting the control config. menu? Right now, exiting the control config. defaults to the top command. It'd be more polished if the game defaulted to the controls command (which is currently located at the bottom).

Thought of a possible workaround, though. Move the controls command to the top of the system options. Controls as the first command seems out of the ordinary but it could work. I'll have to experiment. Anyway, I really appreciate your brain power on this topic!
Is it possible to control what command is selected (in the system options) after exiting the control config. menu?
It will require using a global variable.
I tested it with $game_variables[19] so if you want to use another variable just change the number.

at the top of Window_SystemOptions - line 555
right after the refresh in the initialize add in this
@index = check_index

then at the bottom of the class add in this after the last method change_custom_variables
Ruby:
  def check_index
    @index = $game_variables[19]
    select(@index)
    $game_variables[19] = 0
  end
 
  def set_index(n)
    $game_variables[19] = n
  end

and finally in the method you made to call the scene, maybe around line 1000.
add in this before calling the config scene
@command_window.set_index(12)
change the number to where you have your command set.
This is the easy way for me to do it.
I could also do some check to find what index the :keys is in the commands and use that number for the index.

and it works
Ruby:
  #--------------------------------------------------------------------------
  # command_key_config
  #--------------------------------------------------------------------------
  def command_key_config
    n = 0
    YEA::SYSTEM::COMMANDS.each_with_index do |cmd, i|
      if cmd == :keys
        n = i
      end
    end
    @command_window.set_index(n)
    SceneManager.call(ConfScene)
  end

Original thread: https://forums.rpgmakerweb.com/threads/adding-an-extra-command-to-yanflys-system-options-with-fullscreen-add-on.159019/