How do I Break Up a String and Place Them Into an Array

Get help using Construct 2

Post » Mon Feb 01, 2016 4:27 pm

Ok So i have seen Arcade Eds tutorials about ten or more times and when I try to use make a top score board using local storage ( to save and retrieve the data), a global string, and Arrays. Its not working. I boiled it down to the problem that I cant get tokenat to work properly.

I thought i used tokenat to break up the string and i PUSHED the broken up string into the Array, but when im in the debugger the numbers from the string arent showing up. I dont know what im doing wrong at this point please help.

I'll post CAPX at request but if anybody can give a crash course on how to use tokenat corretly or another way to break up a String please let me know. Thank you
B
6
S
1
Posts: 46
Reputation: 476

Post » Mon Feb 01, 2016 4:47 pm

You could just save your array with the array.asjson expression and in the next session load it back in via load from json action.

example results of using tokenat:

tokenat("a;b;c", 0, ";") = "a"
tokenat("a;b;c", 1, ";") = "b"
tokenat("a;b;c", 2, ";") = "c"

You should be able to deduct what's happening ^^.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Tue Feb 02, 2016 3:51 am

Thank you I understand tokenat and it work, and i figured out the problem. The problem was i didn't initialize the array properly. :) After reading your post and initialize the array everything worked without a problem.

NOTE TO NOOBS When you create your array and you only want to use a 1-D array, you still need to have 1 in the Y and Z...or at least the 1 in the Y
B
6
S
1
Posts: 46
Reputation: 476


Return to How do I....?

Who is online

Users browsing this forum: Fradno, MathNook and 35 guests