adventurist's Forum Posts

  • dop2000

    I did find a solution that worked for me, however, it's a bit of a hassle and involved many steps. In the exported version, they have added a javascript code that overrides any code you add into the editor in regards to preventing the game from closing, which is why it only works in the preview mode. Here's the steps I follow to make this work:

    1. Open the exported files folder and find package.nw

    2. Change the package.nw file-ending name to .zip instead.

    3. Extract the zip file to a new empty folder somewhere on your computer.

    4. In that folder where there now are a bunch of files from the extraction, find index.html.

    5. Open the file in an editor of choice and scroll down to this section of javascript code:

    var win = window['nwgui'].Window.get(); win.on('close', function () { window['nwgui'].App.quit(); });

    The line that you want to remove is the window['nwgui'].App.quit();

    However, in doing so, you will need to have a way inside your game to close down the game window so it's not left open after you have run your own code (such as after a "are you sure you want to close?" message). I added a call to a function inside the game as a substitute to the line removed above by using the function "c2_callFunction()".

    After that change you need to zip all the extracted files up together again, and then change the .zip file-ending to .nw again, and replace the old package.nw in the original flder with that one.

    Hope that helps.

  • Construct 2 version: r279

    NWJS for construct version: v0.50.0

    Another issue with nwjs with Construct 2, this time I think it might be an issue with Construct rather than nwjs.

    I've been using a specific javascript/jquery code for nwjs to prevent the window from closing when pressing the 'x' on the window itself until I've run my own code. This works perfectly in preview mode inside C2, but once exported, it won't work anymore. It simply close straight away. Take example below (with minimum .capx file to test).

    I am using this code at start of layout with the browser object -> execute javascript action:

    "var win=nw.Window.get(); win.on('close', function() {c2_callFunction('quit');});"

    Then once the function called 'quit' runs, I put, for example, wait 5 seconds then I run this javascript code:

    "var win = nw.Window.get(); win.close(true);"

    Again, this example works excellent in preview mode but not in export. What do I have to do for the export version to work? I chose not to minify the export btw.

    EDIT: I should also mention I have tried setting nw.close(false) to the first snippet of code above with no difference.

    I have attached example minimum project below for testing. Remember to try it in both preview mode and exported.

    Download .capx

    Tagged:

  • There's an issue with getting 'on save dialog cancel' to trigger in construct 2. It just won't do any actions assigned to it. I've attached a simple .capx to illustrate the issue using nwjs v0.50.0 and C2 r279.

    https://drive.google.com/file/d/1cWxau4ZLdKxaOBMbZaEZtxZO9JRbJHEB/view?usp=sharing

    Tagged:

  • Here's a .gif demonstrating the issue as well when I'm resizing the browser. This happens in both Chrome, Firefox as well as nw.js. I'm using the latest Construct 2 release 279.

    imgur.com/a/bPnaPAa

  • AllanR Thanks for checking it. As far as I know, C3 adds text differently than C2 by adding it as an element inside the game Canvas, while C2 adds it as a form element above the Canvas, separated from it. That would explain the different results. Scratch that, that only goes for textbox, lists etc. not plain text. It seems to be the same for both C3 and C2. Not sure why it behaves differently then.

    I'm wondering if there's any specific font css I can add in the stylesheet for the font to make it look correct in C2 that may be specific to Chromium/Chrome. Or maybe there's something wrong with the font itself when it comes to displaying in browser and nw.js apps.

    EDIT:

    Here's some screenshots depicting the problem. First image is C2 rendering the font with the weird '2', and second image is the font shown correctly in Illustrator.

  • Hello!

    I'm not sure what's causing this but, I downloaded a font from Google Fonts called "Gochi Hand". In my game, I load it with the "set webfont" action on a textbox.

    This works fine, however, the number '2' is glitchy and renders at different thickness throughout. I attached a simple construct 2 project file below anyone who wants to can try out in their browser and see how the 2 "dances" when re-sizing the browser as it changes width for example.

    https://drive.google.com/file/d/1itlg_EZ3gNGX-f-8jOxJjult9EQpxJCt/view?usp=sharing

    Is there any fix to this?

    Tagged:

  • Ah, look at that. Had to do with what event sheet I chose to put the code into. I thought I could add it in the included event sheet instead of the event sheet for the actual layout. Doesn't work that way, but putting it in the same layout event sheet works!

    Good for anyone else who might be wondering in the future.

  • Hello!

    There's a post from 4 years ago (https://www.construct.net/en/forum/construct-2/how-do-i-18/window-close-113911) about being able to run an event before the NWjs window closes when pressing the X(close) button of the actual window. Rojohound gave an example of how this can be done at the bottom of the post, and I was hoping it would still work to this day, seeing as the NWjs documentation is still the same for the solution. However, it has proven futile for me.

    I wanted to put up a confirmation window before the game closes when pressing the x button of the actual window. So I adapted the javascript code given in the post linked above to this:

    "var win=nw.Window.get(); win.on('close', function() {c2_callFunction('nw.js close',[]);});"

    As you can see, I omitted the win.close(true); which is supposed to result in the window being prevented from closing (NWjs documentation example: https://docs.nwjs.io/en/latest/References/Window/#wincloseforce), but alas, doesn't work.

    Maybe construct 2 is executing a window close event sometime later and thus overwriting the browser execute javascript event in the event sheet?

    I've got the latest NWjs version (11th nov. 2020) for construct 2 and the latest version of construct 2 (279). Trying to run this on a Windows 8.1 pro computer.

    Anyone who has any info on this? R0J0hound?

  • The same thing happens to me with firefox 78.0

    PabloDev thanks for confirming!

  • Ashley From googling the issue, seems like it might be something new in the way Firefox handles webrtc, and that Construct 2 needs updating to support it.

    Anything to add on this?

    Thanks.

  • Unfortunately, I haven't found anything that helps with it in Firefox.

    Again, it seems like connecting itself works, and joining rooms. But as soon as messages are to be sent, it never happens.

    It would be great if someone could test the chat example project in their latest version of Firefox and in the latest version of Construct 2 and report here if it works or not for you.

  • Hello!

    rexrainbow I can't post in the plugin thread for this plugin since it's been inactive for over a year. I'm not sure the plugin is maintained at all anymore, and I'm having issues making it work.

    I put the list on the layout, resize it and then set it to have default total lines of 6.

    Then I go to event sheet and set at start of layout: "List->set value" and set index:0, key:"", value "hello". Then I run the layout and nothing shows up.

    Am I missing a step here?

    Thanks.

    Tagged:

  • Interesting... seems like it works fine in Chrome, but not in Firefox O_o.

    Might be a Firefox restriction that has come into place in a recent update like the privacy functions that block tracking etc. that is set by default. Guess I'll have to experiment with it a bit and see if some settings work.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Looking at about:webrtc in the browser show a log with some errors. No clue what they mean so hopefully someone else does:

    (registry/INFO) insert 'ice' (registry) succeeded: ice (registry/INFO) insert 'ice.pref' (registry) succeeded: ice.pref (registry/INFO) insert 'ice.pref.type' (registry) succeeded: ice.pref.type (registry/INFO) insert 'ice.pref.type.srv_rflx' (UCHAR) succeeded: 0x64 (registry/INFO) insert 'ice.pref.type.peer_rflx' (UCHAR) succeeded: 0x6e (registry/INFO) insert 'ice.pref.type.host' (UCHAR) succeeded: 0x7e (registry/INFO) insert 'ice.pref.type.relayed' (UCHAR) succeeded: 0x05 (registry/INFO) insert 'ice.pref.type.srv_rflx_tcp' (UCHAR) succeeded: 0x63 (registry/INFO) insert 'ice.pref.type.peer_rflx_tcp' (UCHAR) succeeded: 0x6d (registry/INFO) insert 'ice.pref.type.host_tcp' (UCHAR) succeeded: 0x7d (registry/INFO) insert 'ice.pref.type.relayed_tcp' (UCHAR) succeeded: 0x00 (registry/INFO) insert 'stun' (registry) succeeded: stun (registry/INFO) insert 'stun.client' (registry) succeeded: stun.client (registry/INFO) insert 'stun.client.maximum_transmits' (UINT4) succeeded: 7 (registry/INFO) insert 'ice.trickle_grace_period' (UINT4) succeeded: 5000 (registry/INFO) insert 'ice.tcp' (registry) succeeded: ice.tcp (registry/INFO) insert 'ice.tcp.so_sock_count' (INT4) succeeded: 0 (registry/INFO) insert 'ice.tcp.listen_backlog' (INT4) succeeded: 10 (registry/INFO) insert 'ice.tcp.disable' (char) succeeded: \000 (generic/ERR) UDP socket error:Internal error at /builds/worker/checkouts/gecko/dom/network/UDPSocketParent.cpp:248 this=000000B01BE94400 (ice/ERR) ICE(PC:1592494910760000 (id=10737418244 url=http://localhost:50000/)): failed to find default addresses (generic/ERR) UDP socket error:Internal error at /builds/worker/checkouts/gecko/dom/network/UDPSocketParent.cpp:248 this=000000B01BE95800 (ice/ERR) ICE(PC:1592494910760000 (id=10737418244 url=http://localhost:50000/)): failed to find default addresses (ice/WARNING) ICE(PC:1592494910760000 (id=10737418244 url=http://localhost:50000/)): peer (PC:1592494910760000 (id=10737418244 url=http://localhost:50000/):default) has no stream matching stream PC:1592494910760000 (id=10737418244 url=http://localhost:50000/) transport-id=transport_0 - fb357d33:9ecea536fc0342876df01b4af9fcb7c5 (generic/ERR) UDP socket error:Internal error at /builds/worker/checkouts/gecko/dom/network/UDPSocketParent.cpp:248 this=000000B01C980400 (ice/ERR) ICE(PC:1592495604393000 (id=10737418245 url=http://localhost:50000/)): failed to find default addresses (generic/ERR) UDP socket error:Internal error at /builds/worker/checkouts/gecko/dom/network/UDPSocketParent.cpp:248 this=000000B01C981800 (ice/ERR) ICE(PC:1592495604393000 (id=10737418245 url=http://localhost:50000/)): failed to find default addresses (ice/WARNING) ICE(PC:1592495604393000 (id=10737418245 url=http://localhost:50000/)): peer (PC:1592495604393000 (id=10737418245 url=http://localhost:50000/):default) has no stream matching stream PC:1592495604393000 (id=10737418245 url=http://localhost:50000/) transport-id=transport_0 - 7c8b47d9:29b40645b4237d2ffef340f6307a0b4c

  • I just checked the browser console log and saw this error message:

    "WebRTC: ICE failed, add a TURN server and see about:webrtc for more details".

    Hopefully it's helpful someway.