A way to simulate functions in Storyline
I come from the Flash/Flex/Actionscript school of thought, and since I have been starting to develop in Articulate, I have been a bit frustrated with the way variables and triggers are handled. One area in particular has vexed me - there was no real way to create reusable functions.
Well, there actually is a way of sorts. If you consider that layers on a slide can be considered their own "timeline", you can use these layers to "call" triggers when the layer is shown! You can even do this is a timed manner if that is your preference.
This is how I do it:
1) Create a global master slide - used for the main program interface.
2) On this master slide, create a new layer. This layer can be as short or long (time-wise) as you need it, but shorter is probably better most of the time.
3) Place your triggers that you want to call on this layer, to be executed when the timeline starts, or when the timeline reaches a point on the timeline that you set up (0.25 - 0.50 etc.).
4) Creating a trigger on the master slide that command this new layer to be hidden when the master slide's timeline starts. [I guess you really don't need this, as layers default to be invisible.]
4) Create another trigger on the new layer that sets the layer's timeline to be hidden when it completes. (This step is pretty important.) [This is actually set on the layer's properties, so you don't really need a trigger here.]
Now, when you want to call this "function", you have another trigger show the layer. [This "calling" trigger could come from a button or control, or even another trigger.] The layer is "shown", firing off the triggers contained within it. At the end of the layer's timeline it becomes hidden, ready to be used again.
Here is a bit of a deeper dive:
You can think of Storyline layers as being similar to movieClips on a layer in the Flash main timeline of a scene. The main timeline and the movieClip sitting on the main timeline run independently of each other. In Flash, if you want to stop the movieClip (on the main timeline) from running right away , you have to tell it to stop using Actionscript. In Storyline, the layer stays at the zero point on the timeline until the layer is actually shown. Even though we are not actually showing any visual content, the timeline for the layer is stopped at zero until we command it to be shown. Then, when the timeline runs to the end, and you have instructed it to be hidden, this layer will go back to the zero point on its timeline and wait - until it is commanded to be shown again.
In this scenario, you must think of a layer as not revealing visible content, but revealing actionable content. And if you place this layer on a master slide, you can "call" it on any slide that uses this master slide. Of course, you can use this technique on any slide - this is just a matter of scope, where you want the function to be available for use. Using this on a master slide allows you a little more flexibility, and also will let you write this "function" once, and reuse it whenever you see fit.