ArcadEd's Recent Forum Activity

  • another thing that confused me in the past was the Date.GetDay is day of the week (0-6)

    Date.GetDate is the day of the current month (1-31)

    so make sure you use GetDate, not GetDay

    Got it working thanks, it's actually pretty easy. The Date plugin uses Unix Epoch Time anyway, so it was just a matter of using some of built in expression.

    Like Date.ToDateString(timeStamp)

    I ended up not going with the 3 days ago, etc. Wasn't really needed and I think an actual date works better for my needs.

    Thanks for your help.

  • how do you need to format the date? I use the C3 Date plugin, and a function that takes a timestamp and a format string similar to what I use in PHP... no scripting or 3rd party addons required.

    https://www.rieperts.com/games/forum/FormatDate.c3p

    Using the moment library I can format into now like "A few seconds ago" or "3 days ago"

    Does the plugin do that?

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

ArcadEd's avatar

ArcadEd

Early Adopter

Member since 3 Jul, 2012

Twitter
ArcadEd has 7 followers

Connect with ArcadEd

Trophy Case

  • 13-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x10
    Coach One of your tutorials has over 1,000 readers
  • x2
    Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

22/44
How to earn trophies