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
Our educational partners
Free education resources to use in the classroom
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 a resolution selector combobox. It has "640 x 480" etc. I use the text manipulator to seperate these numbers to change the resolution value, like so:
Set "reswidth" to:
TextManipulator.GetSubstring(" x ", 0)[/code:dkp3q52y]
It works, and the global variable is set to the correct number. But, even though it's set as a number variable, that number is actually a string. As such, none of my calculations using it work anymore.
In MMF you could change strings of numbers to numbers with "Val()" but I can't seem to find the equivalent here.
int() casts the value to an int.
Strings are also converted to values where necessary. For example, you can set an object's X co-ordinate to "500", and it works the same as passing the number 500.
hmm...typecasting,may I know what other variable type Construct supports?
Develop games in your browser. Powerful, performant & highly capable.
I'm having the same problem, I'm retrieving a value from a string however it doesn't recognize it as a value in the private variable.
edit: Yeah that int(string) seemed to make it work.
Float(value) casts to float
int(value) casts to int
str(value) casts to string