Yeah, you necroforophile.
That's indeed a very old corpse you digged here. These days I tend to avoid such process. Because the string is usually tedious to make, so tedious to maintain and also the events to parse it are tedious to write. Not complex, but tedious.
These days I just use my JSON plugin
I find it clearer, easier to use and more versatile. Though I would still use the Array plugin for simple flat list and the Dictionary plugin for simple list of key-value pair.
I use the JSON plugin when I want to load more complex datastructure and when I want to have something easy to read/maintain.
For example I could have an array of monsters like this
][/code:17skam44] in a JSON and easily spawn them at random.
Anyway, to answer your question, tokenat allows you to access a part of a string considering a specific character as a separator.
For example, if you have a string like[code:17skam44]"apple, banana, pear, cherry"[/code:17skam44]if you do[code:17skam44]tokenat("apple, banana, pear, cherry", 2, ",")[/code:17skam44]You split the string into parts (tokens) using the coma as a separator, and you get the part of index 2 (counting from 0). So it returns "pear".[code:17skam44]0: "apple"
tokenCount on the other end gives you how many token you have in a string, using the given separtor[code:17skam44]tokenCount("apple, banana, pear, cherry", ",")[/code:17skam44]returns 4
So using a clever loop you can easily fill an array[code:17skam44]-> Array: set size (0,1,1)
+ repeat tokenCount("apple, banana, pear, cherry", ",")
-> Array: push tokenat("apple, banana, pear, cherry", loopindex, ",") to back[/code:17skam44]