Forum Discussion

staperek's avatar
staperek
Community Member
1 month ago

Variable/Trigger Help

Hello! First time posting so if I share the file incorrectly let me know.

On the attached Storyline file the following is supposed to happen.

Leaner drags and drops answer choice onto one of the 6 spots under "Out of Control"

When they drop it in any of those spots, the variable "DBalanceBeam" gets 1 added to it.

I then have triggers set up to change the state of the balance beam figure to lean right/left and to change whenever the above variable changes.

Right now it will change to the "Lean Right" state, but won't toggle back and forth as I want it to.

Any help would be appreciated, thank you!

3 Replies

  • Here are the triggers you have to "lean" the balance beam to the left and right:

    Triggers run in order. If D Balance is Normal or Lean Right, the first trigger changes it to Lean Left. However, because it's now Lean Left, the next trigger immediately changes it back to Lean Right. That happens so quickly you don't even see it changing to Lean Left. 

    The fix is to use one trigger with an Else statement.

    You can see that work in the attached file. 

    Note: I'm guessing that you plan to use the DBalanceBeam variable to track whether all the objects have been dragged before showing the Submit button. Unfortunately, that's not reliable. The triggers that add 1 to the variable run whenever an object is dropped on a target. That happens if the user moves an object from one target to another. So, for example, the variable could = 6 just by moving one object to each of the drop targets. You either have to add conditions to the "add 1" triggers or use some other way to show the Submit button. Or just keep the Submit button showing. If they click before finishing, well, it's marked as incorrect. 

    • staperek's avatar
      staperek
      Community Member

      Thank you so much!

      I still don't understand the "why" behind it automatically changing to the second trigger the way I set it up, but I'll build things this way moving forward.

      • JudyNollet's avatar
        JudyNollet
        Super Hero

        Let me try to clarify the "why" for you. When there are multiple triggers with the same "when," all the triggers run in the order they appear in the Trigger Panel. Each trigger's action is performed (unless trigger conditions prevent it).

        With your two triggers, the first time the DBalanceBeam variable changes, the state of D Balance = Normal. 

        Thus, the 1st trigger sets the state of D Balance to Lean Left. 

        The program then immediately runs the 2nd trigger. Because D Balance was just changed to the Lean Left state, the 2nd trigger's condition is met, so that trigger changes D Balance to the Lean Right state. 

        The actions of both triggers happen so quickly that you only see the result from the 2nd trigger: D Balance = Lean Right. 

        Bottom line: When multiple triggers share the same "when," you need to consider how each action could impact what's done with subsequent triggers.