Forum Discussion

zamond1's avatar
zamond1
Community Member
2 days ago
Solved

Why hasn't Articulate prioritized simple adding of multiple variables at once?

For instance, if I had the following variables (user-inputted values):

  • blueberries = 6
  • strawberries = 7
  • bananas = 3
  • apples = 8
  • honeydew = 7
  • mango = 5
  • pears = 6
  • oranges = 9
  • watermelon = 8

...and wanted to create a new variable totalFruitCost that calculated the sum, it might look something like this:

totalFruitCost = blueberries + strawberries + bananas + apples + honeydew + mango + pears + oranges + watermelon

----------------------------------

However, to my understanding, as things stand now, the number of convoluted triggers one must create in order to do this, so that 'totalFruitCost' is updated every time the user manually changes any of the individual fruit values is so daunting that I have to completely rethink what I'm going to do on this slide. I simply do not want to spend hours on something that should take all of 1 minute. Please, please, PLEASE correct me if I'm wrong!

Yes, I know that fixing this would require an update to the variable creation wizard UI. But how long has this product been out now? How is it that this wasn't one of the very first feature requests that were implemented, let alone not in the product's first beta?

Utterly perplexed... 

  • You are correct about Storyline not having a single trigger that can sum multiple numbers. 

    However, you don't have to repeat the set of triggers that calculate the sum every time one of your input variables changes. Instead, you could do this:

    Create a "calculation" layer. 

    • Don't add any content to the layer. 
    • Set the Slide Layer Properties to "Reset to initial state." 
    • Set the timeline very short (e.g., 0.25 sec).
    • Create a trigger to reset your "totalFruit" variable to 0 when the timeline starts on the layer.
    • Create the triggers that add each separate "fruit" variable to the "totalFruit" variable when the timeline starts on the layer.
    • Create a trigger that hides the layer when the timeline of the layer ends.

     

    Back on the base, add triggers that shows the "calculation" layer when each "fruit" variable changes. So if you have 9 fruit values, there would be 9 triggers showing the layer.

    Yes, it's still more complicated than if there were a "sum" trigger. But at least this method is easier than repeating the calculation triggers whenever any input variables changes.

    Another option: run JavaScript for the calculation.

5 Replies

  • zamond1's avatar
    zamond1
    Community Member

    Not at the Javascript level yet. But definitely simplifies things. Thanks so much. 

    • JudyNollet's avatar
      JudyNollet
      Super Hero

      You're welcome! Pay it forward when you can. 😊

  • Or as Judy suggest do it in JS

    // Get access to Storyline variables
    var player = GetPlayer();
    
    // Get values from Storyline
    var blueberries   = player.GetVar("blueberries");
    var strawberries  = player.GetVar("strawberries");
    var bananas       = player.GetVar("bananas");
    var apples        = player.GetVar("apples");
    var honeydew      = player.GetVar("honeydew");
    var mango         = player.GetVar("mango");
    var pears         = player.GetVar("pears");
    var oranges       = player.GetVar("oranges");
    var watermelon    = player.GetVar("watermelon");
    
    // Calculate the total
    var total = blueberries + strawberries + bananas + apples +
                honeydew + mango + pears + oranges + watermelon;
    
    // Push result back to Storyline variable
    player.SetVar("totalFruitCost", total);

     

  • zamond1's avatar
    zamond1
    Community Member

    That's a great idea, and clever use of layers. Thanks, I'll try it!

  • You are correct about Storyline not having a single trigger that can sum multiple numbers. 

    However, you don't have to repeat the set of triggers that calculate the sum every time one of your input variables changes. Instead, you could do this:

    Create a "calculation" layer. 

    • Don't add any content to the layer. 
    • Set the Slide Layer Properties to "Reset to initial state." 
    • Set the timeline very short (e.g., 0.25 sec).
    • Create a trigger to reset your "totalFruit" variable to 0 when the timeline starts on the layer.
    • Create the triggers that add each separate "fruit" variable to the "totalFruit" variable when the timeline starts on the layer.
    • Create a trigger that hides the layer when the timeline of the layer ends.

     

    Back on the base, add triggers that shows the "calculation" layer when each "fruit" variable changes. So if you have 9 fruit values, there would be 9 triggers showing the layer.

    Yes, it's still more complicated than if there were a "sum" trigger. But at least this method is easier than repeating the calculation triggers whenever any input variables changes.

    Another option: run JavaScript for the calculation.