ArcadEd's Forum Posts

  • The tutorial does that. The API file comes from PlayFab.

    I'm struggling with how you get access to the functions in the js file. I imported my js file and when I try to access the functions they don't seem to exist at runtime. Feel like I missed a step.

  • Then you should probably simply use the .then() function.

    postData(...).then(callbacks)

    See documentation here : developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then

    I am, I guess I didn't show my call.

    postData(runtime.globalVars.apiHSURL, {"address":runtime.globalVars.address} ).then(data => {

    console.log(data); // JSON data parsed by `data.json()` call

    });

    So will using the wait for previous action to complete work in this case?

  • I have a tutorial that does this:

    https://www.construct.net/en/tutorials/add-playfab-cloud-storage-2479

    Briefly, you add await to the call, and then a 'Wait for previous actions to complete' as the next event.

    You the man blackhornet

    Any tutorials on how to import a script and use function from it?

    I'm importing moment.js to display some unix timestamp code in a specific way.

    Anyway, thanks for the help.

  • Not sure if the await keyword is exactly what you want. Could you perhaps illustrate a bit more how you intend to use said function ?

    I'm calling this function in a script

    // Example POST method implementation:
    async function postData(url = '', data = {}) {
     // Default options are marked with *
     const response = await fetch(url, {
     method: 'POST', // *GET, POST, PUT, DELETE, etc.
     mode: 'cors', // no-cors, *cors, same-origin
     cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
     credentials: 'same-origin', // include, *same-origin, omit
     headers: {
     'Content-Type': 'application/json'
     // 'Content-Type': 'application/x-www-form-urlencoded',
     },
     redirect: 'follow', // manual, *follow, error
     referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
     body: JSON.stringify(data) // body data type must match "Content-Type" header
     });
     return response.json(); // parses JSON response into native JavaScript objects
    }
    

    However, I have code I want to execute after I know that has completed.

    The same as using AJAX to POST and tagging it. Then using that tag to check if it completed with the Ajax on completed action.

  • I am calling a function that is in a script file using a script. That all works.

    The function is an async function.

    My question is this:

    Does anyone have example of how to make sure that function call is completed before executing particular code? I've always just used the built in AJAX on completed event, but obviously I can't do that here but looking for the same fucntionality.

    Thank you,

  • You do not have permission to view this post

  • Great idea, thanks.

  • I am wanting to mirror/not mirror my enemy depending on which way they are moving along a path. Is there a built in action to do this and I'm just not finding it?

    Or do I have to code in something checking their x position based on a previous X position or something?

    Thanks.

  • .

    This will only work in a desktop game. In a browser game you don't need any of that, just use Browser Invoke Download CanvasSnapshot

    Thanks, yes it has to be a browser. Doesn't the invoke download just make chrome download the image file? I need it actually saved on the server side. No interaction with the user, in fact they won't even know this is happening.

  • Quickly what I want to do is this.

    Take a snapshot of the canvas.

    Set AJAX Response to BinaryData

    Request CanvasSnapshot

    The above is all shown in the taking a screenshot example. What I want to do is:

    Create a new folder in the project under Files called screenshots.

    Save CanvasSnapshot to the above folder.

    Thanks.

  • You need to contact the library developer about this. They need to make sure the library supports JavaScript Modules.

    This? web3js.readthedocs.io/en/v1.2.11/web3.html

    Ed

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Agree, especially right now with Crypto blowing up.

    Come on Ashley :)

  • I realize this post is rather old, but can you either of you walk through how you got this working?

    When I tried to follow this I get the same web3 error. I did double check the case.

    OK, I got it working pretty much. But I had to go into classic mode for script type. How do we get it working in module mode as classic will be removed at some point

  • excellent. Thanks Ashley.

  • New Info: If I switch the runtime to Construct 2, it minifies just fine.