Site News
• Basic Tutorials •
The Database
Graphic Resources
• More Advanced Tutorials •
The Database
Event Systems
• RGSS •
Script Fixes
Script Systems
• Other •
Using RMXP
Mini Tutorials
• Reference •

In this tutorial you will learn...

• How to change the default font of your game
• How to resize the message box to fit

Hello again, and welcome to the first of my Script Fix tutorials! This tutorial was originally going to be just another mini tutorial, but I decided that there were enough topics to create a whole new category of tutorials. In these tutorials, I will be teaching you how to fix things about your game that can only be done by changing some script. Now, I am not really a scripter (as of yet) so I will be keeping these tutorials fairly simple - but they're under the advanced category because I will lead on to more challenging examples. So, ready to get started? Let's go!

So, you're really fed up with the default Arial font for your game - but how do you change it? This tutorial will tell you how - and also how to resize and place the message box to where you want it. Okay? Let's get going!

Now, in this tutorial, we're going to be delving into the realms of the Script Editor - but don't worry; as long as you make sure that you don't change anything that you don't mean to, nothing should go wrong. So, firstly, open your game and open the Script Editor by clicking the Script Editor icon or pressing F11 on your keyboard. You'll get this...

Now, this may look a little daunting if you've never seen it before, but don't be too scared by it! This is where all the processing, calculating and sorting out for the running of your game goes on. We're not going to be changing much in this tutorial, but later on you might need to change other things. So, on the left-hand side, scroll down to the bottom of the script list and find the script entitled Main, right at the bottom. This script will look like this...

This is where the actions are defined for when you press F12, or Playtest. Here is where we're going to add the little snippet of code to change the font. Okay. After the word 'begin,' add in the following (you can copy this if you like, and then change it.)...

# Default font face
Font.default_name = "Sylfaen"
# Default font size
Font.default_size = 22

Now, obviously, you can change the font name from Sylfaen to whatever you want: Trebuchet MS, Arial, or even Times New Roman (if you really wanted to...) etc. - however, you need to make sure that the font name is spelt exactly as the font name is on the system, with the same capital letters, spacing and everything in the right case and place. The font size isn't sized the same as on Word, for example, so you'll have to experiment with that a bit. Here's a screen shot of my game before the font change, and then after (I think the default font size is 22).

Before the font change...

...And after. Look's much better than ordinary old Arial, doesn't it? So, now we can change the font of the game, I'll teach you something else useful that you can do: changing the size and position of the message box.

To do this, head back into the script editor, and in the script list, find the script called Window_Message. When you click on it, you will get this screen...

Now, we're not going to be changing much here - in fact, the most we will change is four values. You see where the script says 'super(80, 304, 480, 160)'? The numbers inside the brackets are the ones we will change. These four figures stand for these properties: x, y, width, height: the x-position of the object (left-to-right), the y-position of the object (up-to-down), the width of the object, and the height of the object. Now, I feel that my message box is a bit too wide and a bit too tall, so I'm going to decrease the width and the height of my message box. I'm going to change 480 to 400, and 160 to 140. See a screenshot...

See what I've changed? Now, let's take a look in-game to see the changes.

You see how the width and the height have decreased? Have a play with these values and see what they do. Also, you can see that now I have changed the size of my window, the position of it is a bit skew-whiff. Try experimenting and changing the first two values in the script to change the position. With y-values, the greater the number, the higher up the screen the object will be. With x-values, the greater the number, the more to the right-hand side of the screen the object will be.

Have an experiment and see what you can change. If you completely mess up, begin a new project and copy the values from the script in that project to another. I hope you've enjoyed your first taste of scripting - there's more to come! My next script fixes tutorial will be on changing characters and annoying little typos on the equip and shop screens.

:: Home ::      :: Next Tutorial >> ::

RPG Maker XP © 2005 Enterbrain Inc.           © 2004 Xiph. Org Foundation           Ruby © 1993 - 2003 Yukihiro Matsumoto
This site, including images and textual content, were created by and belong to me.
© 2006 - 2011 All rights reserved.

This website and tutorials have all been written in my free time (what there is of it!), and hosting can be rather costly, so any donations are very gratefully received - no matter how small - even if you can spare 50p I would be grateful!