Jump to content

Recommended Posts

!ALERT!

The first version contains parameters that will not work with RMMV v1.6.0 and beyond. Please use the second, slightly gutted version instead. Credits to Trapless for bringing this to my attention and helping to try fix it. Do NOT use the 1.6.0 version with MV 1.5.2 or below, it will throw a tantrum.

 

Yes, there is a developer console that is included in RPGMaker MV. It's a more generic, but also more powerful Javascript console with a whole load of features like the network monitor which for most people and projects, are probably going to be fairly redundant.

 

Sadly, unlike its predecessor RMVXAce, this console does not have a built-in option to be brought up on test launch. You have to manually bring it up by pressing the F8 button. Moreover, it comes in smack-bang in front of the game window and has to be manually resized by hand. This is annoying to no end....

 

...unless you have this plugin.

 

For RMMV Versions 1.5.2 and below:

 

 


//=============================================================================
// ShowConsoleOnBoot.js
//=============================================================================

/*:
* Why did they take this feature out of RMMV? This, along with the built-in
* script editor where you could see all the default scripts was one of the
* most dev-friendly features they had for scripters. Now you have to press
* F8 to manually bring it up.

* @plugindesc Shows the developer console on boot.
*
* @param Console Width
* @desc The width of the developer console. Default = 800.
* @default 800
*
* @param Console Height
* @desc The height of the developer console. Default = 300.
* @default 300
*
* @param Console X-Position
* @desc The x-coordinate where the console appears. Default = 0.
* @default 0
*
* @param Console Y-Position
* @desc The y-coordinate where the console appears. Default = 0.
* @default 0
*
* @param Game Window X-Offset
* @desc Sideways position from the center where the game window is shifted. Default = 150.
* @default 150
*
* @param Game Window Y-Offset
* @desc Vertical position from the center where the game window is shifted. Default = 0.
* @default 0
*
* @param Autofocus
* @desc Will bring the game window in front of the console if set to "true".
* @default true
*
* @ No other settings required.
*/

(function() {
    var substrBegin = document.currentScript.src.lastIndexOf('/');
    var substrEnd = document.currentScript.src.indexOf('.js');
    var scriptName = document.currentScript.src.substring(substrBegin+1, substrEnd);
    var parameters = PluginManager.parameters(scriptName);

    var devtool_width = Number(parameters['Console Width'] || 800);
    var devtool_height = Number(parameters['Console Height'] || 300);
    var devtool_x = Number(parameters['Console X-Position'] || 0);
    var devtool_y = Number(parameters['Console Y-Position'] || 0);
    var win_x_offset = Number(parameters['Game Window X-Offset'] || 150);
    var win_y_offset = Number(parameters['Game Window Y-Offset'] || 0);
    var autofocus = String(parameters['Autofocus']);
    
    var _Scene_Boot_new_initialize_showconsole_24102015 = Scene_Boot.prototype.initialize;    
    Scene_Boot.prototype.initialize = function() {
        _Scene_Boot_new_initialize_showconsole_24102015.call(this);
        if (Utils.isNwjs() && Utils.isOptionValid('test')) {
            require('nw.gui').Window.get().showDevTools().resizeTo(devtool_width,devtool_height);
            require('nw.gui').Window.get().showDevTools().moveTo(devtool_x,devtool_y);
            require('nw.gui').Window.get().moveBy(win_x_offset,win_y_offset);
            if (autofocus === 'true') {
                require('nw.gui').Window.get().focus();
            };
        };
    };
    
}) ();

 

 

Gutted version for MV v1.6.0+:

Spoiler

//=============================================================================
// ShowConsoleOnBootV_1_6_0.js
// @Author: Traverse, credits to Trapless for bringing attention that MV's
// v1.6.0 broke the original version and for trying to help fix it.
//=============================================================================
//
/*:
* This version "works" with RMMV V1.6.0 at the expense of being able to set
* the dimensions and position of the console via the script parameters.
* They must now be adjusted by hand, although note that v1.6.0 also saves the 
* dimensions and position of the console after adjustment.
*
* @plugindesc Shows the developer console on boot.
*
* @param Game Window X-Offset
* @desc Sideways position from the center where the game window is shifted. Default = 150.
* @default 150
*
* @param Game Window Y-Offset
* @desc Vertical position from the center where the game window is shifted. Default = 0.
* @default 0
*
* @param Autofocus
* @desc Will bring the game window in front of the console if set to "true".
* @default true
*
* @ No other settings required.
*/

(function() {
	var substrBegin = document.currentScript.src.lastIndexOf('/');
	var substrEnd = document.currentScript.src.indexOf('.js');
	var scriptName = document.currentScript.src.substring(substrBegin + 1, substrEnd);
	var parameters = PluginManager.parameters(scriptName);

	var win_x_offset = Number(parameters['Game Window X-Offset'] || 150);
	var win_y_offset = Number(parameters['Game Window Y-Offset'] || 0);
	var autofocus = String(parameters['Autofocus']);
	
	var _Scene_Boot_new_initialize_showconsole_24102015 = Scene_Boot.prototype.initialize;    
	Scene_Boot.prototype.initialize = function() {
		_Scene_Boot_new_initialize_showconsole_24102015.call(this);
		if (Utils.isNwjs() && Utils.isOptionValid('test')) {

			nw.Window.get().showDevTools('', function() {
				if (autofocus === 'true') {
					nw.Window.get().focus();
				};
			});
			nw.Window.get().moveBy(win_x_offset,win_y_offset);
			
		};
	};
	
}) ();

 

 

