An Options Menu – Part III

We’re continuing our Options Menu discussion today. Last week, we learned a few things:

  • How to “install” and use Yanfly’s System Options script in our game
  • How to remove items in Yanfly’s script that we didn’t want
  • How to customize our menu’s layout, text, and order
  • How to allow our player to change variables and switches mid-game through the menu
  • How to alter the script so that it doesn’t replace “Game End” in our in-game menu, but instead appears as its own entry.

That’s already a lot! And it’s WAY better than RPG Maker’s default options. But sometimes – particularly with things like volume – we want to set a value before we enter the game. Really, we want to do it from the title screen. So today, let’s look at how we might access our options menu before we even start a new game.

A Quick Refresher: last week we explored the concepts of “Window” and “Scene” when making our options menu accessible. The Window items in your script are generally used to actually draw the line in your menu – it’s here that we’ll add the text “Options” to our title screen. The Scene items in your script will be used here to tell your menu item what to do – here, load another Scene.

Scenes do a lot of stuff in RPG Maker. There is a “Battle Scene” to handle battles, “Shop Scene” for when you interact with a merchant, etc. You can generally assume that there is one Scene for every kind of window in the game. Shopping, menu, status, saving, loading, equipping, etc. One of the things Yanfly’s script does is create another kind of scene – a “System Scene.” This is the scene for our options menu.

Build Your Command

Building the command is easy. What we need to do is go into the Title scene and say, “when a button named :options is called, open up the System scene.” To do that, first find the title scene in your script window:

In the "scripts" menu, you'll find Scene_Title just already there, waiting.

In the “scripts” menu, you’ll find Scene_Title just already there, waiting.

At around line 88, you’ll find a command called “Create Command Window.” This is what creates the little window that says New Game, Continue, and Shutdown. You can see exactly those commands with even a cursory glance.

A list of the three items in the Title Screen - "New Game" "Continue" and "Shutdown." Anytime you see this list, it's an indicator that we need to do some work here to add a fourth item.

A list of the three items in the Title Screen – “New Game” “Continue” and “Shutdown.” Anytime you see this list, it’s an indicator that we need to do some work here to add a fourth item.

So this is where we want to add our new possible choice – “Options.” Notice that we don’t have anything about Vocab, and remember that I said it’s “Window” that going to handle actually displaying our option. Here, nothing we do will affect how our new item is displayed. Instead, we’re going to give it an internal name (so we can easily refer to it), and give it a function to call if we choose it. Look at the pattern for all of the items here. It’s all the same.

@command_window.set_handler(:INTERNAL NAME, method(:WHAT TO DO WHEN CHOSEN))

So let’s do the same for ours. After “Continue”, add another line:

@command_window.set_handler(:options, method(:command_options))

Excellent. We now have a link between our name and a function – but we haven’t built that function yet! Scroll down and you’ll see other functions named things like command_new_game, and command_continue. Hey! Those are the things our other title screen choices have! We need to build a similar one for Options.

Thinking back, we want our command to open the our Options menu. Well, Continue opens a window, right? It opens the load screen, so that seems like a safe one to pattern off. Let’s add a new command called command_options. It looks like this.

def command_options

Notice it’s the exact same as command_continue, with one exception. In the third line, we changed what scene we want to open up. We don’t want the Load Screen, we want the options one. And that is called “Scene_System.”

A simple command - close the prior scene, and open our Options Menu.

A simple command – close the prior scene, and open our Options Menu.

That’s all we need to do here, but if you run your game you won’t see options in the main menu. Remember, we have to handle that through the…

Window Changes

We just looked at a Scene for the title screen. There’s also a Window. Find that in your list of scripts:

Same list, different script.

Same list, different script.

As soon as you open it up, around line 31 you’ll see a familiar list of commands. Under the function called “make_command_list” you’ll see new_game, continue, and shutdown. It’s a pretty good indicator that that is where we want to play.

Notice that the continue one looks a little different. All of the items have a display name and an internal name, but “continue” has this extra third thing that says “continue enabled.” This is an optional item if you want to gray-out or disable a menu item. We want options always be available, so we can safely ignore it. What we want then, is to add a command here with “Options” (which is our display name) and :options (which is our internal name).

add_command("Options", :options)
"Vocab" is RPG Maker's way of accessing what *you* call New Game. Since you're in control here, there's no need to use Vocab - just a string will do.

“Vocab” is RPG Maker’s way of accessing what *you* call New Game. Since you’re in control here, there’s no need to use Vocab – just a string will do.

And we’re done! Boot it up and check it out:



One thought on “An Options Menu – Part III

  1. Pingback: An Options Menu – Part V | The Iron Shoe

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s