WackyToaster's Forum Posts

  • I've never used the API myself so I can't really show any example. And making an example would mean a lot of reading and trying etc... so I'd put that task on you.

    Scour the manual for AJAX construct.net/en/make-games/manuals/construct-3/plugin-reference/ajax

    The rough outline will be

    1. Send an AJAX GET (request URL) request to the API with the correct keys/userid etc.

    2. Load the response into a JSON object (parse AJAX.lastData)

    3. Validate it. If it only contains "errors": ["invalid download key"] or similar you know the user does not own the game

    There's also this itch.io/api/1/KEY/game/GAME_ID/purchases which probably is useful for your case since it requests to check a users purchases and you can verify it includes your game/dlc/extra download.

    Note that you have to replace certain parts of the API urls with your data

    itch.io/api/1/KEY/game/GAME_ID/purchases

    KEY = API key you can generate somewhere in your profile

    GAME_ID is the game id you can get from a different API call (or maybe somewhere from your page too? Not sure)

    Just try around and if you cannot figure something out you can always come ask again. But I do recommend banging your head against it at least a little bit, it's a good learning experience.

  • Yeah I've tried it myself and it happens every time. It does sound somewhat unintended but then again the objects technically do get destroyed when the layout changes so yeah.

  • There's also the platform info plugin which could help here. That's what I'm using, although it does warn that it is not a surefire way.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/platform-info

    But pair that with an additional check like so (that's the scirra recommended method)

    editor.construct.net

    And it should probably cover like 99% of the cases.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The more involved solution would be to use the itch.io api.

    itch.io/docs/api/serverside

    Specifically

    itch.io/api/1/KEY/game/GAME_ID/download_keys

    You can use this API call to verify that someone has a valid download key to download the game.

    I don't think it needs any 3rd party addons. You can just send AJAX requests and validate the results.

  • Not much different. You just don't put the odds as a global variable and instead use an instance variable that you then compare/subtract from/...

  • Not quite. Try it like this. Odds start out at 100% so the first click will always result in success. After 10 clicks the odds are at 0% so a click will always result in failure.

    Think of it like a dice roll. You need a 6 which means the odds are at ~16.67%. You roll the dice, if it lands on 6 it's success (1) if it lands on anything else it's fail (0)

  • Interesting, I've never noticed this.

    How exactly do you call for the layout transition? If it's also within js, it should be easy to do by removing the event listener before transitioning. Or worst case, briefly muting all audio.

    But it is a little bit odd that the object destroyed triggers when the layout changes, although it also makes sense in a way.

  • Yeah, although in this case it has little to do with a timeline. I'd prefer it if it was not tied to the whole animation editor stuff and would just be an object in the layout instead, but that's a different story.

  • Check this out

    editor.construct.net

  • I have to admit that doesn't say much, and the js files are obfuscated of course. Does it not say anything else before or after this?

    Also maybe try emptying browser cache if you haven't already, sometimes that causes weird issues.

    And also what you can try: Since you can open the project in an older version, try deleting larger chunks of the project (make a backup!) and see if any of that fixes the problem. You might be able to narrow down a certain resource or folder that is causing the issue.

  • Put the odds in a variable that you decrease every click.

  • Again, the results always come out as 0 or 1 when the variable is set to Random(100)<50

    That is exactly how it's supposed to work.

    Also how can you set something as true or false when the variable isn't a Boolean?

    A boolean is in essence just a 1 (true) or 0 (false).

    Your code is wrong because you already do the comparison in random(100)<50

    And then compare the result of the comparison again with <50. Either you do

    Set Odds to random(100)

    Odds <50 / Odds >50

    OR

    Set Odds to random(100)<50

    Odds = 0 / else

  • This is an evaluation

    Basically it means "Is the value generated by random(100) less than 50?" and it's either true (1) or false (0).

  • Exactly, you have to pass a timestamp into the function. This also allows you to get a month from the past or the future if you pass a timestamp into it that's not the current time.

  • I don't think you should be using Browser.ExecJS to do this. Instead use the date plugin

    construct.net/en/make-games/manuals/construct-3/plugin-reference/date

    Which has this

    GetMonth(timeStamp)

    Extract the month (0 - 11) from the provided timestamp in local time.

    So April would return 3 and all you have to do is add one

    GetMonth(timeStamp)+1