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
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

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
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

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
89
S
30
G
22
Posts: 1,985
Reputation: 20,099


Return to How do I....?

Who is online

Users browsing this forum: rayolf and 8 guests