Storyline Variables and SCORM
Oct 22, 2012
By
Sam Carter
Is there an interface API in Storyline which might allow populating a Storyline variable with a value stored in JavaScript? My particular example would be retrieving any of the: [Student name, Lesson Status] from the SCORM LMS and making it available to the course automatically.
I am OK writing the SCORM JavaScript to retrieve the values into a known global variable. What I lack is a mechanism in Storyline to retrieve those values and insert in a Storyline variable.
54 Replies
Hi Sam,
Please have a look at this post : http://community.articulate.com/forums/t/15117.aspx
Something in the form of player.SetVar("StorylineVar", JSVar); is likely the answer to your question.
Hope it helps,
Alex
Is this something you are suggesting, or something that exists?
Alex is right that is likely the best route to go
see best practices here http://www.articulate.com/support/kb_article.php?product=st1&id=llwes8cn32vg
If you want the student name then try this
var player = GetPlayer();
var myName = lmsAPI.GetStudentName();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
//myName = player.GetVar('myName');
//player.SetVar("newName", newName);
Ignore the last two lines didnt realsied i copied them
OK and thanks. This is great news. My next thought is how can this capability be extended so it doesn't require hand-editing the html every time the course is published. I publish a course on an average of 10-20 times before it meets final approval, so every hand-edit is multiplied.
Here's a suggestion: Could Storyline "attach" a JavaScript the same way it AP attached external documents?
Sam., you can add javascript triggers in Storyline so you would not need to edit your html.
The code I have above is in a timeline start trigger on the first slide, this way I can pull the name in at the start of the course and use it throughout
Unless I am missing something regarding your requirements, setting a Script to run once (e.g slide 1 only) to retrieve and pass these values on a storyline variable, would achieve what you want. You should be able to do this within storyline, without the need to edit/change any HTML files.
Hope this helps,
Alex
Awwwwwwesome!
I am experienced in JavaScript and SCORM programming, but calls like lmsAPI.GetStudentName are proprietary to Storyline.
Is there an online document that describes all the Storyline SCORM function calls?
I also would like to find a list of all lmsAPI functions.
That isn't proprietary
Look at the LMSAPI.js file in the LMS subfolder. You'll see a list of eval functions. You should be able to, for example, use lmsAPI.GetStudentName() to grab the student's name. It'll be formatted funny but you should be able to arrange that
HI
Is there some API instruction to get and set data to the suspend_data in LMS?
What i'm trying to do is store some kind of array like "true,false,true,false", on item for slide to recover that when the course begin and change with these value the item of a menu to visited or completed... i don't know how to do that in another easy way...
I can write comments with lmsAPI.WriteComment but i can recover the info in it with lmsAPI.GetComments... something wrong i'm doing?
var myName = lmsAPI.GetComments();
var array = myName.split(',');
var newName = array[1] + ' ' + array[0];
player.SetVar("newName", newName);
alert("nombre 1 "+ newName);
player.SetVar("nombre", newName);
this post could help too:
http://community.articulate.com/forums/p/16356/130249.aspx#130249
Hi, Jaunjo -
I'm still not completely clear on what you're trying to do. The stuff you're talking about:
- Course location
- Visited slides
- Variables you add
Are all automatically pushed and pulled from suspend data. It's not in a clean, readable array, but it's there. I think trying to override that is going to cause more pain than it solves.
I'm sorry i can't explain :(
Let's see more graphic...
I have a menu of five items with five icons. every icon has red,yellow and green states
Enter a slide will write in suspend data a false in the position of the slide:
Finishing a slide will write a true in the position of the slide:
false,,,,
true,,,,
true,false,,,
true,true,,,
true,true,false,,
true,true,true,,
true,true,true,,false
true,true,true,,true
true,true,true,false,true
true,true,true,true,true --> all slides done and this is the array stored in the suspend data
Every time the course starts, i read that array and with these values i can change the color of the icon
none = red
false = yellow
green = true
The problem with the actual array is that i can read it or i don't know
And the most important, our client wants to have the suspend_data in this way (i don't know why maybe for their saba lms or whatever) and the sad is that i can't do test with the client. The monday there is a meeting and we have to say that we are able to addapt a system that works fine and can export html5 for their ipads.
Storyline was my hope but it seems not if i can solve this :(
Think you have over engineered this not sure why you need to do this
Everything you have described can be done in Storyline without JavaScript.
No?
Yes, and i know how to do this within the course but my problem is to keep this when the student closed the course. Where i can store variables in the LMS to recover later and how... some function, something? Can you post and little example. I post what i doing in that file.
I would say the simplest answer is to force it in as a question answer, if you mess with the suspend data you are going to cause all sorts of problems
Ok... everybody is tell me that i would not do that so may be i'm a little fool and obsesed with client specification.
Thanks for help and patience. I'll make a test course and let's what happens... hope i will not fool you again.
I really love this software.
Any variables you set are automatically retained in suspend data. So take this instance, for example:
1 - I create true / false variables called section1, section2, and section3 and default them to false
2 - at the end of section1, I use a trigger to set section1 to true. Same with the other 2 sections.
3 - on my menu page, I setup three triggers. When the timeline starts, set objectSection1 (a shape I made) to state "done" (a state I made within the shape) if section1==true.
4 - I make a copy of the shape and the trigger and change the respective variables and object targets.
Now when I push this to the LMS, it'll remember the variable settings and give me the appropriate visual cue.
Thanks so much to all! I've a resume, the states of the icons shows ok. This soft is wonderful!
Steve, thats excatly what i do
When i test in preview or in Chrome or in Reload Scorm Player, it works fine. In moodle there is a lot of issues...
What kind of issues are you running into on Moodle?