making pop-ups

markchapman

Warper
Member
Joined
Dec 7, 2015
Messages
2
Reaction score
0
First Language
english
Primarily Uses
Hello everyone, I'm just now starting into Java Script and I was wanting to make A pop up plugin, where I can call A pop up with some text, the call I would like to have something like Popup("say this",s) s would be the seconds it shows. I know some other programming languages i just don't know where to start with java script and rmmv.

I've tried looking though the the core code for the pieces that I need like the window base, I'm not quite sure how to put it together. I have been watching a Video and this is what I have

Window_Sample.prototype.windowHeight = function(){ return this.fittingheight(1);0 }; Window_Sample.prototype.refresh = function(){ var x = this.textPadding(); var width = this.contents.width - this.textPadding() * 2; this.contents.clear(); this.drawIcon(2,0,0); }; Window_sample.prototype.open = function() { this.refresh(); Window_Base.prototype.open.call(this); }; function Sample_scene(){ this.initialize.apply(this, arguments); }; Sample_scene.prototype = object.create(scene_MenuBase.prototype); Sample_Scene.prototype.constructor = Sample_Scene; Sample_Scene.prototype.initialize = function(){ Scene_MenuBase.prototype.create.call(this); }; Sample_Scene.prototype.create = function(){ Scene_MenuBase.prototype.create.call(this) this._sampleWindow = new Window_Sample this.sampleWindow.x = Graphics.width / 2 - 100; this.sampleWindow.y = Graphics.height / 2 - 100; this.addWindow(this._sampleWindow); }; Sample_Scene.prototype.start = function(){ Scene_MenuBase.prototype.start.call(this); };I have just been trying to make a basic window display on the screen, I've made A title skip plugin but that sort of helped my understanding of finding the pieces of code in the core rmmv code. 
 
Last edited by a moderator:

Sarkilas

Villager
Member
Joined
Jun 8, 2014
Messages
16
Reaction score
7
First Language
Norwegian
First of all you have some capitalization consistency issues (i.e. Sample_Scene vs Sample_scene), which will not make the code functional. Ensure all capitalization is accurate or things will not function as intended.

I won't be writing your entire required code to create a popup window, but your actual window code is not functional in the current state because it isn't a valid class and has no reference to the actual Window class.

Here's a basic example of how to setup a sample window and immediately refresh it to draw contents:

function Window_Sample() { this.initialize.apply(this, arguments);}Window_Sample.prototype = Object.create(Window_Base.prototype);Window_Sample.prototype.constructor = Window_Sample;Window_Sample.prototype.initialize = function(x, y, width, height) { Window_Base.prototype.initialize.call(this, x, y, width, height); this.refresh();};In your create() function for Sample_Scene you have some typos that will not let your script work as intended (and will actually cause an error). You have:

this._sampleWindow = new Window_Sample this.sampleWindow.x = Graphics.width / 2 - 100; this.sampleWindow.y = Graphics.height / 2 - 100; this.addWindow(this._sampleWindow);But it should be:

this._sampleWindow = new Window_Sample(); this._sampleWindow.x = Graphics.boxWidth / 2 - 100; this._sampleWindow.y = Graphics.boxHeight / 2 - 100; this.addWindow(this._sampleWindow);Please note that my example window code does not work with the above initialization of the Window_Sample class as it requires arguments passed into it.

Hopefully this explains naming conventions and how to set up classes that inherits other classes.
 

markchapman

Warper
Member
Joined
Dec 7, 2015
Messages
2
Reaction score
0
First Language
english
Primarily Uses
Thank you, this was probably the push I needed. I was watching the video and typing with it, I'm new to Java script so I wasn't aware of my punctuation errors. That actually explains alot. 

Here is my title skip code, it wasn't that hard actually, just a little bit of searching. Youtube can be helpful when it wants but with resources being what they are I look for something that hits close to home and do it.  

Code:
/*: * @plugindesc Skip Title Screen * @author Mark *@help This Plugin will make testing alot faster. * *@param  * */Scene_Boot.prototype.start = function() {    Scene_Base.prototype.start.call(this);    SoundManager.preloadImportantSounds();    if (DataManager.isBattleTest()) {        DataManager.setupBattleTest();        SceneManager.goto(Scene_Battle);    } else if (DataManager.isEventTest()) {        DataManager.setupEventTest();        SceneManager.goto(Scene_Map);    } else {        this.checkPlayerLocation();        DataManager.setupNewGame();        SceneManager.goto(Scene_Title);        Window_TitleCommand.initCommandPosition();    	SceneManager.goto(Scene_Map);    }    this.updateDocumentTitle();};
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top