Copy link to clipboard
Copied
I am using captivate 9 to publish a html 5 scorm2004 course. I have a variable thats value is a space. When I run the course in scorm cloud and exit before complete, then when I return that variable value displays as zero. Does anyone know why this is happening and what I can do about it?
Thanks
Copy link to clipboard
Copied
I had a similar problem. I solved it as follows:
My variable was named "i" and its value was an empty space. Sometimes (when executing a JavaScript) the value changed to 1 (for some strange reason).
Then I just changed the name of the variable. The new name was "t" instead of "i" - and I never had this problem again! So just try a different name for the variable (maybe "t" works for you too...).
Try again whether it works! Good luck!
Copy link to clipboard
Copied
That's most likely because Captivate needs to loop through all of the suspend data string to repopulate variables and "I" is the variable used in the loop. Also the space character could be encoded as %20 and CP had a hard time parsing it back into your variable.
Bottom line, a variable with a single character used in someone else's code is not a good idea. And a space for a value is not a good idea either.
Copy link to clipboard
Copied
Thanks, your right - I think this is the reason!
To be precise, I did not really use a "space" as value for the variable but my variable was just "empty" (without any value). I used it to prevent Captivate from converting texts into pixel graphics. I think this is a standard use for variables without value. But naming the variable "i" was surely a mistake.
So thanks again for the explanation!
Copy link to clipboard
Copied
If you genuinely need to have the variable store a space (as in a blank space between two characters or letters) then assign the value of the variable with a non-breaking space character rather than just hitting the space bar.
You can insert one of these into a text caption using the Properties tab > Characters > Insert Character button, then copy / paste that character into the variable.
Copy link to clipboard
Copied
Thanks, I will try using character button like you said. I did find another work around, in the index page generated from captivate, I added javascript so that after captivate loads I set the value of my variable in captivate to " ". It seems to be working but hopefully did not introduce any other issues. This is what I added after the captivate initializes:
window.cpAPIInterface.setVariableValue("skl_displayRole"," ");
I actually have two variables in the captivate project, one had an empty value and one contained a space. Both were displayed in a text object in captivate and when I continued the lesson in Scorm Cloud both displayed as zero. This seems like a bug in Captivate to me.
Hopefully my work around of setting variable with js after captivate loads will work.