Storyline True/False variable comparison
Dec 26, 2012
By
Sam Carter
UPDATE:
After further testing, I found that JavaScript setting a variable to "true" in Storyline ONLY FAILS IN HTML5. All is well in the flash versions. Simply put, a Storyline variable set "true" by JavaScript, e.g.,
GetPlayer().SetVar("MyTrue/FalseVar", true);
will NOT COMPARE EQUAL to True in Storyline when running HTML5.
For consistency's sake, I'll file a bug report. I know of no way to get a true result in HTML5 using JavaScript now. I have to resort to Numbers and ignore True/False variables.
Sam
15 Replies
Probably more oversight than a bug, would likely be caught during debugging and would be a Mistake I only made once.
needs fixing, I am using JavaScript less and less though because of browser inconsistencies.
I think we need to remember this is rapid elearning software the more we hack and rely on JavaScript the less it becomes rapid.
There is no JavaScript that I write that shouldn't already be there in Storyline. At the moment, the problem is that SL's HTML5 requires the student to click NEXT to play media. When desktops are set to autoplay, SL does the same for HTML5 unfortunately.
Workarounds must be written and yes, it [hacking] is a tar pit.
IOS 6 seems to be a nest of inconsistencies noticed today neiaon sites playing without me initiating it.
I spent years extending Articulate Studio using swfs and hacks, I have no inclination to do this in Storyline. If I cannot do it out of the box I make the client aware. Maybe I am getting old
BTW: I noticed Safari in IOS 6 does not require the student to click NEXT to play media (audio anyway). So autoplay works in IOS 6 now. I don't see anything official about this new behavior however. It may be a fluke.
Phil: what is a neiaon site?
I meant "media on sites", I cannot type on the iPad.
BTW: Where is the portal for submitting bug reports on a released version of Storyline?
Hey, Sam. Just submit a case with your bug: http://www.articulate.com/support/contact/submit.php
Hi,
I'm having the same problem. Is there any update on this issue?
Cheers
It's broken as far as I know. I avoid using True/False in Storyline and instead use numeric 0 and 1.
Sam
I've never published anything to html5, but decided to play around with it today and try a course on an iPad. The course I have uses variables to track which slides the learner has visited, and then the final slide won't let them take the quiz if they haven't reviewed certain slides (The quiz is actually just a fake quiz used to track if they reviewed the few slides out of many that would be required in order for the course to track as complete).
Anyway, the course worked great on the iPad except the final slide showed that I had not visited any of the slides. I signed into the course on a PC, and it accurately reflected what I had visited. I am using true/false variables to track this information.
Am I understanding right, that if I used numeric instead of true/false, this should work on the iPad?
This course was truly just a test, but I better figure this out now so I don't get myself into trouble in the future. Your input is much appreciated!
~Tessa
Hi all!
I'm not pretty sure if I understood right the original post, but I used a javascript to change a true/false variable, with this piece of code:
var player = GetPlayer();
player.SetVar ("tru/false var",4
and it works fine under html5... Of course, as we have a GetPlayer, it doesn't work under html...
But I found something else, it seems that lightboxes doesn't work under html5??? Does anyone ever had this case?
With HTML5, quotes are required ("true" rather than true).
GetPlayer().SetVar("varName",true); // does NOT work in HTML5 version.
GetPlayer().SetVar("varName","true"); // works in HTML5 version.
Here's another thing to watch out for with HTML5. Say you have a numeric variable in Storyline with default value 2.
The typeof operator in JavaScript will return "string" (when checking that var using GetVar).
BUT if you change the value of that variable from its default (with JavaScript or in Storyline) then typeof returns "number".
For me, that means I must use non strict == instead of strict === when checking equality of a numeric var from Storyline with a number in JavaScript.
An update to my post:
The issue is (partly) due to the fact that storyline isn't using true boolean values. True/False are presented as strings.
However changing the variable to 0/1 and adjusting the code accordingly doesn't fix the issue. Does the content part of pdfmake not support the use of if-statements?
Michael - did you get an answer to this ? I am doing something similar using pdfmake and only want variables to appear if their value is set to true in Storyline.