On Monday we talked about Yanfly’s System Options Menu – how to install it, and how to use its basic customization features. Today, we’re going to tackle some potential issues in customizing it. First, we’re going to remove commands that we don’t want to use. Second, we’re going to look at how to use “blank” to do a little formatting. Finally, we’re going to not make it take up the “Game End” slot on our menu, but instead be its own menu.
Hiding Options from the Options Menu
This part is super easy. Let’s say, for example, that we’ve spent a ton of time on our window skin, and on our battle animations. We don’t want players to touch these, even though Yanfly gives them the option to by default. We can disable these with the addition of a single extra character – the # sign.
Find the section in the script labeled “COMMANDS” – it’s around line 106 and looks like this:
This is a list of all of the commands that will appear in your options menu. We briefly encountered it in our last tutorial when we activated “:switch_1”, our profanity filter command. But you can see all of the others here too. To disable them, simply add a # in front. The line will turn green to indicate it’s been commented out, and is no longer active. For us, we want to disable the window commands, and the animations one as well.
Easy peasy. When we launch our menu, those options will no longer be present.
Spacing Out Options
Looking at this menu, “Instant Text” and “Profanity Filter” are both about the text. It makes sense to group them. But auto-dash? It has nothing to do with the other two. Visually, I’d like to separate it from the dialogue-related group of options, and move it below the other two as well.
The COMMANDS list that we just looked at sets the order of our options. It’s as simple as moving the line
to underneath where we handle our profanity filter. Make sure you take the : and the , with you – both are important.
Spacing is also done in our COMMANDS list. You should already see some lines that read:
Those lines are creating the spaces you already see in the options list. Add one before our “autodash”, and the whole script should look like:
And, in game, our menu now looks like:
Bringing Back Game End
The next thing we want to do is not have our system menu replace game end, just serve as a different option. Heads up: if you’re doing this, you should disable “to_title” and “shutdown” in the Options Menu – you already know how to do that! (It’s the first thing we did above!)
We have three steps here. First, edit Yanfly’s script so it doesn’t takeover Game End. Second, tell the “Scene” for our menu what an options command would do. Third, tell the menu “Window” to draw a command for options.
1. Editing Yanfly’s Script
Head to the Yanfly’s System Options script we’ve been working with, and around line 251 you’ll see something labeled Vocab. It looks like:
What this section is doing is replacing whatever you call GAME END in your game with SYSTEM. We don’t want that. Delete everything from module to end – here, lines 255 to 264. All deleting this does is return the vocab to normal – if you go try your game now, you’ll notice Game End still brings up the Options Menu.
Next, head to around line 888 looking for the script that overwrites the method “command_game_end”. It looks like:
Anytime the Game End menu option is called, RPG Maker expects to open the menu that allows you to go back to the title screen, or exit entirely. What Yanfly has done is stepped in and redirected RPG Maker to his screen. Basically, anytime something asks for Game End, Yanfly interrupts it and says “take this options menu instead.”
To remedy this, change the line:
Now we’re no longer stealing Game End, but instead just using our own separate and unique command – it’s one called “opts.” We’ll be referring to it later.
We’re done in Yanfly, let’s head to…
2. Editing Scene_Menu
On the left side of your scripts list, under “Scenes” you’ll notice a file called “Scene_Menu.”
This is what creates the menu screen. Incidentally, if you don’t want to allow the player to access things like the equipment menu, here’s where to disable access.
Towards the top, you’ll see a function called “create_command_window” with all of the commands you see in the in-game menu. Wherever in that list you’d like your options menu to go, add:
Notice our :command_opts? That’s what we just made in Yanfly’s script. So what this is going to do is add an extra line in the menu. It’s internal name is “:opts” (don’t worry, we set the display name elsewhere), and when selected, it calls “command_opts” – the thing we already took care of in step one.
We’re done here, the last step is in…
The home stretch, just two things to do here. First, make a function that shows our Options Menu in the list. You can put this anywhere in the script outside of another function. And it reads:
def add_opts_command add_command("Options", :opts) end
The first part in quotes is what the display name is. So if you want it to be “System” or “Audio” or whatever, feel free. The second part, :opts, is our internal name for this command that we set in step two.
Finally, head to the top of the script and look for the function “make_command_list” – add the command you just created there.
That’s it! Take it for a spin, and let’s see what we have in-game:
Simply stunning. Now we have our Options Menu, but we’ve also clearly marked the exit for players desperate to quit our game (not that they ever would want to, of course!)
There’s still so much functionality to build, but we’re getting there!