Custom Plugin Assistance

Proelium_Ex_Deus

God of War... & Tinkerer
Member
Joined
Jun 22, 2016
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMV
So I've created a simple plugin to produce a static window in my game, (via JS snippets & video tutorials), & while the thought of learning JS is intriguing, I don't think I want to fully delve into learning another computer language, (lol)... that being said, would anyone be so kind as to tell me the command / line I need to use in order for my plugin to require a switch to be active in order to trigger the window (make it appear)... or the command line I should use to create a script call (within the plugin)? The script call is likely the easier of the two options, while building the CE. I know it's something simple, but with a bazillion other things going on both in my head, & that I'm trying to keep track of, I've either managed to overlook it, or it's just not dawning on me. I apologize for such a simple request, but my numerous Google searches haven't come up with anything. Thanks in advance!!

P.S. The purpose of my window is to track custom states that are active. The states are all made, & rely on "game data" (play time) to track their duration. I have a parallel common event setup to run in the event of certain switches that are activated. When ran, this CE will initialize either the script switch or script call (whichever can be more easily implemented), so that the players can have a visual reference (on the map / playing field) of the custom state that is active. If anyone has any other suggestions to accomplish this, I'm all ears.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
that being said, would anyone be so kind as to tell me the command / line I need to use in order for my plugin to require a switch to be active in order to trigger the window (make it appear)...
Code:
if ($gameSwitches.value(1)) //your code
 

Proelium_Ex_Deus

God of War... & Tinkerer
Member
Joined
Jun 22, 2016
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMV
Wow.... god... I should have known that. I've used it a thousand times before (sigh). Thx. You wouldn't happen to know of a convenient way to implement a scriptcall function into a script, would you?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
I'm not entirely sure I understood the question. I don't think there's a "convenient" method to do it. I just open my text editor, open corresponding plugin and stick the line in where I need it.
 

Proelium_Ex_Deus

God of War... & Tinkerer
Member
Joined
Jun 22, 2016
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMV
My apologies. Let me try & explain my question a different way.

I've already added the "switch condition" to the top of my JS (thx for that reminder)... but thinking about it more, I could see this being far more versatile if I could simply use a script-call... but I'm having a brainfart in how to go about adding a plugin commmand function to my existing JS. What line /or lines would I need to add to create a plugin command so that I'd be able to call my plugin's function, via a script-call in a CE (or similar)?

For ref., here's the script / plugin I'm working on (to give you a better idea of what I'm trying to do).
Code:
// Value = Switch required to be ON, to display this custom window
if ($gameSwitches.value(941))

(function() {

// Scene Map
var _Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
  _Scene_Map_start.call(this);
  this.buffWindow = new DEP_BuffTimerWindow(0, 0);
  this.addWindow(this.buffWindow);
};

var _Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
  _Scene_Map_update.call(this);

  this.buffWindow.refresh();
};

// Buff Timer Window
function DEP_BuffTimerWindow() {
  this.initialize.apply(this, arguments);
};

DEP_BuffTimerWindow.prototype = Object.create(Window_Base.prototype);
DEP_BuffTimerWindow.prototype.constructor = DEP_BuffTimerWindow;

DEP_BuffTimerWindow.prototype.initialize = function(x, y) {
  Window_Base.prototype.initialize.call(this, x, y, this.windowWidth(), this.windowHeight());

  this.bufftimer = -1;
  this.refresh();
};

DEP_EventWindow.prototype.refresh = function() {
  if(this.bufftimer != $gameVariables.value(986)) {
    this.bufftimer = $gameVariables.value(986);
    this.contents.clear();
    this.drawIcon(132, 0, 0);
    this.drawText(this.bufftimer, Window_Base._iconWidth + 8, 0, this.windowWidth() - (Window_Base._iconWidth + 8), 'left');
  }
};

DEP_BuffTimerWindow.prototype.windowWidth = function() {
  return 100;
};

DEP_BuffTimerWindow.prototype.windowHeight = function() {
  return this.fittingHeight(1);
};

})();
 
Last edited:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
There are like a thousand plugins out there, many using plugin commands. Check them out and see for yourself, best way to learn.
 

Proelium_Ex_Deus

God of War... & Tinkerer
Member
Joined
Jun 22, 2016
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMV
Yeah... I've been working on that. I learn best by example... the prob is that I haven't found one that has really clicked yet. Trust me... I have over 15 tabs open on my browser, pouring thru vids & forums, trying to find the best solution (save for going thru something like a JS short course). I found "this"... but since it doesn't cover what I'm trying to do, I'm a bit lost in it. The frustrating thing is that I'm no stranger to code... I just don't know JS to save my life... & while it seems familiar, it also seems completely foreign.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Well, after a good night's sleep I can think more clearly. You have to differentiate between script calls and plugin commands. Script calls are what we know them to be, classic Javascript functions, and we call them normally. So if you type in the script for example
Code:
function foo() {
console.log("bar");
}
, you can simply call foo() via an event's script command.
Plugin commands are useful for plugin makers that want to publish their plugins for public to make certain things easier.
 

Proelium_Ex_Deus

God of War... & Tinkerer
Member
Joined
Jun 22, 2016
Messages
26
Reaction score
2
First Language
English
Primarily Uses
RMMV
Thx for your input man... & I get the "no sleep thing"... as a chronic insomniac, I battle to sleep more than a few hours ;_;. So, what do I fill all my "extra" time with? Try to learn new things (& JS is REALLY killin' me here)!! lol

I found a solid work around to my initial question, so this topic can be closed. I am, however, still fighting with that **mned switch condition, lol. So, any help you can offer on that (in that other post) would be GREATLY appreciated. And I'll say this... despite not wanting to fully dive into learning JS, I don't mind learning what I need to. The main prob I've encountered so far is that while there is a moderate amt of info on JS itself, there is little (or hidden) info on how MV utilizes it (e.g. its custom use of handlers, etc.), & I think that is what I'm struggling with the most.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Well, not too much to be said. If you want a switch, use $gameSwitches.value(1). If you want to show a window based on a switch, use script command and input if ($gameSwitches.value(1)) and whatever code you need to use in it. For example
if ($gameSwitches.value(1)) {
SceneManager._scene._randomWindow = new Window_Random;
SceneManager._scene.addChild(SceneManager._scene._randomWindow);
}
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,062
Members
137,575
Latest member
akekaphol101
Top