Scripts In Javascript

So if you are a web developer or have done any web development in the last few years or have any experience programming in javascript you will know that there is a lot of really cool things happening. One of them is https://babeljs.io/

This will allow you to to import other scripts into your scripts, write ES6 code and use third party libraries and if you use react it will compile your JSX code down to javascript.

According to my research I did last night, when yanfly launches a console, we get a chrome console. This means that the game (be it on mac or windows) is wrapped in a chromium based environment. What does that mean?

Just because they (the people who wrote this engine) wrote it using ES5 code and wrote it using http://stackoverflow.com/questions/592396/what-is-the-purpose-of-a-self-executing-function-in-javascript (self executing javascript) Doesn't mean you cant write more ... advanced javascript. Which I intend to do.

This leads me to my question. In the past if you write RGSS code, you might release 2 or three scripts all at once some hundreds of lines long. With babel and other technologies like gulp you can write a whole library, many file long and concatenate it all and then minify it all and it will still run.

Minified code is impossible to read and modify, is the community allowing this? I am not against it, I am all for it. Not because you cant change it but because it allows you to add third party libraries, write more modular and testable as well as "clean" code.

For my purposes I would release scripts as a link to github or some other repository based place where you can download the whole component I release for RPG Maker that contains, as some will be familar with - a dist folder containing the minified and non minified version.

The introduction of Javascript really allows you to create some super complicated and super amazing things that you couldn't do before - I just want to know before I write the "next big thing" how the community expects there scripts?

If I provide a minified version you could still edit variables via the in system variable editor thing I saw in yanflys video, and if you really know javascript you could even get the un minified version, make changes and commit them back as a contribution.

With RGSS we pasted out giant ass scripts here, with javascript we can do 500x more. What rules if any is the community going to impose in terms of how you write code, how you deliver code and how you share code?

Or do we care?

Personally you better "use strict" in your code or I wont trust you 😛
I fail to see any reason to minify a script.
So you wouldnt mind a couple thousand lines of code thats all be concatenated together that includes not only your own code but also code from the community? More geared towards the web but .... Because this new maker does use a version of chrome behind the scenes: http://engineeredweb.com/blog/why-minify-javascript/ Minifying the JS will load the game "faster".
So you wouldnt mind a couple thousand lines of code thats all be concatenated together that includes not only your own code but also code from the community? More geared towards the web but .... Because this new maker does use a version of chrome behind the scenes: http://engineeredweb.com/blog/why-minify-javascript/ Minifying the JS will load the game "faster".
The script should be minified by RPG Maker when you "publish" it.

While on development, I want everything as readable as possible.
According to my research I did last night, when yanfly launches a console, we get a chrome console. This means that the game (be it on mac or windows) is wrapped in a chromium based environment. What does that mean?

Just because they (the people who wrote this engine) wrote it using ES5 code and wrote it using http://stackoverflow.com/questions/592396/what-is-the-purpose-of-a-self-executing-function-in-javascript (self executing javascript) Doesn't mean you cant write more ... advanced javascript. Which I intend to do.
According to the demo's code, it references NW.js. This is an extension to Node.js. Therefore, RPG Maker MV likely runs using Node.js rather than the chromium engine. Node.js is cross-platform, further supporting this argument. Support for ES6 content would then be up to Node.js, or whatever platform is used, not the MV developers. For HTML5 exports, the ES6 support would be up to the web browser.

This leads me to my question. In the past if you write RGSS code, you might release 2 or three scripts all at once some hundreds of lines long. With babel and other technologies like gulp you can write a whole library, many file long and concatenate it all and then minify it all and it will still run.

Minified code is impossible to read and modify, is the community allowing this? I am not against it, I am all for it. Not because you cant change it but because it allows you to add third party libraries, write more modular and testable as well as "clean" code.
Minified code is not impossible to read. It is just annoying, and takes significantly longer time depending on how well it is minified. Development versions of plugins should always be unminified, commented, and readable. Once you deploy your project, minify everything so that it loads faster due to a smaller size, as well as sn't easily readable/changeable by someone in the web browser's dev console.

If I provide a minified version you could still edit variables via the in system variable editor thing I saw in yanflys video, and if you really know javascript you could even get the un minified version, make changes and commit them back as a contribution.
Based on the comments in Yanfly's core engine from the demo project on the pre-order page, the Plugin Manager will read the comment of a plugin to determine what the arguments are, what their default values are, the decription for arguments, and even the description/help for the plugin itself. Therefore, the code shouldn't be minified until the project is being deployed, as removing these comments may break the plugin manager.

With RGSS we pasted out giant ass scripts here, with javascript we can do 500x more. What rules if any is the community going to impose in terms of how you write code, how you deliver code and how you share code?
I'd suggest you use something better than just pasting scripts here, on pastebin, or dropbox. Perhaps a Github repository will be a good source for people to get and host their scripts. Git being a version control system, there should be few issues with it.
Obviously we should start moving towards something like Github. Pasting scripts here is not a good idea any more. Personally it makes it harder to find. Chromium is also cross platform, but as we get specific file formats for IOS and Android that wouldn't be an issue. Regardless of it being NW.js or Chromium you could still use ES6 with the appropriate modules. Again this would have to wait till the 23rd to be tested in its entirety but it cant be completely not feasible.

Support for ES6 is up to the developers, its called babel for now until browsers actually support es6, babel compiles es6 into es5 among a various other things.
So that's what it means 🙂


No, any scripts/plugins I add to my project, I want to be able to read and change. What if your plugin is incompatible with someone else's, and you've both done this? Where do I stand on being able to use them both? I can't, because I can't modify either. I would need to rely on one of you to adapt your script to be compatible with the other. So you would be inviting more custom modification requests, and nobody has the time to fill every request that comes through.
So that's what it means 🙂

