Storyline display a javascript variable May 31, 2017 By Rex Rekstad Is it possible to display a javascript variable? I've tried %variable% with no luck. thanks, Rex
Robert Barefoot almost 7 years ago05/31/17 at 4:15 pm (UTC) Yup. Are you setting the variable first though?
Walt Hamilton Hero almost 7 years ago05/31/17 at 6:19 pm (UTC) No, you can't display a javascript variable in SL. You must have JS pass the value to a SL variable that already exists, then you can use %varaiable%.
Rex Rekstad Author almost 7 years ago05/31/17 at 7:11 pm (UTC) thanks, I've been trying setVar(javaVariable, storylineVar); then doing %storylineVar% but no luck yet.
Rex Rekstad Author almost 7 years ago05/31/17 at 7:30 pm (UTC) oops, I meant more like this: setVar("storylineVar", javaVariable); %storylineVar% I only get the default value for the storylineVar displayed.
Rex Rekstad Author almost 7 years ago05/31/17 at 7:43 pm (UTC) Here is what I forgot: var player = GetPlayer();
Walt Hamilton Hero almost 7 years ago05/31/17 at 9:01 pm (UTC) Publish this, enter text and click "How long is it?" Or here's a variation that is independent of any SL variable (tweetLength is a text variable). var player = GetPlayer(); var Tweet="Cows and horses";player.SetVar("tweetLength",Tweet); Untitled1WH.story
6 Replies
Yup. Are you setting the variable first though?
No, you can't display a javascript variable in SL. You must have JS pass the value to a SL variable that already exists, then you can use %varaiable%.
thanks, I've been trying setVar(javaVariable, storylineVar); then doing %storylineVar% but no luck yet.
oops, I meant more like this: setVar("storylineVar", javaVariable);
%storylineVar%
I only get the default value for the storylineVar displayed.
Here is what I forgot: var player = GetPlayer();
Publish this, enter text and click "How long is it?"
Or here's a variation that is independent of any SL variable (tweetLength is a text variable).
var player = GetPlayer();
var Tweet="Cows and horses";
player.SetVar("tweetLength",Tweet);
This discussion is closed. You can start a new discussion or contact Articulate Support.