replace token?

For questions about using Classic.

Post » Mon Sep 12, 2011 4:05 pm

Seems you can only access tokens in text, but you can't change them. For instance I might want to change the 5th token in a string "0,3,1,6,34,21,0,0,etc."

Is there a way to do it?
B
143
S
72
G
19
Posts: 1,777
Reputation: 21,702

Post » Mon Sep 12, 2011 5:38 pm

Maybe pull all the values into an array, change the one you'd like and store them back in the string.
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
111
S
38
G
17
Posts: 2,175
Reputation: 19,045

Post » Tue Sep 13, 2011 12:53 am

Thanks I guess thats the only way it can be done.
B
143
S
72
G
19
Posts: 1,777
Reputation: 21,702

Post » Tue Sep 13, 2011 4:17 am

[QUOTE=alspal] Thanks I guess thats the only way it can be done.[/QUOTE]

It's not the only way, if you want to do it in a single action (and have a set amount of tokens in the string), you can use this inefficient method:

Text = GetToken(text, 1, seperator) + ... + "NewItem" + seperator + GetToken(text, 6, seperator) + ...
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
111
S
38
G
17
Posts: 2,175
Reputation: 19,045


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest