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?
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.
Develop games in your browser. Powerful, performant & highly capable.
Float(value) casts to float
int(value) casts to int
str(value) casts to string