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
149
S
75
G
20
Posts: 1,791
Reputation: 22,695

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 Dropbox is a pile of trash and if you need my old files PM me! :)
B
121
S
42
G
17
Posts: 2,219
Reputation: 19,800

Post » Tue Sep 13, 2011 12:53 am

Thanks I guess thats the only way it can be done.
B
149
S
75
G
20
Posts: 1,791
Reputation: 22,695

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 Dropbox is a pile of trash and if you need my old files PM me! :)
B
121
S
42
G
17
Posts: 2,219
Reputation: 19,800


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests