[CS Bug] *input_number "10]"?


#1

@dfabulich @jasonstevanhill
Just wondered if anyone could confirm this as a bug, or whether it’s something I’ve managed to instigate…?
When using the *input_number command I seem to be able to enter things like “10]” or “10-” and it seems to allow it as a number but then if you try and do a calculation with the variable at a later date - it thinks it’s a string with the value you input (e.g. “10]”).

Looking at scene.js it seems as though the input is parsed into a numeric value, before testing if its a valid number and within the minimum and maximum values.

Despite the tests being run against this new numValue though, it’s the original ‘value’ that gets passed as the value to set the variable. Swapping it so that my line of code was self.setVar(variable, numValue) not self.setVar(variable, value) seems to have /avoided/ the issue. It allows me to enter stuff like “10]” but it parses the non-numeric values out correctly, so far.


#2

Good catch. This is fixed in the latest ChoiceScript. In addition to storing the parsed numValue, “10]” is now forbidden if integers are required; the parsed number must be a string match for the typed input.


#3

Well, that’s a relief.


#4

Good to know, thank you!