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 am not sure about my translation [number value?] but what i mean is for example picking 6 from 657, not 600.
i hope my explanation is clear.
thanks in advance.
what's your native language?
California , Why ask that ?
To pick 6 from 657
it just takes some math ...
Here we go
You can remplace 657 by any other 3 numbers number !
to know if something got lost in translation and help him in his own language.
thanks Whiteclaws :)
but does it solve the problem for 5 in 657, or for 7?
how can i eliminate tens or hundreds?
by subtracting them? 657 - 600 = 57, 657 - 650 = 7
You could also put the numbers into a string, str(657) then pick the letter based on its position, and convert it back into a number int(mid(1,1)) would return 6.
Develop games in your browser. Powerful, performant & highly capable.
the numbers will not be predetermined. so, for substraction i think i must add another floor function etc.
or use your string solution :)
i've taken Ethan's advice and used zeropad expression too and this one below solved my problem:
int(right(str(zeropad(GLOBAL NUMBER, 3)),1))
i used "left" and "mid" too of course.
Why don't you convert the number to string and use mid(Text, Index, Length) to pull the current value.
Number = 657
mid(str(Number), 0, 1) would give you 6
mid(str(Number), 1, 1) would give you 5
mid(str(Number), 2, 1) would give you 7
you are right. i didn't know that. but zeropad is still necessary i think.
Think a bit , what would give us 600 ?
Then you just do
And you get the 5
Then you do
And you get
Math solves everything , just think a bit !
Yes you are right too. Maybe thinking of simpler solutions is better than searching a magic wand (like an expression which can give me exactly what i want, i couldn't find one anyway :) ).
thanks all of you again.