Trying to use function from one plugin inside another plugin

alashar

Villager
Member
Joined
Mar 17, 2019
Messages
6
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hello!

I'm having an issue that I haven't been able to resolve. I have two plugins, Nivek_Core and Nivek_Relationship. Inside of Nivek Core, I have defined some file functions to be used by any of the other plugins I may develop. Here is an example:

Nivek Core Code -
Code:
Nivek.Core.NivekFS.fileExists = function (path) {
  console.log ('Checking if ' + path + ' exists');
  if (this.fs.existsSync (path)) {
  	if (Nivek.testing) {
  	  console.log (path + ' exists');
  	}
    return true;
  }
  else {
  	if (Nivek.testing) {
  	  console.log (path + ' doesnt exist');
  	}
    return false;
  }
}
I am trying to call this procedure here:

Nivek_Relationship
Code:
if (Nivek.Core.NivekFS.fileExists ('./relationship.json')) {
    JSONString = Nivek.Core.NivekFS.readFile ('./', 'relationship.json');
}
When this runs, I am not seeing the output from
Code:
console.log ('Checking if ' + path + ' exists')
.

I am also not receiving any error messages in debug. Am I missing a step to allow the functions in the first plugin to be accepted in the second? (For plugin order, Nivek Core is before Nivek Relationship).

Thanks!
 

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
From what it looks like, the code inside Nivek_Relationship you mentioned,
Code:
if (Nivek.Core.NivekFS.fileExists ('./relationship.json')) {
    JSONString = Nivek.Core.NivekFS.readFile ('./', 'relationship.json');
}
does not trigger. So it looks like a problem somewhere inside one of the functions that calls it.
 

alashar

Villager
Member
Joined
Mar 17, 2019
Messages
6
Reaction score
0
First Language
English
Primarily Uses
RMMV
So i turned on a break point and found out that everything works, the only issue is that the console messages aren't being sent. Would anything prevent writing to the console from another plugin?
 

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 two options that come to my mind right now.
1.
console.log = function () {return;}
2. You have downloaded custom nwjs, but non-SDK version.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
Does any console.log work? Technically someone could overwrite console.log to make it a blank function.

Code:
console.log = function() {}
I really hope somebody didn't do that. To find out just create an event with a script command of console.log('Hello World') and see if it logs or not.
 

alashar

Villager
Member
Joined
Mar 17, 2019
Messages
6
Reaction score
0
First Language
English
Primarily Uses
RMMV
Yes, console in the calling plugin works fine, its the console command from the other plugin that I am calling to (That has the fileExists function). Very perplexing. But at least the routine seems to be working, minus the console portion hehe.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Do you have an audio you want me to animate? If so send me the youtube link and I’ll animate it.
Okay, so I'm working on Draft 2 of my game's script.
Will try to keep you guys posted, if you're interested!

This is vid of my new game, Crystalgazers. A demo is available on my Gamejolt

I just thought of the best achievement for my game: "'I Didn't Know You Were a Developer!' Find and enter one or more dev room(s)."
I made this animation to apply to a job, what do you think?

Forum statistics

Threads
105,590
Messages
1,014,840
Members
137,254
Latest member
WilliamSlither
Top