Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
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.
Okay, but is it possible to convert string("money") into value of this variable(123)?
Develop games in your browser. Powerful, performant & highly capable.
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