How to Concatenate Variables with JavaScript

Here are the facts for the StoryLine project I am working on:

1) I have several variables that store a text value based on user actions.

       a) System

     +b) Region

     =c) System_Region

2) I want to set an additional variable that would be a concatenation of the other variable text strings.

& 3) I have very limited experience/knowledge of JavaScript.

Can anyone help?

7 Replies
Steve Flowers

So if you wanted to draw out 2 variables and pass the combination of those back into Storyline, here's one way to do that:

var player=GetPlayer();

var _region=player.GetVar("Region");

var _system=player.GetVar("System");

player.SetVar("System_Region",_system+"-"+_region);

This will pass the value of your region and system variables back into a Storyline variable. I added a dash in between. You could take this out if it's not necessary, provided your variables are strings.

Shannon Turner

Does anyone know of a way to create a list in javascript that formats the text like ul and li. I have my javascript concatenating and building a bulleted list; but the bullet text is long and does not align with the first line of text.

-     Example of what my text looks like (the dash in this example is a bullet point in my text).

-     This is an example of what I'd like the text to look like on my page. This is an
      example of what I'd like the text to look like on my page.