For each tokenat()

Get help using Construct 2

Post » Thu Jul 11, 2013 8:55 pm

Hi,

Any idea how I could do for each tokenat() loop? Or in other words how to count a number of items in tokens?

Thanks! megatronx2013-07-11 20:55:41
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
77
S
21
G
19
Posts: 1,932
Reputation: 17,291

Post » Thu Jul 11, 2013 9:01 pm

For 0 to Tokencount("1|2|3","|")-1
and loopindex returns the tokencount

You can retrieve the string data as

For 0 to TokenCount("1|2|3","|")-1
Array | Set at(LoopIndex) to Tokenat("1|2|3",loopindex,"|")

the -1 is because tokenat is 0-based but tokencount isn't

Cheers !
Whiteclaws2013-07-11 21:03:36
B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436

Post » Thu Jul 11, 2013 9:03 pm

Cheers for that!
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
77
S
21
G
19
Posts: 1,932
Reputation: 17,291


Return to How do I....?

Who is online

Users browsing this forum: alajajm, FabianB, imhotep22, Yahoo [Bot] and 9 guests