Cannot get Variables out of Storyline

Oct 29, 2015

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.

 

Thanks!

Kris

3 Replies
Ashley Terwilliger-Pollard

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();
console.log(player);
console.log(player.name);
console.log($(player).children());
player.SetVar("SystemDate",dateString);
console.log(player.SystemDate);
var player = GetPlayer();
alert("Welcome back, " + player.GetVar("FirstName") + ".");

var result = onBWEvent("BW_result","");
console.log(result);
var result = ContentResults();
console.log(result);


});

 

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

And its not working.

 

Thanks,

Kris

 

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