Forum Discussion

DeveloperIgniti's avatar
DeveloperIgniti
Community Member
3 days ago

Please allow "watching" multiple variables in same trigger.

Hi, 

Can you please add the ability to watch multiple variables in the same trigger? Concept below:

 

Storyline already has an interface to achieve this, but it is only available for watching multiple object states:

I would like this same interface available to variables.

Many thanks in advance.

3 Replies

  • That's a great suggestion! It would be so helpful. And, as you point out, it could be set up like the "when the state of..." trigger.

    FYI, you can submit a feature request directly to the Articulate staff here: https://www.articulate.com/product-feature-request/   

    The community site also has this section for specifically for suggestions:  Suggest Ideas | Articulate - Community 
     
    In the meantime, here's a workaround I use in similar situations: 
    • Create a T/F variable to "notice" other variables changing. The value of this variable doesn't matter. What matters is that it changes.
    • Create triggers that toggle the "notice" variable using the same action that changes other variables, such as your "cardSeen" variables. For example, if you change page13card1seen to True when the timeline of a layer ends, add another trigger that toggles "notice" when the timeline of the layer ends.
    • You could then have one trigger that runs when "notice" changes, with conditions that the "cardSeen" variables = True. 

     

    Note: Be sure you toggle the "notice" trigger, which makes it switch back and forth between True and False. That's needed for the "when 'notice' variable changes" trigger to run. (If the triggers all set the variable to True, the variable's value wouldn't change after the first trigger.) 

    Yes, this workaround does require extra triggers to toggle the "notice" variable, but those are simple triggers. I think that helps, because if you have to change the number of other variables (for example, add a page13_card5seen variable), there's only one trigger that needs its conditions edited. 

  • Nedim's avatar
    Nedim
    Community Member

    A technique I often use for this kind of logic is based on a JavaScript approach that can be easily replicated in Storyline with just a couple of triggers.

    JavaScript Version

    The following script checks if variables page1Seen through page5Seen are all true. Once they are, it automatically sets page6Seen to true.

    function allSeen() {
      const keys = ["page1Seen", "page2Seen", "page3Seen", "page4Seen", "page5Seen"];
      const page6Seen = keys.every(k => getVar(k) === true);
      if (page6Seen) {
        setVar("page6Seen", true);
      }
    }
    
    setInterval(allSeen, 250);

    The key here is the setInterval function, which checks every 250ms (0.25 seconds). As soon as all five variables are true, the sixth is updated — no need for separate triggers. You only need the usual triggers to set page1Seen to page5Seen. The rest is automated.

    Storyline-Only Equivalent

    To replicate this without JavaScript:

    1. Add a shape off-slide.
    2. Create a motion path on that shape:
      • Duration: 0.10s
      • Distance: Any (e.g., 100px)
    3. Create these 3 triggers (in order):

    Trigger 1:

    Move shape on motion path when the timeline starts

    Trigger 2:

    Move shape on motion path when animation completes
    (this loops it — acting like setInterval)

    Trigger 3:

    Set variable page6Seen to true
    When animation completes if all other variables (page1Seen to page5Seen) are true

    This setup acts like a ticking engine — Storyline’s version of setInterval. It continuously runs and checks your conditions every time motion path completes and we set it to very short time.

    I've attached a Storyline file for you to explore if you're interested. The logic is simple and works well. To test the JavaScript version, disable the Storyline triggers. To test the Storyline-only version, enable those triggers and disable the JavaScript.

     

  • In my opinion, DeveloperIgniti​ 's request is very reasonable and very relevant. I am (very, very) far from being a coder, but it doesn't seem any more complicated to me than evaluating the states of several elements at once.
    Once again, Nedim​ 's solution shines in its simplicity and practicality: you just need to change the variable name (and/or add as many as you want) to reuse it immediately in another project. I'll keep it. Thank you. (I have a closet full of Nedim's JScodes 😀)
    I also use the loop-acting like setInterval technique. I call it “creating a small engine.” Sometimes, I prefer the technique of a looping layer timeline. I display a layer at the beginning of the screen timeline. Nothing is visible on this layer, but it has lots of triggers working (with variables or elements on the base layer) that I don't want cluttering up the base layer's trigger panel. This layer loops every 0.25 seconds.
    As for JudyNollet​ 's suggestion, I use it less often, and certainly with fewer variables (and triggers) to manage. The problem is that it's much harder to debug, in my opinion. Even if you display the variable on the screen while you're building the screen, you have to remember what its value was (T or F) before to make sure it changed correctly (F or T) after, at the right time. It can be tricky. But it's a matter of habit.