Cannot get Variables out of Storyline

Hi guys,

Now I know Articulate does not support Javascript stuff but perhaps some in the community can help me.  I am trying to build a mulitplayer game and so I want to read the game scores from outside the game.  Basically I want to embed the game into a type of Dashboard and get the game scores out so that I can list the scores from the players on the top of the dashboard.  

I cannot get the player.GetVar method to work.

Can anyone tell me what method they are using to get the scores or variables out of storyline.




5 Replies
Ashley Terwilliger

Hi Kris,

It looks like Matthew has you covered here with the best practices, and I did want to point out that you'll want to test it by uploading it into the intended environment as testing it locally could cause you to encounter security restrictions as detailed here. There are a few testing server options in that thread which you may also want to take a look at using. 

kris steven

Here is the code Matt:

$(document).ready(function () {

var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var dateString = month + "/" + day + "/" + year
var player = GetPlayer();
var player = GetPlayer();
alert("Welcome back, " + player.GetVar("FirstName") + ".");

var result = onBWEvent("BW_result","");
var result = ContentResults();



Remember this is being run outside storyline to pull info from storyline.

And its not working.





Matthew Bibby

Hi Kris,

This code seems to work okay (at least as far as the alert goes). I added it to an Execute JavaScript trigger and it worked as expected.

I'm not sure about the onBWEvent side of things, but I suspect you might be missing some some detail from that code (hard to say without understanding what it is exactly that you are trying to do). You may find this thread helpful.

I'm far from an expert when it comes to JavaScript, so I may have missed something obvious... Hopefully someone else can help out further with this.