Forum Discussion
Adding two variables together
I have a time variable that inputs a number (10 or 15 minutes) based on an object's state.
I have a second-time variable that operates the same way for another object.
Then I have a third variable to show the total of the two. However, when a user changes their answer on the object, the total time just keeps racking up instead of showing an accurate total.
How can I add the total of two variables together?
- RonPricePartner
Without seeing exactly how you put it together, my guess is that you need a trigger to reset that total back to zero before the items are added each time.
- JeniJohnson-6e1Community Member
Here is how it is set up.
- JudyNolletSuper Hero
As Ron mentioned, you need to reset the variable before adding to it.
Here's a good way to do that:
When either Total_Time or Total_Time2 changes, show a blank layer.
On that blank layer, have these triggers run when the timeline starts:
- Set calculation = 0
- Add Total_Time to calculation
- Add Total_Time2 to calculation
- Hide this layer [Note: you could also have this run when the timeline ends, and use a really short timeline.]