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

0 favourites
  • 3 posts
From the Asset Store
Forgotten Place - Melodic ambiance, background music, Synth
  • 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

  • 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 ^^.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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