Ashley's Forum Posts

  • I'm not clear what you're doing now, your original example used a string of the filename but your reply suggests you're not doing that now. If you are successfully loading the first file, then I guess just do that for a different file for the next layout?

    tokenat isn't really suitable for large amounts of data, I'd advise using a more structured data format like JSON.

  • It looks like you're using an expression like tokenat("file_1.Text", 0, "|"). This looks wrong because it only makes sense to use tokenat if the string actually has the separater character in it. "file_1.Text" has no "|" characters in it, so it won't do anything useful.

    I would guess you intended to load the contents of the file, not pass the name of the file.

  • getImagePixelData() is an async function. See this guide on async/await.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Note if you use scripting to call a function by a string of its name, it will break if you rename the function. With function maps, it keeps working even if you rename the function.

  • Whatever you do when an hour has gone by, just do it repeatedly when the app resumes, depending on how many hours went by. A "Repeat" loop should do the trick.

  • Construct games require Android 5.0+, which puts a limit on how old the device can be. Last I checked this covered the vast majority of devices. Other than that, it depends on the game, and it's hard to make comparisons between devices from different manufacturers, so I don't think it's useful to name a minimum device.

  • You linked to the addon SDK documentation, which does not apply to the scripting feature of Construct. That's documented in the scripting section of the Construct manual.

    You can test for preview mode by seeing if the location's origin is preview.construct.net.

    If worker mode is a problem, the easiest thing to do is turn it off. In recent releases of Construct, it defaults to a new "Auto" mode that automatically turns it off if you use any scripts.

  • Oh, I see. I guess that's trickier. Still, I think your attitude to deprecated features should be to not even consider them. If they do end up getting removed in future, then you're creating a new problem for yourself by using them. "Deprecated" does mean "on a path to removal".

  • I'm suggesting to do it the other way round: instead of having a main function that then calls in to a layout-specific function at the end, have layout-specific functions that start by calling the common function. Then you shouldn't need any call-by-string feature at all.

  • Currently Cordova plugins are only included if a Construct addon requests it. The whitelist is designed for Construct plugins like a third-party ad service to include the Cordova plugin that handles the ads, and then the Construct plugin's actions can call the Cordova plugin.

    You could call a Cordova plugin directly from scripting, but currently there's no way to ask the build service to add the Cordova plugin you want unless you make a Construct addon. I guess adding Cordova plugins manually could be an interesting feature. One additional difficulty though is testing is quite tricky: you can only test Cordova code once it's built as an APK, and if it doesn't work you need to set up USB debugging to check what's going on. When you use an addon, the addon developer did all that work to test it and make sure it works, so generally you can trust that it'll just work. If you write your own code you'll have to go through that process yourself.

    You could experiment with this anyway without using the build service, by setting up your own local builds with the Cordova CLI, manually adding a new Cordova plugin to config.xml after export, and then building it, after which your JS code can then call the Cordova plugin. It's a pretty complicated process to go through though, especially if you're new to coding.

  • You should avoid background work at all costs - it will kill the battery life.

    I don't see why you can't just look at the timestamp when waking up, see 10 hours have passed, and then do the same thing as if 10 hours had just passed. For example if every hour you pick a random weather type, when the app wakes up after 10 hours, pick a random weather type 10 times.

  • Most problems we have with Construct on iOS turn out to be Safari bugs or quirks. It's a really difficult browser to work with and is probably the least reliable and up-to-date of all modern browsers. Apple don't really seem to care about web apps that much, so we end up with problems like their third-party tracking prevention blocking the ability for C3 to remember your login, and system gestures making the side panes difficult to swipe in. If you have problems you can file issues for them, but we can't always work around the limitations of Safari. AFAIK, it works a lot better on Android, Windows, or Chrome/Firefox on Mac.

  • The only amazing thing C2 has that C3 hasn't is a completely open source, unminified runtime

    I have to emphasise: the C2 runtime is not open source. The license does not permit anybody to fork/modify/redistribute it, like you can with open source projects. Also the fact you can view the code is a source of great regret to me, since it resulted in appalling compatibility problems, leaving us with nightmare support problems with angry users who came to us when things stopped working. I'm glad we've largely managed to avoid the same result in C3.

  • pirx - in that example you have declared two entirely different functions, but used scopes to make sure their names don't overlap. The equivalent in Construct is two separate functions with different names.

    Another approach would be to have unique functions on every layout, which themselves call a "common" core function for the parts that are the same. That's probably a simpler way to do it, actually.

    I would strongly advise to find a way to do this with the new functions feature. There should be a reasonable way to do it without having to rely on weird behaviors of old features.

  • I believe it's a bug in Google's ad library. I'm following it up with them at the moment.