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

Get help using Construct 2

Post » Mon May 08, 2017 11:22 pm

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 :D Thanks

Image

Image

Image

Image

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.
B
14
S
3
G
1
Posts: 93
Reputation: 1,011

Post » Tue May 09, 2017 4:33 pm

Any thoughts?
B
14
S
3
G
1
Posts: 93
Reputation: 1,011

Post » Tue May 09, 2017 5:27 pm

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.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Tue May 09, 2017 5:29 pm

And now can i check that?

EDIT: JSON strings used in load-beats function
https://pastebin.com/VKW4S4mx
B
14
S
3
G
1
Posts: 93
Reputation: 1,011

Post » Tue May 09, 2017 5:43 pm

You have them included. The inner JSON should not have 4 double quotes on them, only two, much like the first part.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Tue May 09, 2017 6:12 pm

I can't figure out what i'm doing wrong in this JSON string. Can you show me what i'm doing wrong?
B
14
S
3
G
1
Posts: 93
Reputation: 1,011

Post » Tue May 09, 2017 6:31 pm

To put it simply, just replace every occurence of \""\"" by \"". Now, all your inner JSON will be properly formatted.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Tue May 09, 2017 6:56 pm

Changed, this is how it looks now, but it's not working
https://pastebin.com/CRWx0dJw
B
14
S
3
G
1
Posts: 93
Reputation: 1,011

Post » Tue May 09, 2017 7:20 pm

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.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Tue May 09, 2017 7:27 pm

This is how it looks now and it's not working again :D I guess you can't store JSON string inside JSON string
https://pastebin.com/4uXYHWUw
B
14
S
3
G
1
Posts: 93
Reputation: 1,011

Next

Return to How do I....?

Who is online

Users browsing this forum: blissfulwizard, DevinMurray, wizdigitech and 16 guests