Guest Access
Go to page : 1, 2
Administrator
Administrator

Administrator
profile
For those of you who are excited for RMMV and to all of you who play with code,
here's a sample of a javascript plugin:
If you are interested in learning some basic javascript, go here ~> CA.JS
This official tutorial video displays how to install a plugin into your project
When RMMV launches on the 23rd of this month, there will be over 40 plugins made by scripters from the RPG Maker community who had the privilege to work with the beta of RPG Maker MV.
From what I gathered, there are a lot of programmers who are disappointed with the switch from ruby to js, but I must say cross platform and speed has got me pumped for projects! This will also bring Mac and PC users into the same maker community to make games for just about every device and browser that supports HTML5 +
G@MeF@Ce
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

here's a sample of a javascript plugin:
- Code:
/*
* adjust height, width, and position of command prompt in title_scene
*/
(function () {
var parameters = PluginManager.parameters['TitleCommandPosition'];
var offsetX = Number(parameters['Offset X'] || 30);
var offsetY = Number(parameters['Offset Y'] || 30);
var width = Number(parameters['Width'] || 240);
var background = Number(parameters['Background'] || 0);
var _Window_TitleCommand_updatePlacement = Window_TitleCommand.prototype.updatePlacement
Window_TitleCommand.prototype.updatePlacement = function () {
_Window_TitleCommand_updatePlacement.call(this);
this.x = offsetX;
this.y = offsetY;
this.setBackgroundType(background);
};
Window_TitleCommand.prototype.windowWidth = function () {
return width;
};
})();
If you are interested in learning some basic javascript, go here ~> CA.JS
This official tutorial video displays how to install a plugin into your project
When RMMV launches on the 23rd of this month, there will be over 40 plugins made by scripters from the RPG Maker community who had the privilege to work with the beta of RPG Maker MV.
From what I gathered, there are a lot of programmers who are disappointed with the switch from ruby to js, but I must say cross platform and speed has got me pumped for projects! This will also bring Mac and PC users into the same maker community to make games for just about every device and browser that supports HTML5 +
Administrator
Show Signature
EVENTALIST
EVENTALIST
Administrator
Administrator

Administrator
profile
13 out of 37 plugins have been revealed
lots of questions answered
G@MeF@Ce
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

we need WABS and XPLAT for our RMMV projects <3:+:mr_wiggles wrote:Going to do some reading myself.
13 out of 37 plugins have been revealed
lots of questions answered
Administrator
Show Signature
EVENTALIST
EVENTALIST

EVENTALIST
profile
In your example plugin, what is the purpose of the "()" block at the end?
Could it be?
What purpose does that block serve? Still haven't done much reading into Java waiting on getting my hands on MV.
Been playing in the tutorial, picked java up fairly fast, took about 20 mins to get to this part in the tutorial. https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/4?curriculum_id=506324b3a7dffd00020bf661
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
})();
Could it be?
- Code:
});
What purpose does that block serve? Still haven't done much reading into Java waiting on getting my hands on MV.
Been playing in the tutorial, picked java up fairly fast, took about 20 mins to get to this part in the tutorial. https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/4?curriculum_id=506324b3a7dffd00020bf661
- Code:
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
};
console.log("Computer: " + computerChoice);
var compare = function(choice1, choice2) {
if (choice1 === choice2) {
return "The result is a tie!";
} else if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock wins";
} else {
"paper wins";
};
} else if (choice1 === "paper") {
if (choice2 === "rock") {
return "paper wins";
} else {
"scissors wins";
};
} else if (choice1 === "scissors") {
if (choice2 === "paper") {
return "scissors wins";
} else {
"rock wins";
};
};
};
console.log(compare(userChoice, computerChoice))
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST

EVENTALIST
profile
It is not very far off from ruby from what I'm seeing so far, this is going to be fun.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator

Administrator
profile
remember there's a difference between java and javascript
with javascript parenthesis are mainly used for execution/self-execution for a function or expression(similar to an argument) here a great reference on stackoverflow
http://stackoverflow.com/questions/440739/what-do-parentheses-surrounding-a-javascript-object-function-class-declaration-m
G@MeF@Ce
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

with javascript parenthesis are mainly used for execution/self-execution for a function or expression(similar to an argument) here a great reference on stackoverflow
http://stackoverflow.com/questions/440739/what-do-parentheses-surrounding-a-javascript-object-function-class-declaration-m
Administrator
Show Signature
EVENTALIST
EVENTALIST

