Forum Discussion
(Budget E-learning) How to subract from the total expenses using multiple choice
Returning to the original state changes states, but not variables. That is one of the powers of variables, slides can’t change their value on its own. Variables only change when you create a trigger to change them. So when you start over, resetting the slide to initial will reset all the button states, but none of the variables. You will have to create a trigger to reset each of them. I generally have them fire when the timeline on the slide starts.
In general, I find it is best practice to have one variable set to 20,000 (the initial value) that never changes, and another that does change that represents the total remaining. Then, when the new appliance “Yes” is clicked, the appliance variable changes to 100. When the new appliance “No” is checked, the appliance variable changes to 0.
You need a variable for each item:
For appliance, newAppliance (for example)
You need one trigger for each button:
Adjust variable newAppliance = 100 when user clicks applianceButtonYes
Adjust variable newAppliance = 0 when user clicks applianceButtonNo
You need one trigger for each item:
Show layer Calculate when variable newAppliance changes
Then when any of those variables changes, a calculation layer is shown. The layer has nothing on it, a timeline of .25, and closes when its timeline ends. All of its triggers run when the timeline starts. The order of the triggers is important.
1. totalRemaining is set to initial value variable.
Option 1 variable is subtracted from total remaining. (Remember, if it is chosen, it has a value. If not chosen, it is 0.
option 2 - 10 follow in order.
Doing the complete calculation every time a change is made is the best way to easily keep it accurate. Showing a layer each time one of the variables changes saves having to create 15 - 20 triggers for each item.