Using the Add operator for variables

I'm attempting to create a self-assessment on one slide within storyline that will tabulate at the bottom. I found an example and tried to mimic it, but i'm having trouble getting it to work. It will only add if I have at least 3 text variables filled in. If there are less than that, it gives an error "NaN." Any ideas?

3 Replies
Guido Roessling

Hi Bailey,

it seems that you need to explicitly initialise the variables (the "default value" does not seem to do the trick). Also, I recommend considering using for example a Slider (as in the sample file below) set to the scale 1..5. This way, you are assured that only the values 1, 2, 3, 4, 5 can be entered, whereas the textbox would also allow me to enter a -20 or 42, for example, without complaining, and other text ("Y", "N", whatever) that will cause a problem when Storyline tries to convert it to a numerical value. You can check this and for example "reset" the value to 0 if the input is lower than 1 or greater than five, but this takes some effort...

By the way, the "NaN" is old CS-lingo for "Not a Number" and indicates that some value was not numerical (the empty boxes). I have also added a "debug line" at the top that displays the values of the variables  (Q1-Q4, where Q4 is for the slider in front of item 4).

Two other comments:

  • I recommend that you consider splitting the page, or putting the questions on different layers of the same slide, so that users do not have to scroll down.
  • If scrolling is needed, it is worth considering if the button should not be outside the scrolling area, so that it (and the calculated sum) are always visible.

I hope that this helps (a bit).