Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Using External IDE as a Script Editor

Using External IDE as a Script Editor
Author: ForeverZer0


As many of you may know, the script editor is very basic and does not have a lot of rich features like other IDEs.  While it is not difficult to write a script in another program like Notepad++, Eclipse, Netbeans, Visual Studio, etc., it is a major pain to constantly copy-paste the script into the editor every time you want to playtest or debug the script.  Having to do so dramatically slows down development, and usually stops most from even bothering with it.  The point of this tutorial is to show you how you can do it and still have the best of both worlds.  The ability to use an external IDE, and still be able to simple click a button to start testing it.

Setting up Notepad++

For this tutorial, I will be using a Notepad++ as our IDE of choice, although the same concept can be applied to nearly all IDEs.  Notepad++ is probably the best overall compromise of power and overhead.  It integrates smoothly into Windows and supports syntax of nearly every language you will find yourself using.  There are a ton of features in Notepad++, but for the point of this tutorial I will be simply explaining how to set it up as a RMXP script editor.

Alright, so first thing first. You will need to install Notepad++. Once you have it installed, go ahead and open it.  There are many useful tweaks that you can make to improve and customize how you want the IDE to behave and allow you to be the most productive, and even setting themes and altering the colors used for different syntaxes.  Go ahead and play around and tweak the settings to try different things out.  Once your done, go to the menu bar and click the "Plugins" option, scroll down to "Plugin Mangager", then select "Show Plugin Manager"

nppTut1.png

From here you will be presented with a screen listing many various plugins available for download, which you can explore later, but for now we are looking for "NppExec", so scroll down a bit under the "Available" tab and find it.  Once found, check it and click the "Install" button.

nppTut2.png

Once it has installed and Notepad++ has restarted, you are very close to completion of this portion of the process. Now select the "Plugins" tab again, and you will "NppExec" listed there now, so select it.  There are some various options available, I would suggest checking the "Save all files on execute" option to make things easier on yourself.

nppTut3.png

After that, select the top option, or simply press F6 from the main screen to bring up the execution dialog.  Here we need to make a command to execute our RMXP game.  It should follow this pattern:
Code:
cmd.exe /c " <FULL PATH TO PROJECT'S GAME.EXE> "
You can label it however you want to keep track of multiple projects you may be working on.

nppTut4.png

Press "OK" to test it out and you should see your game start up.  From this point on you can simply click "Ctrl + F6" to quickly execute the last command from the editor without the need to navigate to this menu.  This is the conclusion of this part of the tutorial, now we just need to make a tweak to our RMXP project to have it read the scripts externally.  

Setting up RPG Maker

Make a new folder in the directory of your game, and name it "MyScripts" or whatever you want. In this folder, you can save all the custom scripts your project uses, just save them all with an .rb extension to denote that they are Ruby scripts.  This can be done multiple ways, just copy-paste the script into Notepad++, select "Save As..." and select "Ruby FIle", and set the directory to this folder.

nppTut5.png

Once done, we need only add a few lines of code to our project.  Either in "Main" before the "begin", or in a separate slot just above it, add these few lines of code:

[rgss]DIRECTORY = ''
SCRIPTS = [  ]
SCRIPTS.each {|script| require "#{Dir.getwd}/#{DIRECTORY}/#{script}" }
[/rgss]

The DIRECTORY value should be the name of the folder you made earlier to contain your scripts, and the SCRIPTS array contains the names of all the scripts to load from that file.  Remove the scripts from the editor and place their filenames into the list in the order that they would be in the script editor.  Here's an example of one filled out for Chronicles of Sir-Lag-a-Lot:

nppTut6.png

And as you can see, we can now open all the scripts in the Notepad++ editor like this:

nppTut7.png

This is basically a little "bootstrap" script.  Alternatively you could create a separate Ruby document to this and simply "require" it.  You can now do any scripting you want to these scripts in the Notepad++.  When you press F6 to run the game, these scripts will be read and used for your game.

  • Install Notepad++
  • Install NppExec plugin for Notepad++
  • Set command to execute game
  • Create script folder, and export scripts to .rb documents into it
  • Add code snippet to game
  • Run from Notepad++

Also remember that the DEBUG variable will not be defined using this method.  You can fix this yourself by simply adding the line:
[rgss]$DEBUG = true  # RMXP
$TEST = true  # RMVX
[/rgss]
In a script somewhere.
I hope this tutorial was helpful. If there are any questions or you need additional help, feel free to ask.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top