Needs a file for event

Hi, I'm searching for a JS that do the event will not work if a file (test.asd for example) didn't exist.

Any idea? (Sorry for bad english)
the event will not work if a file didn't exist
1589480716464.png



There ya go 😉
View attachment 143674


There ya go 😉
It gives me a little error in console, how can I fix that?

1589481710018.png
odd...

This may sound silly to ask but...
did you add the plugin to you project?
1589482124923.png

1589481885353.png
odd...

This may sound silly to ask but...
did you add the plugin to you project?
View attachment 143676
Of course, I put it on the top but it's still the same
1589482106796.png
Of course, I put it on the top but it's still the same
View attachment 143677
Hmm that's really odd honestly... uploading a demo project to the plugin's page.
Try the demo project, see if that works on your end?
Hmm that's really odd honestly... uploading a demo project to the plugin's page.
Try the demo project, see if that works on your end?
It say me the same that in console, I don't understand about JS :/
1589483189999.png
It say me the same that in console, I don't understand about JS :/
View attachment 143681
what the heck??? that's really strange... and no other error messages?
can I see a full console screenshot?

Mine looks clear and all works as it should so I'm not really sure what else is going on.
1589483677165.png
what the heck??? that's really strange... and no other error messages?
can I see a full console screenshot?
Sure
1589483780663.png
Ahhh gotcha not able to use ES6 for some reason.

Didn't know that could cause issues. Sorry 'bout that.

I've rolled back to ES5 now.

Please download and check again.
Ahhh gotcha not able to use ES6 for some reason.

Didn't know that could cause issues. Sorry 'bout that.

I've rolled back to ES5 now.

Please download and check again.
Sorry, new in this. What is and how can I donwload it?
naw nothing needed except just download my plugin and try it again. I made the changes. Should work now 🙂

Still I could show you the different though I suppose:
ES5:
Spoiler
Code:
var CTB = CTB || {}; CTB.File  = CTB.File || {};
var Imported = Imported || {}; Imported["CT_Bolt File"] = 1.00;
"use strict";
(function ($_$) {
    $_$.Check = function(file) {if (file){var fs = require('fs');try {var stats = fs.statSync(file);return stats.isFile();}catch (e){return false;};}}
})(CTB.File, this);
uses: $_$.Check = function(file)

ES6:
Spoiler
Code:
var CTB = CTB || {}; CTB.File  = CTB.File || {};
var Imported = Imported || {}; Imported["CT_Bolt File"] = 1.00;
"use strict";
(function ($_$) {
    $_$.Check =(file)=> {if (file){var fs = require('fs');try {var stats = fs.statSync(file);return stats.isFile();}catch (e){return false;};}};
})(CTB.File, this);
uses: $_$.Check =(file)=>

Edit:
LMAO dang it... I uploaded the wrong file... 1 sec sorry...
Not sure if editing above and pinging your user name notifies you... so I am posting again to be sure.

...anyways I have uploaded a new version that should work now 🙂

@SuzuMito7u7
Sooo ok how 'bout now?
naw nothing needed except just download my plugin and try it again. I made the changes. Should work now 🙂

Still I could show you the different though I suppose:
ES5:
Spoiler
Code:
var CTB = CTB || {}; CTB.File  = CTB.File || {};
var Imported = Imported || {}; Imported["CT_Bolt File"] = 1.00;
"use strict";
(function ($_$) {
    $_$.Check = function(file) {if (file){var fs = require('fs');try {var stats = fs.statSync(file);return stats.isFile();}catch (e){return false;};}}
})(CTB.File, this);
uses: $_$.Check = function(file)

ES6:
Spoiler
Code:
var CTB = CTB || {}; CTB.File  = CTB.File || {};
var Imported = Imported || {}; Imported["CT_Bolt File"] = 1.00;
"use strict";
(function ($_$) {
    $_$.Check =(file)=> {if (file){var fs = require('fs');try {var stats = fs.statSync(file);return stats.isFile();}catch (e){return false;};}};
})(CTB.File, this);
uses: $_$.Check =(file)=>

Edit:
LMAO dang it... I uploaded the wrong file... 1 sec sorry...
Well, now there isn't errors in console! But it doesn't work well, Did I something wrong?
1589485568266.png
is it returning that it doesn't exist?
capitalization has to be the exact same even the filename extension too

Does the newest demo that is uploaded work for you and finds BlueSky.png?
is it returning that it doesn't exist?
capitalization has to be the exact same even the filename extension too

Does the newest demo that is uploaded work for you and finds BlueSky.png?
And is it, in the demo is the same, the two events says file not found
in the demo it is the same, the two events says file not found
this is honestly very strange... works perfect for me on my end...
Hmm... I think it is due to the delay on how the file gets loaded to be read...
Taking a whole new approach now lol

Please give it a try, hope it works now 🙂

@SuzuMito7u7
Updated to v0.80... how 'bout now?
Use like this:
1589500582859.png
this is honestly very strange... works perfect for me on my end...
Hmm... I think it is due to the delay on how the file gets loaded to be read...
Taking a whole new approach now lol

Please give it a try, hope it works now 🙂

@SuzuMito7u7
Updated to v0.80... how 'bout now?
Use like this:View attachment 143712
Console again... Maybe relacionate with YEP_X_BattleSysCTB.js?

1589541736125.png
Are you using v0.80?

Should only be now using CTB.File.Check()
index.php
Are you using v0.80?

Should only be now using CTB.File.Check()
index.php
Yeah, I used this two codes. The largest send my a error in console and the shortest says that the file doesn't exist
1589548005076.png

1589548045006.png

Original thread: https://forums.rpgmakerweb.com/threads/needs-a-file-for-event.121557/