Storyline not seeing a numerical variable as numerical

Nov 01, 2021

Setting the  number of attempts a user has for drag and drops does not seem to work if the base slide is set to "Reset to initial state." That basically makes sense. So I created a numerical variable called "Try". As you can see in this course, the variable is set to increase by one each time the user selects the "try again" button. I displayed the variable so I could see what is happening. It is telling me that the variable is NAN. And, therefore, does not count the attempts to go to Incorrect layer after three attempts have been made. I don't know why it does not see "try" as a numerical value. Can you help me?

6 Replies
Walt Hamilton

Something went awry with the creation of your variable. When I deleted it, and recreated it, it worked.

There is a bug in the logic. The test to see if there have been three tries happens before the variable Try is incremented. So it considers the first try to be Try 0, and doesn't show the incorrect layer until try four.

Joseph Francis

2 interesting things:

  1. If I set the initial value of Try to 1, I can proceed through the interaction, incrementing with each incorrect attempt as expected
  2. If I insert a slide ahead of the interaction and set the value of Try to 0 there, I can proceed through the interaction, incrementing with each incorrect attempt as expected

Curiously, I had something similar happen, where I was declaring an array in Javascript (initially populated with comma-delimited zeroes, which corresponded to variables within Storyline which have 0 as their initial values). With each round-trip through the LMS, more of the numeric variables would get flipped to NaN, until all eventually return as NaN.

Does Articulate not understand that zero IS a number?