ArcadEd's Forum Posts

  • Hello everyone and how are you all doing? I have been pretty quiet on this forums for several years, but know I never stopped using Construct 2/3. It's still my go to engine for anything 2D. I've mostly been using it to make Board Game helper apps for the last several years (www.edfarias.com).

    Around March of this year I began to think of an NFT project and I wanted to base it around some of my passions, Arcade games and Arcade cabinets. arcaded.io project began and I wanted to share it real quick because it really shows off the power of Construct 3.

    The current website (blue one) is really a place holder while we get the final website built up, which should be coming soon.

    If you are not familiar with NFTs, they are digital assets with proof of ownership via the blockchain.

    Here is a quick video explaining how the project will work. youtube.com/watch

    The NFTs sort of act like a key to allow you to play the 5 games created for this project. Playing the games updates the high score table for your specific NFT (arcade cabinet). You can't play the games unless you own one of the NFTs for that game.

    The software engineer I hired created all the Smart Contracts and a back end that allows me to access them via API calls. It's really pretty slick. I am able to use JS code in Construct to make these API calls that call the smart contracts and make updates to the blockchain.

    The next thing we will be doing is implementing a stream game service (like stadia) to bypass any kind of cheating by injecting code during play.

    If you are interested in the project, I have a discord I started up. discord.gg/SuN4wpMq

    I hope to bring on other game developers in the future if this project grows like I hope it does.

    I'll try to update this thread as things develop. Right now we are working on the new website, getting ready to launch the Promotional Poster NFTs for each game and much more.

    Ashley and team, thanks again for making an amazing product.

  • Yeah, I am in a unique situation where that wouldn't work for me. I need to use Tokencount and the extra commas throw off the count. It's odd, but thanks for the tip!

    I could probably just subtract the amount based on the extra commas, but anyway. I got it working lol.

  • Seems like I always fix my issues after I post haha.

    I was able to use RegExReplace just "" for no flag. So it finds the first on the the string, which is exactly what I needed.

    In case someone comes across this questions at some point.

    RegexReplace (tmpString, "1", "", "") is what I used.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wasn't really sure how to word this in the subject, but basically here is my situation and I'm trying to figure out a work around without doing tons of steps :).

    I have a string for example tmpString = "1,2,3,4,5,6,7,10,11,12,21,101,102,202,1001"

    I want to remove the 1 from the string so I would use

    replace(tmpString, "1", "")

    This would result in the string now being (all the 1's are gone)

    ",2,3,4,5,6,7,8,9,0,,2,2,0,02,202,00"

    if I replace "1," The 101, would get changed to 10

    Same thing will happy when I want to replace 2. Etc.

    I hope that makes sense. Curious if anyone has a trick up their sleeve for this. I though about making it "01,02,03" But the string is being built from array and loop indexes.

    I'm not too familiar with Regex, so maybe there is something there I can use?

    Thanks.

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

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