(incomplete tutorial)
/*:
* @author Me
* @plugindesc This plugin outputs hello world
*
* @help
* This plugin just outputs hello world, that's it.
*/
console.log("Hello World");
Open the console in your game by pressing f8
and see the message.
You should wrap your plugin in a self-calling function so that no other plugins can access the contents of your plugin and you can't overwrite their content. If you want something that is accessible from outside of a plugin, put it outside of the function.
(function() {
// your code goes here
console.log("hello world");
})();
To make sure other plugins can check if your plugin is imported (maybe they depend on your plugin), add the following to your plugin (outside of any functions):
var Imported = Imported || {};
Imported.Author_PluginName = true;
// You can use this object to namespace your plugin functions if they are accessible to other plugins
// Replace Author with your username
var Author = Author || {};
var Author.PluginName = Author.PluginName || {};
Author.PluginName.version = 1.30;
// Function
Author.PluginName.greet = function(name) {
console.log(`Hello ${name}`);
};
// Class definition
Author.PluginName.Greeter = class {
constructor(name) { this.name = name; }
greet() {
console.log(`Hello ${this.name}`);
}
};
// A class instance.
// Best practice: add a $ before the name (like RPG Maker does in its source code)
Author.PluginName.$standardGreeter = new Author.PluginName.Greeter("World");
let update = Window_Base.prototype.update;
Window_Base.prototype.update = function() {
update.call(this);
// Your code that will be called every frame
}
let onMapLoad = Scene_Map.prototype.onMapLoaded;
Scene_Map.prototype.onMapLoaded = function() {
onMapLoad.call(this);
// Your code that will be called when a map is loaded
// Useful for setup, like parsing event notes
}