Assessing system variable using Javascript

May 10, 2018

Hi there,

I came across this article recently. And I can't get functions such as GetPlayer() or SetVar() work for my project.

Just wondering if anyone else are experiencing the same problem, or it was just me.

Thanks

7 Replies
Ashley Terwilliger-Pollard

Hi Ken,

What version of Storyline are you using? With Storyline 3 and Storyline 360, there were changes we made to the player and how we handle the published output. Those updates caused some previous Javascript setups that individuals used in Storyline 2 to access play variables to no longer function. Since it was something that we didn't officially support, our team is looking into new ways to add this functionality back into a built-in option, but that's a bit farther down the road. 

I'll include your post here in the feature request we have filed with our team! 

Alison  L.
Ashley Terwilliger

out team is looking into new ways to add this functionality back into a built-in option,

So I stumbled on this post after another that talked about player.Set/GetVar (after I found a note from my Storyline RC8 notes!) It sounds like neither of these work anymore with the release of SL360 (et al).

However, this reply from Ashley is also from "over 1 year ago" so maybe something has happened since then to put GetVar/SetVar back into play? Maybe?

Thanks!  Alison

Alison  L.

Nope. In fact if you can point me in any direction that get's me info how to utilize SetVar and GetVar or how they work (i know where... I think (user.js?))... I dont suppose someone did a here is how they work page...or how someone is using them...?  I was just thinking that maybe this could maybe be where you could track an interaction since CMI5 may be getting used (for SCORM things) but there really isn't a way to use it say to TRACK interactions. And the LMS's .xls called quiz questions.csv get's the "question" column from wherever and the users answers is only correct or incorrect. So can't really use the idea of "use quiz things to track interactions on the lms" because my LMS doesn't pick up much, I don't know where to set the CMI to pick up things, no one else does either. (i got through this about semi-annually).,

So all that rambling just to say "how does GetVar SetVar" work?" I thought, Steve that might be too BROAD a question that you don't have time to get into (which is totally fine). But that's really what I'm looking for at this point. (And then hopefully share for others to find eventually)

 

Alison

Steve Flowers

Hmm... There's a mix of stuff in the question. Will tackle the using GetVar and SetVar first. 

These are generally employed in a Javascript trigger. All of your Javascript trigger additions will be added to the user.js file on publish. 

What do you want to be able to do with a Javascript trigger? The best answer will be tailored for the solution you're shooting for. To employ these in a basic way, start by creating a Javascript trigger.

Add this to the trigger contents:

var player=GetPlayer();
var myValue=player.GetVar("myStorylineVariable");
alert(myValue); //this will pop up a window containing the variable value from Storyline
player.SetVar("myStorylineVariable","NEW VALUE"); //this will set the storyline variable to NEW VALUE

 

The other part of your question seems to imply you're looking for a way to inject interaction values into the LMS? SCORM and CMI5 are different things. However, interactions can be submitted through the SCORM API using Javascript. Are you publishing to SCORM 1.2 or 2004? 

Alison  L.

Hey sir, so according to my LMS's SCORM Package Best Practices PDF:

 SCORM 2004 and 4th edition 

and yes. I was considering how to track interactions because my LMS take users, quiz questions, and "correct" or "incorrect" value called quiz_questions.csv, but whatever is doing this IN the LMS pulls the Quiz Question Text in no standard/discernible way. Plus it doesn't really help that if I am giving partial points for a partial-correct answer, that I can only see if the learner was "correct" or "incorrect" only.  

(whispers)- One of my ToDOs for DevLearn is visiting LMS vendors at the expo.

This discussion is closed. You can start a new discussion or contact Articulate Support.