Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
Ok, before I get into things I need to share a little bit of backstory. in my attempt to try and learn how to do everything with RPGmaker's GUI I started to teach myself how to do a ton of things RPGmaker can do with programming. (I even have the script calls bookmarked). I started to even check the documentation for the framework used (nwjs) and found a "protect your source code" section in the documentation. This eventually lead me into finding the "RPG Maker MV Cooking Tool" which from what I understood used nwjc to compile all the javascript files into native code (which is attractive to me because more encryption and faster runtime performance) the only issue of course is that it was for rmmv, so I did what I could to interpolate the instructions to rmmz. the issue i'm having here is that unlike rmmv where is loads all the scripts in the "js" folder using index.html and then goes on it's marry way, rmmz has to load them from a browser context as it has to emulate a database in order to get past the chromium local security. I had to rummage though the javascript files (rmmz_managers, main) to see how it was loading everything. when I edit main to be loaded (using the documentation from nwjs.io) I get the error "Undefined" because when I use the function "nw.Window.get().evalNWBin(null,url)" (where url is the name of the file it's loading) it simply doesn't load it, it just shows up in the dev console as "<script src = "undefined"></script>" I know there's a way to do this (it's on the documentation) but I'm too much of a noob at javascript (I mainly learned C# and python) and even more of a noob at nwjs.


TLDR; I need help effectively cooking an Rpgmaker MZ game
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,743
First Language
English
Primarily Uses
RMMV

@Xana43, please do not bump your topic unless it has been 72 hours later since your last post. You can review our forum rules here. Thank you.



Providing a link to the tool you are using might be of some help.
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
[bump]@Xana43[/bump]

Providing a link to the tool you are using might be of some help.
sorry for bumping so much, I didn't read the rules because the rule page was refusing to load for me,
anyways the tool that i'm using is part of the nwjs sdk

 

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
253
Reaction score
208
First Language
English
Primarily Uses
RMMZ
Ok, before I get into things I need to share a little bit of backstory. in my attempt to try and learn how to do everything with RPGmaker's GUI I started to teach myself how to do a ton of things RPGmaker can do with programming. (I even have the script calls bookmarked). I started to even check the documentation for the framework used (nwjs) and found a "protect your source code" section in the documentation. This eventually lead me into finding the "RPG Maker MV Cooking Tool" which from what I understood used nwjc to compile all the javascript files into native code (which is attractive to me because more encryption and faster runtime performance) the only issue of course is that it was for rmmv, so I did what I could to interpolate the instructions to rmmz. the issue i'm having here is that unlike rmmv where is loads all the scripts in the "js" folder using index.html and then goes on it's marry way, rmmz has to load them from a browser context as it has to emulate a database in order to get past the chromium local security. I had to rummage though the javascript files (rmmz_managers, main) to see how it was loading everything. when I edit main to be loaded (using the documentation from nwjs.io) I get the error "Undefined" because when I use the function "nw.Window.get().evalNWBin(null,url)" (where url is the name of the file it's loading) it simply doesn't load it, it just shows up in the dev console as "<script src = "undefined"></script>" I know there's a way to do this (it's on the documentation) but I'm too much of a noob at javascript (I mainly learned C# and python) and even more of a noob at nwjs.


TLDR; I need help effectively cooking an Rpgmaker MZ game
Not saying I have the answer, but trying to probe for more information about the problem so others may be more willing to help. Reading a block of text like you've written here is a bit difficult.
I get hung up from the part:
when I edit main to be loaded...
It sounds like you updated something in main.js and now nothing is working/loading? Or were you trying to extend it by adding new files to be loaded (like your own custom set of plugins?), but THOSE aren't being found?

(I'm just not sure I follow.)
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
Not saying I have the answer, but trying to probe for more information about the problem so others may be more willing to help. Reading a block of text like you've written here is a bit difficult.
I get hung up from the part:

It sounds like you updated something in main.js and now nothing is working/loading? Or were you trying to extend it by adding new files to be loaded (like your own custom set of plugins?), but THOSE aren't being found?

(I'm just not sure I follow.)
in retrospect, I maybe should've structured the whole post better (I wrote this after I spent 2 days without sleep trying to solve the issue)

What I'm basically saying is that when I use NW.js' javascript compiler, I have to change the references to the library files in main.js (so like pixi.js becomes pixi.bin) it loads enough to launch the game, but not enough to load the plugins.

I have a feeling I may never find an answer :(
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,812
Reaction score
889
First Language
German
Primarily Uses
RMMZ
I needed a moment to parse this, but what you are saying is that you compiled all files listed in main.js (scriptUrls, line 5 onwards) to their respective .bin representation and changed the "loadMainScripts" function to load these using "nw.Window.get().evalNWBin(null, ...)". And i'm understanding, that it works up to this part?

Plugins are loaded using the same mechanism, so you probably need to take a look at the following locations:
  • PluginManager.loadScript (rmmz_managers.js, line 3066), to make sure the files are loaded using "evalNWBin", same as in main.js.
  • PluginManager.makeUrl (rmmz_managers.js, line 3082), so plugins are resolved to .bin files.
After modifying the file, make sure to recreate rmmz_managers.bin, so it's up-to-date with your changes. I've never done this, so not sure if that would be everything, but it could be a start.

Aside from that it would be good to know what exactly you are doing, because we won't be able to reproduce your problem otherwise.
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
well, the issue there is that I don't know how to deal with main.js.

main.js has an array called "script URLs" which are references to their respective js files (it's really just a string array that references for example js/plugins.js)

and I have edited the rmmz_managers.js script to load each plugin using the NWJC eval function

1626256337552.png
it's this part that gets me. This is the code in main.js that appends each plugin to the HTML document. as you can see what it appears to be doing is loading each reference
1626256411251.png
in this array here (this is an older version before any ".bin" was appended"

and explicitly loading it as a javascript file.

and as such when it loads it displays this in the console

1626257155595.png
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
and when I do change the code to this

1626257355119.png
launching the game yields this
1626257403339.png
with all this garbage in the console

1626257423000.png
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
I don't really know how else to describe it, because i'm not very knowledgeable in this aspect myself. I'm also bad at explaining to boot
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,812
Reaction score
889
First Language
German
Primarily Uses
RMMZ
You need to execute the evalNWBin(...), not specify it as source, like this:

JavaScript:
let xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
xhr.open('GET', url.replace('.js', '.bin'), true);
xhr.send();
xhr.onload = (e) => {
    nw.Window.get().evalNWBin(null, xhr.response);
};

This does seem to load the scripts, but they have trouble accessing each other (i got "Uncaught ReferenceError: PIXI is not defined", even though it's clearly there). Furthermore, this is impossible to debug, because you no longer have access to the JS code, and needs to be recompiled every time you change something.

Maybe this could end up being faster, but i'm not sure it's worth the trade-off, tbh.
 

Xana43

Veteran
Veteran
Joined
Dec 26, 2020
Messages
44
Reaction score
14
First Language
English
Primarily Uses
RMMZ
where would you put that code? in the "loadMainScripts()" function or the "testXhr()" function?
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,812
Reaction score
889
First Language
German
Primarily Uses
RMMZ
"loadMainScripts", though there are also issues with "testXhr". Because the current script tag (the one main.bin is loaded in) does not have a "src"-property, the request fails and xhrSucceeded is never set to true. But that's a whole different issue and could be resolved by just trying to load anything else.
 

Latest Threads

Latest Profile Posts

Challenging myself to make a game on the console versions of RMMV with alot of custom stuff, battle system is almost done, but holy heck is the interface and navigation so backwards on console ports. I've lost several hours of work because of design choices from that team!
If only RM had the capability to show whether a project has been edited, or not... like 99% of all other editors out there. That don't cost, too, or release new versions with very few features just to get the extra money... ugh, just too many basic features missing even after, what, two decades?
Surgically removing people's faces and grafting them on to other people is kind of fun.

(editing character art busts for my game)
I think sleep is like a foreign language to me.

Forum statistics

Threads
118,819
Messages
1,118,954
Members
156,003
Latest member
arsenic333
Top