Why i can't load data from this array to another array?

0 favourites
  • 15 posts
From the Asset Store
DATA+ (Addon Pack)
$18 USD
20% off
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • I'm making some kind of music sequencer app and everything worked well so far. Sequencing and playing audio files works great, but now i want to implement saving sequence and loading it. I saved my initial beats inside array, that is loading on the beginning of layout - it's loading name of beat and JSON data for that beat. This JSON data is loaded into another array, that is storing current sequence. But for some reason this second array wont accept this JSON data. I have attached screenshots of relevant events, so if you have any idea, reply here <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> Thanks

    Preview for this app: http://www.djape.tk/games/sequencer/

    (this preview is not using loading function, that i mentioned above)

    EDIT: Let me just add this. Beat loading worked when Change Beat function was comparing Parameter 0, and if value is 2, then Four on the Floor beat was loaded, if value was 3, then Drum'n'Bass beat was loaded, etc. I think that problem is only with the loading from one to another array.

  • Any thoughts?

  • Be sure NOT to include double double-quotes inside your array. A double double-quotes is simply a way to tell the expression editor that you want an actual double-quote in a string. If it's included in your JSON, it will render it unusable by the parser.

  • And now can i check that?

    EDIT: JSON strings used in load-beats function

    https://pastebin.com/VKW4S4mx

  • You have them included. The inner JSON should not have 4 double quotes on them, only two, much like the first part.

  • I can't figure out what i'm doing wrong in this JSON string. Can you show me what i'm doing wrong?

  • To put it simply, just replace every occurence of \""\"" by \"". Now, all your inner JSON will be properly formatted.

  • Changed, this is how it looks now, but it's not working

    https://pastebin.com/CRWx0dJw

  • Oops, another case of redundant double quotes is still wreaking havoc, the one around each inner JSON. The opening one ""\"" and the closing one \"""". Replace occurences of both by "" and you should be golden.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is how it looks now and it's not working again <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> I guess you can't store JSON string inside JSON string

    https://pastebin.com/4uXYHWUw

  • You probably butchered something along the way cause I tested it to be sure I wasn't saying nonsense. <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz">

    Here's the correct version : https://pastebin.com/ZRLgKdzg

  • Unless I am mistaken....your main problem is that you are trying to load 3 or 4 arrays all into the same array at the same time.

    each time you see "{""c2array"":true,""size"":[X, Y,Z ],""data"":[[[datablablabla....... that is the start of a new array you should only see this once at the start of your json text string.

  • Yeah, i'm trying to load different sequences (arrays) as JSON into one array. I managed to do this with Dictionary, i guess i can't use array for this.

  • That's what he's trying to do. His array contains multiples arrays stored as JSON. The problem is getting the correct inline string that the expression editor will understand. My pastebin is the proper way to do it. You can load a first array with the litteral string, then load a second array doing something like "Load from JSON string FirstArray.At(2,1)"

  • Magistross

    You can do that !!! I didn't know. Wow....

    and that would be exactly what you need to make a music sequencer .....

    damn I wish I knew that before it might have saved me a few complications in my game......

    I need to go away and look at your pastebin...

    cheers...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)