hi,
i'm loading a csv-file of xy-coordinates into a ListBox object to use a 'For each line' loop to spawn sprites at the specified positions. but ListBox.LineData() appears to return strings - or i suspect it to, because the results are always interpreted as 0 (zero) in the coordinate fields of the 'Create' action.
is there a counterpart to str(value) that can turn strings into values?
thanks for your time!
Develop games in your browser. Powerful, performant & highly capable.
Use 'int()'.
thanks!
two things:
off topic, but what is LineData supposed to return?
LineData only returns something if you set data for the line (using the Set Line Data action); this is useful for storing extra data on lines other than text. In this case you'll want to use LineText, which is automatically converted to an integer by the parser.
In all of Construct, passing a string to a number parameter automatically converts it, so you can pass either "500" or 500, it doesn't matter. As Rich pointed out, LineData does not give the text, LineText does
Nice and Nice!
I was actually adding a private variable to my text boxes to store additional information. I guess I didn't have to.