Stick this in a text file, rename the extension to ".js" and put it in your plugins folders. Use like any other plugin. In addition to resizing and repositioning options, there's an option for whether or not you want the console to initially appear behind the game window.

 

Obviously, once you close the initial window, you'll have to F8 and manually resize and reposition if you want it back.

 

It goes without saying that this is a developer's tool and is going to be utterly worthless to anybody who isn't planning on touching plugins. I'm not going to pretend it's particularly useful either, just there for the sake of convenience. I don't know why they took out the option from the editor - it was quite convenient in Ace.

 

I'd like to be able to say this is my first MV plugin, but sadly it's my second - my first was a plugin made to bring back the fullscreen-on-boot option which also seems to have disappeared from MV. You now have to manually press F4 to fullscreen (unless you write a plugin for it like I did). I'm not feeling very impressed with the whole thing right now. Perhaps I'm just not used to it, but I'm finding Javascript a mess of semi-colon cancer compared to Ruby.

 

EDIT - Nah, no point attaching an actual text file, won't save that much time for anybody wanting to use it. Just copy and paste and rename the extension. For obvious reasons, the forum doesn't allow upload of .js files directly.

EDIT 18/11/2015 - Updated the plugin so you can name the .js file whatever and it'll still read the parameters.

EDIT 28/02/2018 - Posted new version that works with MV version 1.6.0:

Edited by Traverse
New version of script.

Share this post


Link to post
Share on other sites

bring back the fullscreen-on-boot option which also seems to have disappeared from MV. You now have to manually press F4 to fullscreen (unless you write a plugin for it like I did).

 

got a link to that?

Share this post


Link to post
Share on other sites

No, not really. It was pretty much just a small exercise for myself to see how to make MV plugins. I'm not releasing it, it's too small - like literally one line of code apart from the other stuff needed to make it into MV plugin format.

 

If you want to force the window into full-screen, you can actually insert the line yourself into this plugin, inside Scene_Boot's initialize function:

Graphics._requestFullScreen();

You can use that in any function the game runs when it loads (as long as the Graphics module is already loaded, of course). Forces the game into fullscreen.

Share this post


Link to post
Share on other sites

pssst.. hey man, hey.. excuse me. I tried to fix this plugin to no avail. perhaps you can get this thing to work again? MV 1.6.0 updated NW.js and it broke the params.
Seems like the sole survivor is:

require('nw.gui').Window.get().showDevTools();

It would be cool to have the functionality back.  Thanks for all the good fun either way :)

 

Share this post


Link to post
Share on other sites
On 2/25/2018 at 2:50 PM, trapless said:

pssst.. hey man, hey.. excuse me. I tried to fix this plugin to no avail. perhaps you can get this thing to work again? MV 1.6.0 updated NW.js and it broke the params.
Seems like the sole survivor is:

 

Yeah, I just checked it out myself. Broke AF I'm afraid.

 

As far as I can tell the showDevTools() function no longer returns a window object and the console is either no longer treated as one or cannot be accessed from itself anymore which means it can't be altered by script. Unless I'm missing something (and feel free to alert me if I am) it seems to me that the new nwjs implementation has "deprecated" the functionality as it has with a bunch of other stuff. RIP I guess. If it really is a bug with webkit with some luck it will be fixed in a future version and then MV may get the fix.

 

If it makes you feel any better, 1.6.0 is a seemingly shitty update on the whole, if you look at the official forums there are people screaming about tileset crashes and animation lag and there's was even an interim patch released by Japan to address some of the problems so this is probably one of the smaller things to come of it.

 

EDIT: Yeah, on further investigation it seems like this is a known bug with the latest version of NWjs (see the last post on showDevTools). And evidently has been there for a while, at least as far back as the version MV 1.6 is using. There's a supposed workaround that involves editing the package.json manifest (which I have attempted but still can't get working) but otherwise the devtools window simply isn't accessible from javascript/console anymore.

Edited by Traverse

Share this post


Link to post
Share on other sites

It seems that 1.6.0 is a bit of a problem if you dont start a new project. Most things for a new project seem to be improved to me. Being able to use es6 is a huge plus for me. Granted... tying it in with some of the existing code is troublesome in certain situations though I have created solutions for those finds this far.

 

github/pixijs/pixi-tilemap.readme says:

"Canvas fallback is 5x slower than vanilla rpgmaker. Webgl version is faster and doesnt use extra textures. "

-source-

 

This plugin ranked "instant classic" for me. I'm going to spend at least a few hours in fixing it tonight... or less if it doesn't take that long(fingers crossed?). I'll let you know if i figure anything out.

 

Time!

Edited by trapless
more info

Share this post


Link to post
Share on other sites

Thanks for trying to help anyway, I put up a new version stripped of the console resizing/repositioning features that works with v1.6.0. The focusing and game window offset still work. I didn't include that suggested feature you had to allow setting the position of the game window directly, because I figured there are a ton of other scripts that have that same feature (*cough* Yanfly *cough*) and it probably wouldn't play too nice with those, one or the other would overwrite it. Feel free to use your own customization if you need though.

 

The old version still works with v1.5.2 and below. That v1.5.2 patch just came out in English and uses the old version of nwjs, I checked.

Edited by Traverse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×