Change string into numeric variable
Jul 26, 2019
I have a test activity with 100 text variables (Q1-Q100) that are in fact numbers yet I needed string variables to use them in a printable report. Now, however, it turned out that it would be quite useful to add those numbers, but it is not possible as they are all string variables. I tried to use the code:
var text = player.GetVar("Q1");
var number = integer.parse(text);
to convert strings into numbers and save them as number variables (N1-N100) yet without success. Is there any working way of making it work, to convert that big number of variables and add them together using JS? I will be grateful for any help.