EVENTALIST
profile
so, its basically the same as
The "()" is the call for the expression.
No?
[edited] ----------------
I read some more and it seems to help with scoping when using variables and other names.
Pulled from the page you linked, it, to me, looks like a class in a class like how modules are used in Ruby. Its like the first arguments are the "initialize" ones. So "add_gen" is function set out side call anonymous inside function. Picturing it as an array in a way as well. So would this:
So you can potentially make functions in classes, classes themselves wrapped in layers? like a hand off if you wanted to, or by accedent?
Trying to see how that would be useful, course this isn't related anymore just thinking out loud.
[/edited]
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
var example = funtion() {
console.log("executed this with assistance of a call.");
};
example();
- Code:
(function() {
console.log("executed this with out the need for a call.")
})();
The "()" is the call for the expression.
No?
[edited] ----------------
I read some more and it seems to help with scoping when using variables and other names.
- Code:
var add_gen = function(n) {
return function(x) {
return n + x;
};
};
var add2 = add_gen(2);
add2(3); // result is 5
Pulled from the page you linked, it, to me, looks like a class in a class like how modules are used in Ruby. Its like the first arguments are the "initialize" ones. So "add_gen" is function set out side call anonymous inside function. Picturing it as an array in a way as well. So would this:
- Code:
var add_break = add2(3); // result will always be 5 when variable add2 is called, and can not be called with an argument anymore.
So you can potentially make functions in classes, classes themselves wrapped in layers? like a hand off if you wanted to, or by accedent?
- Code:
var test = function(num1) {
function(num2) {
function(num3) {
return (num3 + num2 + num1);
};
};
};
var layer1 = test(1);
var layer2 = layer1(2);
var layer3 = layer2(3);
var inside_function_layer3 = layer3;
Trying to see how that would be useful, course this isn't related anymore just thinking out loud.
[/edited]
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator

Administrator
profile
yep top code you have set your variable and it's function (similar to defining a method)
and called it at the end
bottom code you basically made a self-executing function
wiggles you are getting me excited +
G@MeF@Ce
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

and called it at the end
bottom code you basically made a self-executing function
wiggles you are getting me excited +
Administrator
Show Signature
EVENTALIST
EVENTALIST

EVENTALIST
profile
I'm excited to start programming some stuff.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile


EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST

EVENTALIST
profile
I was playing around with it today, been crash coursing threw Java script. Here is what i have thrown together so far, just getting use to the new syntax.
NOTE: I wasn't able to get around to adding in the exit function, its there but its never called in the script so there is no way out of the scene when called. Just wanted to share what i got done today.
Still learning, I'll work on finishing up a nice sample script for creating plugins in the end though, especially when I have a helpful community like this one.
mr_wiggles
![]() | ![]() | |
![]() | ||
![]() | ![]() |

profile

- Code:
//=============================================================================
// Sample.js
//=============================================================================
/* Author: Mr_Wiggles
* Date: 10/23/15
* Version: 0.0
* ----------------------------------------------------------------------------
* Object.create java information.
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
*/ //=========================================================================
//----------------------------------------------------------------------------
// Auto run: Sets plugin items that are user defined in RMMV.
//----------------------------------------------------------------------------
(function() {
var parameters = PluginManager.parameters('Sample'); // Define plugin name.
// Set interactive variable settings to show in plugin manager.
var sampleSetting = String(parameters['Sample Setting'] || 'Defualt value');
//------------------------------------------
// Define plugin commands that are called from event task.
//------------------------------------------
var _Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
// add in custom flags for your plugin.
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'eventSamplePluginCommand') {
switch (args[0]) {
case 'commandOne':
// For an example, calling the scene is something that can be done here.
SceneManager.goto(Scene_Sample);
break;
}
}
};
//----------------------------------------------------------------------------
// Scene Sample
//----------------------------------------------------------------------------
function Scene_Sample() { // Set function call initialize before object is created.
this.initialize.apply(this, arguments);
}
// Inherit parrent class functions.
Scene_Sample.prototype = Object.create(Scene_Base.prototype);
Scene_Sample.prototype.constructor = Scene_Sample;
//------------------------------------------
// Define funtion initialize for Scene_Sample.
//------------------------------------------
Scene_Sample.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this); // *super()
// create variables before class object creation.
};
//------------------------------------------
// This is java's object "initialize" and is ran when
// the object is registered with the GC.
//------------------------------------------
Scene_Sample.prototype.create = function() {
Scene_Base.prototype.create.call(this); // *super()
// create variables after initialize.
};
//------------------------------------------
// Example on returning scene to game map.
//------------------------------------------
Scene_Sample.prototype.returnToMap = function() {
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};
//----------------------------------------------------------------------------
// Window Sample
//----------------------------------------------------------------------------
function Window_Sample() { // Set function call initialize before object is created.
this.initialize.apply(this, arguments);
}
// Inherit parrent class functions.
Window_Sample.prototype = Object.create(Window_Base.prototype);
Window_Sample.prototype.constructor = Window_Sample;
//------------------------------------------
// (initialize) for Window_Sample.
// Args*
// (x) = X window pos.
// (y) = Y window pos.
//------------------------------------------
Window_Sample.prototype.initialize = function(x, y) {
var width = 32;
var height = 32;
Window_Base.prototype.initialize.call(this, x, y, width, height); // *super()
this.refresh(); // refresh window contients.
};
//------------------------------------------
// (update) for Window_Sample.
//------------------------------------------
Window_Sample.prototype.update = function() {
Window_Base.prototype.update.call(this); // *super()
// do update procedures for object variables.
};
//------------------------------------------
// (refresh) for Window_Sample.
//------------------------------------------
Window_Sample.prototype.refresh = function() {
this.contents.clear();
this.drawActorName(actor, x, y + lineHeight * 0, width);
this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
};
//=============================================================================
})(); // End of plugin block.
NOTE: I wasn't able to get around to adding in the exit function, its there but its never called in the script so there is no way out of the scene when called. Just wanted to share what i got done today.

Still learning, I'll work on finishing up a nice sample script for creating plugins in the end though, especially when I have a helpful community like this one.
EVENTALIST
Show Signature
EVENTALIST
Go to page : 1, 2