Forum Discussion
Variable/Trigger Help
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.
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.
- JudyNollet2 months agoSuper 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.
Related Content
- 10 months ago
- 11 months ago