No, any scripts/plugins I add to my project, I want to be able to read and change. What if your plugin is incompatible with someone else's, and you've both done this? Where do I stand on being able to use them both? I can't, because I can't modify either. I would need to rely on one of you to adapt your script to be compatible with the other. So you would be inviting more custom modification requests, and nobody has the time to fill every request that comes through.

This is wrong. If we move away from this posting of 500+ line "Scripts" and start taking our stuff seriously you will see a more improved quality of software. For example because I know we have a DOM, that means there are elements I can create and elements I can target with third party libraries like React JS, Back Bone JS, Jquery (if I am that stupid) and so on and so forth. I can Write ES6 Code. I can have more modular "Software" to give back to the community.

Now. How does this affect you making changes? It doesn't, learn Git, Learn Version control. I will gladly paste the 5-6 thousand line code thats concatenated here for the community. But that code will include third part libraries and unless you really know what your doing its going to be a nightmare going through.

Now you might be thinking, this isn't Software Adam (thats my name), this is scripting. And you are right. This is ....to some people. To me I am building ontop of a platform and my code stands to higher quality then most.

So what I would do for you Shaz, is I would post the 5 ... .6k line script that includes third party libraries. I would also say heres a link to the github repo, heres the documentation, also heres the minified version for easy copy/paste.

I want people to be able to change my stuff, thats why we are a community, but this isnt RGSS any more ... we can treat it like that and thats great. But to me .... to me this is a chance to show the community that there is more then 500+ line scripts. there can be modularized, properly written (and in some cases tested) code that takes in to account advanced features and third party libraries.

My point isn't to stop you from editing, I want you to. I want you to find my bugs and my faults and my weaknesses. My point is to say: Heres the minified version, wanna make changes - heres the github repo. Fork it, make your changes, do what you want. MIT license for the win.

We dont have to write crappy plugins guys, we can write some amazing stuff. And I look forward to that 😀

Also Shaz: So that's what it means Any thing I can clear up for you? I might have dropped a lot of things here and topics, I want to teach as well as give back and build things so any questions feel free man
Honestly, it's a bit much for me. I guess if you're coming at it from the wanting to use 3rd party stuff perspective, it makes sense to reduce it. It'd have to be something pretty special that I'd want really badly for me to consider doing that though.


My view of "we're a community" is that we help each other out, get ideas from each other, etc. Not that I open up all my scripts for anyone and everyone to modify as they see fit. If they want to do that in their own project, go for it. But I might not want everyone else's additions in MY project. Though I'm also happy for feedback and suggestions and bug notifications, so I can improve. Doesn't mean my plugins are "crappy" just because I don't let everyone else make changes to them 😉


So I guess we have slightly different goals here, and understanding that makes your suggestion a bit more understandable too.


I don't know that we would, or could, ever get entire community agreement on something though. It's always been a case that scripters will do things their own way, and while that's not necessarily a reason to avoid changing the status quo, if we tried to get people to do something they're not entirely comfortable with, it might result in fewer scripters making themselves available.
Thats Why I am fine with people posting there scripts as whole entities, I was just saying that for what I want to do I plan to paste the minified version with a link to the actual development version should you need to make a change and or have the skills to understand how. Not saying that every one will or wont. I have faith in you guys as scripters 😀
Thats Why I am fine with people posting there scripts as whole entities, I was just saying that for what I want to do I plan to paste the minified version with a link to the actual development version should you need to make a change and or have the skills to understand how. Not saying that every one will or wont. I have faith in you guys as scripters 😀
Well, if you post both versions, I don't see any problem with it. I will just pick the non minified version.
Well, if you post both versions, I don't see any problem with it. I will just pick the non minified version.

The non minified version would be on github. I mean id link to the dist folder so You can grab everything in one fell swoop but I wouldn't post that may lines here 😛 I have grand plans for pushing this system 😀D But I am glad you wouldn't have an issue. And again, all change is welcome 😀 Thats what community is for right?
According to my research I did last night, when yanfly launches a console, we get a chrome console. This means that the game (be it on mac or windows) is wrapped in a chromium based environment. What does that mean?
Where is this coming from?
Where is this coming from?
Probably one of the videos, as I saw that somewhere too.
Could that just mean Yanfly's default browser is Chrome?
Could that just mean Yanfly's default browser is Chrome?
Unlikely.
Probably one of the videos, as I saw that somewhere too.

Yes there was a chrome based console, weather thats from NW.js or Chromium  - it doesn't matter.

Could that just mean Yanfly's default browser is Chrome?

Unlikely.

No. Common technologies like Electron  will use some kind of chrome based system. So weather thats a chromium shell or NW.js it doesn't really matter. Javascript (as far as I know) cannot run as an executable all on its own with out some kind of engine behind the scenes. Be that something like Node that opens a "headless browser" or something like chromium where the whole application is run in an "instance of a chrome like enviroment".

The benefit to this is that even if you only support ES5 and "self executing Javscript programming styles" you still have access to other libraries like the ones I have mentioned. This also gives you access to writing more uniform code, soemthing like:

var ClassName = { functionName: function(param) { console.log('hello ' + param) }}module.exports = ClassName;// Else where:var ClassName require('./class_name.js');ClassName.functionName('world');// If I did everything above correctly://=> hello worldThe above is a bit more secure then the self executing javascript I linked to earlier. The above also allows you to write more modular, cleaner and testable code. The above example shows how you might write a module and export it then require it else where for reuse.

This is a very common practice in Javascript and is why things like Babel, gulp, npm, and so on exist.

You will learn very quickly, with a bit of research, that javascript isn't the scripting language we all think but a very powerful tool if used correctly.

Original thread: https://forums.rpgmakerweb.com/threads/scripts-in-javascript.45722/