- Joined
- Mar 14, 2013
- Messages
- 43
- Reaction score
- 10
- First Language
- English
- Primarily Uses
Introduction and Outline:
---------------------------------
This tutorial assumes you have a basic understanding of scripting, and that you have created at least a couple of your own scripts. If you are looking to learn the basics, I would recommend DP3's video series collection. Today we're going to examine the Ruby coding environment we all know and use. We're going to memorize some handy shortcuts and we're also going to compare multiple environments, the upsides and downsides of using one over the other.
RPG Maker VX Ace Environment:
---------------------------------
Lets begin by taking a quick look at the Included coding environment within RPG Maker VX ACE. Referred to in VX ACE as the "Script Editor" This is actually our coding environment, the place where we add and modify ruby code. There are other names and interpretations of this kind of environment, and the Ruby scripting within VX ACE is somewhat limiting in how it hides some core things from you (which is for your own good really unless you've been doing this for a long time) but for the sake of this tutorial, we will refer to this as our coding environment. So, here is the provided 'coding environment' that comes with VX ACE:
At a glance it looks good, but you may notice the window is not re-sizable. This was one of the things that bothered me early on, the fact that Despite the fact I had a 1080p monitor, I had to use this small window to script in. Its workable, I'll grant you that. Lets quickly go over some handy shortcuts that you will find yourself using in the VX ACE coding environment, 'currently active script' refers to whatever script is currently selected and is being edited:
So lets talk limitations. You are editing in a small window. You have 81 visible characters on each line in that script window. I don't know about you but that seems inefficient to me. I'll grant you that the environment handles long lines just fine, but it can really make things feel clunky in my opinion when you only have 81 visible characters. Really if they would just make this window resizable and provide a dark theme for it, I would use it and never use a different environment. But that is not the reality that we have right now, maybe in a future version of RPG Maker. In the mean time, we can make do by utilizing other environments to our advantage.
We're going to take a look at two other options. Sublime Text 2 and Notepad++. Both of these editors provide support for the ruby syntax and full style preferences (colorization, theme etc) for the ruby syntax. Both of these editors also have their own upsides and drawbacks. We're going to take a look at these environments now. I want you to know that if you click the above image of the VX ACE environment, you'll get a full resolution visual of how big the VX ACE environment is. Click on these ones too and you'll also get that full resolution visual of just how big the environment is. I think you'll find the difference is like night and day.
Also it should be noted, my Desktop is 2688x1080 (I have a 15 inch monitor flipped vertically on the left side for 768x1024, and a 22 inch 1920x1080 monitor on the right). Both Notepad++ and Sublime text provide support for rocking multiple instances by simple drag-and-drop.
The Notepad++ Environment:
The Sublime Text 2 Environment:
Notepad++ Overview:
------------------------------------------------
Notepad++ comes with the ability to multi-instance. It can also load a 2nd tab for viewing of documents on the fly, with drag-and-drop functionality. Allow me to explain this. So in the notepad++ screenshot, on the right side you see a notepad++ window open that has two tabs, one on the left one on the right. Each one can hold a nest of open text documents (in this case ruby *.rb scripts).
The easiest way to take advantage of this is to:
Notepad++ does require some additional setup for comfortable use with ruby, this is basically the main drawback for Notepad++. Want a dark style like mine so you can code at 4am without burning your eyes on a white background? You'll have to mess around in the style configurator found within the Settings menu. If you're modifying an included theme, Run Notepad++ with admin privileges and modify the theme to your liking, then save and exit notepad and re-open it with normal user privileges. You're also going to want to modify some of notepad++'s default preferences, mainly you're going to want to make tabs 2 spaces instead of the default 4 so your scripts will have the standard ruby/vx ace indenting.
Sublime Text 2 Overview:
----------------------------------------------
Sublime comes with the ability to multi-instance with drag-and-drop functionality, a title bar for opening of multiple scripts like Notepad++. Simply drag an open text document from the title bar outside the Sublime window and it will open that document in a new instance of the editor. The main drawback for Sublime compared to notepad is the lack of an ability to have multiple views of documents open at once like Notepad++ can (see the right side of the notepad++ screenshot). Sublime makes up for this ability with some cool things.
Unlike Notepad++, sublime wont require you to set default tabbing to two spaces. It already handles that because it knows you're writing in Ruby. Unlike Notepad++ Sublime was programmed with the sole intention of being a convenient portable coding environment for a wide variety of languages. It also comes with something really cool that I must say, after using it a little bit really is a huge thing that helps me move around my scripts quicker. It has a virtual scroll bar. Look at the Sublime screenshots, and on the right side of each open instance of Sublime you'll see a small vertical visual scroll bar. You can clearly see the document in there. This thing reacts just like a scroll bar so you can grab the selected area and pull up and down. It really is a thing of beauty and does add a helpful feature (in my opinion) that the Notepad++ environment is lacking.
One downside to mention for Sublime is unlike notepad, it is not free. However, you can download the free version, and you do not get penalized for using it.
Chapter 2: Learn the ropes... Again!
----------------------------------------------
All environments outlined in this tutorial have their own upsides and downsides. Which environment you choose to use as a scripter really comes down to your personal preference and experience. I am currently using the Sublime environment, I previously worked a lot in the Notepad++ environment, and was stuck with the VX ACE environment beforehand. Depending on what you want or don't want in your environment, you might think Notepad++ is better, or Sublime. It really comes down to what you want.
Lets assume now that you've made the decision. You're going to use either Notepad++ or Sublime. You've made the choice to use a more efficient coding environment. Maybe something I said here convinced you, maybe something you said to yourself after reading something I said convinced you. Regardless, here is my setup guide for getting your started in your new environment. This will work with either Notepad++ or Sublime.
Remember those hotkeys you burned in your mind earlier? The ones that the VX ACE coding environment uses? Now you're going to see why I told you to memorize those. If you didn't already, scroll up and burn them into your mind. Now that you got those burned into your head, here are some additional hotkeys to burn into your mind, for use with Sublime or Notepad++:
Importing Code to VX ACE:
--------------------------------------
So, now you've made some cool script in your new scripting environment. Cool. Whats the fastest way to get it in your game? You might think its hard, but its really not. Remember those hotkeys you were supposed to burn in your mind earlier? Well this combination utilizes them. If you have a macro keyboard, you could setup a couple macros that manage this process. So anyway, this is how I import any script from my coding environment into VX ACE:
Thats all for this tutorial folks! Thanks for reading, happy scripting!
Tips & General Advice:
-----------------------------
This section will contain a bullet point list of general tips and advice for Notepad++ or Sublime Text 2 or VX ACE's built in coding environment. Things will be added here as people suggest tips or general advice that is suitable here, or as I think of things to add.
ADDENDUM: Did I miss something that you think should be in here? Did you find a mistake? Did you see my missing 6 pack of beer? Please let me know! Thanks!
---------------------------------
This tutorial assumes you have a basic understanding of scripting, and that you have created at least a couple of your own scripts. If you are looking to learn the basics, I would recommend DP3's video series collection. Today we're going to examine the Ruby coding environment we all know and use. We're going to memorize some handy shortcuts and we're also going to compare multiple environments, the upsides and downsides of using one over the other.
RPG Maker VX Ace Environment:
---------------------------------
Lets begin by taking a quick look at the Included coding environment within RPG Maker VX ACE. Referred to in VX ACE as the "Script Editor" This is actually our coding environment, the place where we add and modify ruby code. There are other names and interpretations of this kind of environment, and the Ruby scripting within VX ACE is somewhat limiting in how it hides some core things from you (which is for your own good really unless you've been doing this for a long time) but for the sake of this tutorial, we will refer to this as our coding environment. So, here is the provided 'coding environment' that comes with VX ACE:
At a glance it looks good, but you may notice the window is not re-sizable. This was one of the things that bothered me early on, the fact that Despite the fact I had a 1080p monitor, I had to use this small window to script in. Its workable, I'll grant you that. Lets quickly go over some handy shortcuts that you will find yourself using in the VX ACE coding environment, 'currently active script' refers to whatever script is currently selected and is being edited:
- CTRL+A = Select all (select every line of the currently active script)
- CTRL+C = Copy (copy selection)
- CTRL+V = Paste (paste selection)
- CTRL+F = Find... (find text within currently active script)
- CTRL+SHIFT+F = Find in all sections... (find text within all scripts. returns a list of results from all scripts)
- CTRL+Q = Comment or Uncomment (disable) the selected lines of code
- CTRL+D = Duplicate selection (appears and end of current line)
So lets talk limitations. You are editing in a small window. You have 81 visible characters on each line in that script window. I don't know about you but that seems inefficient to me. I'll grant you that the environment handles long lines just fine, but it can really make things feel clunky in my opinion when you only have 81 visible characters. Really if they would just make this window resizable and provide a dark theme for it, I would use it and never use a different environment. But that is not the reality that we have right now, maybe in a future version of RPG Maker. In the mean time, we can make do by utilizing other environments to our advantage.
We're going to take a look at two other options. Sublime Text 2 and Notepad++. Both of these editors provide support for the ruby syntax and full style preferences (colorization, theme etc) for the ruby syntax. Both of these editors also have their own upsides and drawbacks. We're going to take a look at these environments now. I want you to know that if you click the above image of the VX ACE environment, you'll get a full resolution visual of how big the VX ACE environment is. Click on these ones too and you'll also get that full resolution visual of just how big the environment is. I think you'll find the difference is like night and day.
Also it should be noted, my Desktop is 2688x1080 (I have a 15 inch monitor flipped vertically on the left side for 768x1024, and a 22 inch 1920x1080 monitor on the right). Both Notepad++ and Sublime text provide support for rocking multiple instances by simple drag-and-drop.
The Notepad++ Environment:
The Sublime Text 2 Environment:
Notepad++ Overview:
------------------------------------------------
Notepad++ comes with the ability to multi-instance. It can also load a 2nd tab for viewing of documents on the fly, with drag-and-drop functionality. Allow me to explain this. So in the notepad++ screenshot, on the right side you see a notepad++ window open that has two tabs, one on the left one on the right. Each one can hold a nest of open text documents (in this case ruby *.rb scripts).
The easiest way to take advantage of this is to:
- open a bunch of scripts in notepad++
- left click and drag one of the scripts out of the title bar and into empty space (over top of the text editing portion of the window, but not outside the window itself)
Notepad++ does require some additional setup for comfortable use with ruby, this is basically the main drawback for Notepad++. Want a dark style like mine so you can code at 4am without burning your eyes on a white background? You'll have to mess around in the style configurator found within the Settings menu. If you're modifying an included theme, Run Notepad++ with admin privileges and modify the theme to your liking, then save and exit notepad and re-open it with normal user privileges. You're also going to want to modify some of notepad++'s default preferences, mainly you're going to want to make tabs 2 spaces instead of the default 4 so your scripts will have the standard ruby/vx ace indenting.
Sublime Text 2 Overview:
----------------------------------------------
Sublime comes with the ability to multi-instance with drag-and-drop functionality, a title bar for opening of multiple scripts like Notepad++. Simply drag an open text document from the title bar outside the Sublime window and it will open that document in a new instance of the editor. The main drawback for Sublime compared to notepad is the lack of an ability to have multiple views of documents open at once like Notepad++ can (see the right side of the notepad++ screenshot). Sublime makes up for this ability with some cool things.
Unlike Notepad++, sublime wont require you to set default tabbing to two spaces. It already handles that because it knows you're writing in Ruby. Unlike Notepad++ Sublime was programmed with the sole intention of being a convenient portable coding environment for a wide variety of languages. It also comes with something really cool that I must say, after using it a little bit really is a huge thing that helps me move around my scripts quicker. It has a virtual scroll bar. Look at the Sublime screenshots, and on the right side of each open instance of Sublime you'll see a small vertical visual scroll bar. You can clearly see the document in there. This thing reacts just like a scroll bar so you can grab the selected area and pull up and down. It really is a thing of beauty and does add a helpful feature (in my opinion) that the Notepad++ environment is lacking.
One downside to mention for Sublime is unlike notepad, it is not free. However, you can download the free version, and you do not get penalized for using it.
Chapter 2: Learn the ropes... Again!
----------------------------------------------
All environments outlined in this tutorial have their own upsides and downsides. Which environment you choose to use as a scripter really comes down to your personal preference and experience. I am currently using the Sublime environment, I previously worked a lot in the Notepad++ environment, and was stuck with the VX ACE environment beforehand. Depending on what you want or don't want in your environment, you might think Notepad++ is better, or Sublime. It really comes down to what you want.
Lets assume now that you've made the decision. You're going to use either Notepad++ or Sublime. You've made the choice to use a more efficient coding environment. Maybe something I said here convinced you, maybe something you said to yourself after reading something I said convinced you. Regardless, here is my setup guide for getting your started in your new environment. This will work with either Notepad++ or Sublime.
- Install your preferred environment (Notepad++ or Sublime).
- Navigate to your RPG Maker VX ACE game projects folder, or wherever you want to keep a folder that contains all your scripts. I prefer that location.
- Make a new folder called "#SCRIPT WORK#" or something like that.
- Drag the folder into your favorites in the left folder bar (Assuming Windows 7)
Remember those hotkeys you burned in your mind earlier? The ones that the VX ACE coding environment uses? Now you're going to see why I told you to memorize those. If you didn't already, scroll up and burn them into your mind. Now that you got those burned into your head, here are some additional hotkeys to burn into your mind, for use with Sublime or Notepad++:
- CTRL+A = Select ALL (select all data in the current open document)
- CTRL+S = Save (save open document)
- CTRL+C = Copy selected text (copy all selected text from the current open document)
Importing Code to VX ACE:
--------------------------------------
So, now you've made some cool script in your new scripting environment. Cool. Whats the fastest way to get it in your game? You might think its hard, but its really not. Remember those hotkeys you were supposed to burn in your mind earlier? Well this combination utilizes them. If you have a macro keyboard, you could setup a couple macros that manage this process. So anyway, this is how I import any script from my coding environment into VX ACE:
- Open the script I want to import in my scripting environment, and make sure its active.
- CTRL+A (select the entire script)
- CTRL+S (save the entire script)
- CTRL+C (copy the entire script)
- Mouse movement: Click to focus VX ACE's scripting window
- Select script area (old version of script in place)
- CTRL+A (select the entire OLD script)
- CTRL+V (paste the entire new script, OVERWRITING the old script)
- Click Apply, ok (unless more scripts are waiting to be imported.
Thats all for this tutorial folks! Thanks for reading, happy scripting!
Tips & General Advice:
-----------------------------
This section will contain a bullet point list of general tips and advice for Notepad++ or Sublime Text 2 or VX ACE's built in coding environment. Things will be added here as people suggest tips or general advice that is suitable here, or as I think of things to add.
- [TIP]: When making a new script, if it is going to consist of multiple scripts, make a new sub-folder for the project within your script folder, and name it something related to your new script. If you're making a new script thats just going to be 1 simple script in the end, it probably doesn't need a sub-folder. Keep your Scripts folder organized! Use relevant and easy to interpret filenames!
- [DERP]: ALWAYS SAVE as *.rb when editing in notepad++ or sublime to properly preserve your work.
ADDENDUM: Did I miss something that you think should be in here? Did you find a mistake? Did you see my missing 6 pack of beer? Please let me know! Thanks!
Last edited by a moderator:


