oosyrag's Forum Posts

  • Yes, if you intend on running said action that depends on or fetches data from the array as soon as possible after loading the array JSON data into memory.

    Practically though, no user should be able to click on something or do an action faster than your device can load the array on start of layout.

    If you want to be really proper about it, start with your buttons or user interface disabled, and add an action to enable them in that same event with on ajax finished and array loaded. This guarantees the user can't do anything until at least the array is ready. For automated tasks and functions, yes they should be called in that event as well, so they run whenver the data is available.

    Separate event sheets or includes has nothing to do with anything, you can do that or not, up to you.

    Edit: Event sheets don't store arrays...? You're definitely misunderstanding something.

  • Your JSON array is loaded into the array object in construct.

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

    You can manipulate the array directly with construct events and actions, as described in the manual. Using JS is giving you no advantage or anything you can't do directly with the array plugin in this case, besides making things more complicated.

  • Add the repeat 10 times condition to the touch trigger in the second event. That's all.

    Don't use gestures - they are less responsive, use on touched object.

    You don't need the stop loop action there. It does nothing - The actions don't run if the condition is not met. You only need stop loop to interrupt a loop. In this case you're repeating 10 times. Even is SetArrayRow_GV goes past 10, it will just keep repeating (doing nothing) until 10 times is up.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I do not understand your situation. Arrays are global. It doesn't matter what event sheet you refer to it from.

  • You should put that script right after the array load action in event 3, because that is when it will be available. Wait is not necessary. In the theoretical event the disk is under load and it takes more than 0.1 seconds for ajax to read the json, your event as written would also break, since the array would not have been loaded at that point 0.1 seconds after the layout starts. If you put the script in event 3, which is triggered by the data becoming available, it will always work because event 3 will run when the data is available.

  • Set bullet angle of motion to targetAngle + random(-1*coneoffire/2,coneoffire/2)

  • a reference error: My_Array is not defined

    You need to define your array in Javascript.

    You can have multiple instances of the same array object, so you have to specify which one. construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/object-interfaces/iinstance

    const JS_myArray = runtime.objects.My_Array.getFirstInstance();
    var valueAt00 = JS_myArray.getAt(0, 0);
    

    There are a bunch of JavaScript examples/tutorials built in, you should look through them.

    Also if you're a beginner, my recommendation is to never use the wait action, ever. It can be a shortcut for certain things when you know what you're doing, but it is never necessary and it can break or otherwise make your project behave outside your expectations in a hundred different ways. If you insist on using wait, just remember that it only delays actions, and does not stop or pause the event sheet from running.

  • If it's a code issue, you are probably your own best bet at identifying what went wrong, especially for a project years in the making.

    It's great that you had an older version of your project to check and compare against.

  • I still have no idea what your buttons are for.

    Why are you picking buttons? Buttons are usually for pressing/clicking. When you click a button it is automatically picked. An on touch or on click is already a trigger action and doesn't need trigger once.

    If you're using a single button object for multiple instances of buttons that are identified with instance variables or otherwise, and those buttons do different things, then yes you'll need a separate event for each buttons' actions.

    Also you have a wait for previous action to complete in there, which has no function without an asynchronous action before it. Which you don't, so you're probably misunderstanding something there. All actions are processed in order from top to bottom unless its specified as an asynchronous action.

  • You can usually start refactoring code/events by describing what you are trying to do in as few words as possible.

    For me at least, it's not entirely clear what your desired result is just from looking at the events, so it's difficult to give advice about how to make it more compact.

  • Here's how I would do it.

    dropbox.com/scl/fi/pxjel9inotzuymmdaq7em/idlenumbersexample.c3p

    An array (or other kind of table style data structure like .csv) for the labels makes it cleaner, more flexible, and more easily modifiable in my opinion.

    Of course with any system like this you're going to run out of labels eventually. You can use the letters in sequential order as I've seen many idle games go (a -> z -> aa -> az -> ba -> bz ect.), or use a gameplay reason (a wall) to force resets every once in a while like Idle Champions of the Forgotten Realms. Or you can just use proper scientific notation 10^n. It would be great if everyone used and learned the scientific notation style to display large numbers.

    Edit: There are still some potential improvements to be made, such as having a fallback display method after the number gets too large for defined labels, and zeropadding decimals. Perhaps also a variable to specify the number of significant figures desired.

  • Have you tried using an older version of C3 to see if the problem still persists?

    If the problem goes away in an older version, try to pinpoint the version it happened check the changelog for anything that might be related. Then you can narrow down the issue and file a bug report to get it fixed.

    If it still happens in an older version, it's more likely that it was due to a change you made recently in your code.

  • Hmm.... Good point.

    But for now with what we have, if I were doing bulk operations I would just use an untagged (or otherwise generic tag), and push the contents to an array as they complete. I don't know if they would be ordered, but there's no particularly explicit guarantee of order when choosing files anyway. If order were a consideration, I would implement sorting through the array based on content.

    The array size and file count can be compared to know when all files have been loaded into array, or throw an error of there was a mismatch somehow.

  • Oh, didn't see that. I also would not recommend using the csv plugin, it can be done with a simple array instead.

  • What exactly are you having trouble with? It will be unlikely anyone is going to put together the whole thing for you.

    So you've defined your states. Use an instance variable to keep track of the state.

    Then define the conditions under which you want to change the state.

    Then define the actions you want to take in each state.

    You should then have your AI basically complete. Make adjustments as needed if anything behaves outside expectations after testing. Ask if you can't figure out how to implement a specific thing to your liking.