Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I have global variables : money = 123 and STATS = "money|something|...|"
Now I want to load money from STATS with this : tokenat(STATS,0,"|"), question is how to convert "money" into 123?
from the manual:
Convert the float or text x to an integer (whole number). If x is text, non-numeric characters are allowed after the number, but not before. For example int("33xx") returns 33, but int("xx33") returns 0.
Develop games in your browser. Powerful, performant & highly capable.
Okay, but is it possible to convert string("money") into value of this variable(123)?
I guess using replace would be the expression to use:
replace(src, find, rep)
Find all occurrences of find in src and replace them with rep.
So that would be
system set Stats = replace(Stats, "money", str(money))
Solved, LittleStain thanks for your help
Instead of STATS = "money|something|...|", I created function which set STATS to money&"|"&something
then tokenat(STATS,0,"|") will work