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
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

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! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue Sep 13, 2011 12:53 am

Thanks I guess thats the only way it can be done.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

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! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: GameOverBeast and 1 guest