Forum Discussion

DeveloperIgniti's avatar
DeveloperIgniti
Community Member
14 days ago

Nested if conditions

Hi,

It doesn't happen often, but I occasionally want an if condition within another if condition.

Is this possible?

Many thanks in advance.

3 Replies

  • I used nested if/then statements at lot when I worked in HyperCard (so a long, long time ago, in software terms).

    At this time, Storyline doesn't support nested conditions. You could submit a feature request: 

    https://www.articulate.com/product-feature-request/ 

    Note: Submitting a request doesn't guarantee that a feature will be implemented. But the number of people who request a feature might have some impact on the decision-making process.

    Earlier versions of Storyline didn't even include "Else" statements. Thank goodness that we got that, at least. 

    For more complicated sets of if-thens, you need to create separate triggers.

    Keep in mind that triggers run in order. Also, a trigger can't run if a previous trigger has already jumped to another slide.

  • JeremyDittmer's avatar
    JeremyDittmer
    Community Member

    If you want to accomplish this and can't just use multiple AND & OR conditions in the initial trigger there's a couple of options:

    [1] Use the base trigger to open a new layer and then add a 'on timeline start' trigger(s) to the layer that uses your additional condition(s). Make sure to add a final 'on timeline start - hide layer' trigger so you can re-show the layer.  You're kind of treating the layer as a re-useable function.

    [2] Resort to Javascript!  I'd need to see an example of what you want to check to suggest how best to code this.  In general I would do something like:

    • Set a true/false variable  (let's call it 'jsResult') to false.  You can also use numeric or string variables. Strings are most flexible but let's stick to t/f to keep it simple.
    • Run the Javascript check & set jsResult to true if your condtions are met
    • Add a 'when jsResult changes' trigger that carries out your desired action 'if jsResult = value true'

    Does that make sense?