Okay so since I'm starting to get the hang of Javascript and MV I started making some base to some plugins I want to create. The first one I want to create which I believe will push me to my limits is an Item pop up plugin. I know there is already plugins for this but they aren't what I'm looking for and I want to learn how to make my own anyways. I started the base of this plugin last night after watching @eivl stream and I'm not recieving any errors but my window is not appearing when I call it from script call in the game.
Anyways first things first is what I have . This script is based off of Window_MapName from the core scripts. I don't have any parameters sccripted into this yet because I want to debug and test to make sure I got the core of it working before I make some parameters.
Basically it works great, no errors or anything but when I do a script call in one of my NPCs.. this script call to be exact.
The code runs and my console displays " Created A Window" that I implemented in the refresh function but the window don't appear on my map scene, nothing happens except for the small console output I scripted in.
I'm sure I'm missing something right in front of me but considering I'm new to the JS & RM scripting scene I can't quite see what I'm missing. Any help would be appreciated.
Anyways first things first is what I have . This script is based off of Window_MapName from the core scripts. I don't have any parameters sccripted into this yet because I want to debug and test to make sure I got the core of it working before I make some parameters.
JavaScript:
//=============================================================================
// New Window* Item Popper
//=============================================================================
function Window_ItemPopper() {
this.initialize.apply(this,arguments);
}
Window_ItemPopper.prototype = Object.create(Window_Base.prototype);
Window_ItemPopper.prototype.constructor = Window_ItemPopper;
Window_ItemPopper.prototype.initialize = function() {
var wiidth = 200;
var height = 150;
Window_Base.prototype.initialize.call(this, 5, 5, wiidth, height);
this.opacity = 0;
this.Popper_Opacity = 0;
this._showTimer = 0;
this.refresh();
};
Window_ItemPopper.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this._showTimer > 0) {
this.updateFadeIn();
this._showTimer--;
} else {
this.updateFadeOut();
}
};
Window_ItemPopper.prototype.updateFadeIn = function() {
this.Popper_Opacity += 16;
};
Window_ItemPopper.prototype.updateFadeOut = function() {
this.Popper_Opacity -= 16;
};
Window_ItemPopper.prototype.open = function() {
this.refresh();
this._showTimer = 150;
};
Window_ItemPopper.prototype.close = function() {
this._showTimer = 0;
};
Window_ItemPopper.prototype.refresh = function() {
this.contents.clear();
var width = this.contentsWidth();
this.drawBackground(0, 0, width, this.lineHeight());
this.drawText('Yo Yo What is up yallllllllll, Items Here, & Icon', 5, 5, width, 'center');
console.log("Created A Winodw");
};
Window_ItemPopper.prototype.drawBackground = function(x, y, width, height) {
var color1 = 'rgba(0, 0, 0, 0.6)';
var color2 = 'rgba(0, 0, 0, 0)';
this.contents.gradientFillRect(x, y, width / 2, height, color2, color1);
this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);
};
Code:
new Window_ItemPopper();
I'm sure I'm missing something right in front of me but considering I'm new to the JS & RM scripting scene I can't quite see what I'm missing. Any help would be appreciated.