pokeapache's Forum Posts

  • 3 posts
  • Thanks for putting in the effort for that example, but... that's pretty much what we were already doing, just loading it with AJAX rather than putting in the JSON manually. And yeah, we've seen the tokenat() method, but that's still not exactly great. The hope was for a way to just initialize an array with some values with something like an array literal in other languages (so, for example, something like

    myarray = [ "test", "more testing" ];[/code:8f6w8ssa], or the equivalent as a single construct2 action), rather than either inserting every value individually with a separate action (as recommended by the documentation) or having to use funky string-splitting (as recommended by the fora) or abusing the serialization/deserialization mechanism (what we ended up doing).
    
    So, thanks, but your solution is really not what we were looking for, and at this point we were more commenting that it's odd not to have a way to initialize an array with multiple values easily than looking for more help.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, so I got it to work with "Load from JSON string", but, why is it like this? You need DOUBLE QUOTES, like five hundred brackets??? I just. Thank you for the help, but this is absurd..

    ( for anyone looking for how to get as close to an array literal as you can get in this software:

    System -> On start of layout (or whatever proc you want)

    -> Array -> Load from JSON string "{""c2array"":true,""size"":[10,1,1],""data"":[[[""words""]],[[""words""]],[[""words""]],[[""magic""]],[[5]],[[""numbers work okay without quotes""]],[[1]],[[2]],[[3]],[[4]]]}"

    Seriously though, why does it have all these unnecessary complications? Anyway, you can populate an array like this, if you do the quotes and brackets right, just make sure you do it just so, it'll yell at you if you don't, or just not work.

    I still haven't figured out how to load an actual file into the array, but that's fine, this works. It's all in one place which is good enough.

    But yeah, thanks, got it working without having to manually add individual values to the array and save and load and save and load and such. Cheers!

  • Hey guys,

    Is there a way to either load a string from a .txt (or other file format) into an array, without having to insert a bunch of events at start up?

    Basically, can I load multiple values for an array at once, preferably through a file or just one input? The array won't change at all during the game, so it would just be static so I can pull the values from it later in the game.

    (I've tried using the "Load" function for the array, but it either doesn't work or yells at me for syntax errors, so...)

    Any help would be appreciated, thanks! (:

  • 3 posts