Open Console after deployment

● ARCHIVED · READ-ONLY
Started by JamesRyan 20 posts View original ↗
  1. I'm about to send my a demo of my game to my friends to test, but I don't want them to get access to my project, as well as my resources inside, so i need to encrypt them via MV deployment. However, i still want to allow my friends to open console to see the logs when an error occurs, so they can send it to me. Is there a way to do so?
  2. Yes. Search for f8 in rpg_managers.js. There should be an
    if(Utils.isNwjs && Utils.isTestMode) or something. Delete the test mode thing, leaving only
    if (Utils.isNwjs)
    there. I use this as an easy hack into mv games.
  3. Thanks @Poryg, it works as my expectation :D However, is there a way which does not require to toy with the core js files?
  4. Either that or make it a separate plugin containing this code. There's no other efficient way than these two.
  5. @Poryg I found the line you mentioned in rpg_managers.js, and made a proper change. The deployed game was able to open console, but could not do a thing. It was just a blank page like this:
    Untitled.png
  6. When this happened to me, the cause of this usually was a blunder in code that wouldn't make my game crash, but instead get stuck in an infinite loop or something.
  7. I will check it again to see if a plugin is the cause of this.

    EDIT: I tried to disable suspicious plugins, but it was still the same. Not sure what causes this. Console still works fine during playtest.
  8. What about the code about opening the console when not in test mode? May I take a look to see if the blunder is not there?
  9. Here it is:
    PHP:
    SceneManager.onKeyDown = function(event) {
        if (!event.ctrlKey && !event.altKey) {
            switch (event.keyCode) {
            case 116:   // F5
                if (Utils.isNwjs()) {
                    location.reload();
                }
                break;
            case 119:   // F8
                if (Utils.isNwjs()/* && Utils.isOptionValid('test')*/) {
                    require('nw.gui').Window.get().showDevTools();
                }
                break;
            }
        }
    };
  10. Looking at the code here it seems fine. I'll incestigate the issue in the evening, once I return home.
  11. Thanks i'm really looking forward to it.
  12. Poryg said:
    Either that or make it a separate plugin containing this code. There's no other efficient way than these two.

    Uh. Yes, there is.

    There's a much easier way to do this that doesn't involve plugins and that's opening up the game in a web browser and using the console that comes with the browser.
    JamesRyan said:
    Is there a way to do so?
    Tell your friends to open up the "www" folder inside the game directory and then double-click the index.html file instead of using the Game.exe executable from the previous directory.

    This will launch the game in their default web browser and everything meant to be printed to the console will show up in the browser console. Which they can bring up with F12 for Firefox/Chrome or Ctrl+Shift+I in Opera, although I assume they don't need to be told that as they presumably know how to use their favourite web browser.
  13. I tried to double-click the index.html of my deployed game, but it only gave me an error called "Script Error".
  14. That's rather suspicious. Is the script error like a popup? or is it visible from the console? If yes, it might not be a bad idea to post the screen. Other browsers, do they yield the same result?

    I'm kind of beginning to suspect corrupted files during deployment for whatever reason.
  15. Then you ought to look into fixing that, because the index.html page is what would normally be loaded by other people playing your game in a web deployment.

    If it's not working, you should probably iron that out before anything else. Bear in mind it's also dependent on how the web browser used handles Javascript. Some browsers allow some functions that others don't, so if you're using a plugin/script that only works on certain browsers, people who use incompatible browsers simply won't be able to play it.
  16. The game client works fine after deployment, it just cannot be launched via index.html. Let's forget about launching it on browser. I'm still wondering what causes the blank console page above.
  17. Understood. I'll get home in 6 hours, I'll run a test when I do. I wonder though, what if you download the recent version of Nw.js sdk and overwrite the default one in your deployed folder (not just the exe of course, but everything)? Will it work then?
  18. Sounds like a good idea. I did once before with SDK version and it allowed me to open console via F12. Gonna give it a try again.
  19. JamesRyan said:
    The game client works fine after deployment, it just cannot be launched via index.html. Let's forget about launching it on browser.

    If the game client can't be launched on a web browser, it doesn't work fine after deployment, which is my point.

    You might want to be sure you have Javascript enabled on your web browser. I know some browsers like Internet Explorer disable it from running until otherwise specified and others like Tor come with JS-blockers inbuilt to sanitize browsing.

    It's your call if you want to ignore it for now of course, but sooner or later you're going to have to come back to it.
  20. No, it works totally fine. I have several backups of my project, and none of them works when using index.html. But my friends were able to run through the beginning to the end without a prob before.
    And about the new nwjs, i was able to launch it not long ago, but now it becomes like this and the game never starts:
    Untitled.png