Forum Discussion
Variable Triggers not triggering from variable in different scene
Hi everyone,
I'm trying to track completed case scenarios on my list of case scenarios page. When a user completes a case scenario, I want to reflect that in a counter on the case scenario list page. I also want to change the case navigation button colour to green—visually indicating that the scenario has been completed.
I can get the variable Case2Completion=True (when the user views the last screen of a case scenario)
However, neither the completion counter or colour of the case navigation button will change.
I did the following on the case scenario list page:
Add value 1 to CasesCompleted when Case2Completion changes, If Case2Completion=value True
and
Set state of Case 2 Button to Complete When Case2Completion changes, If Case2Completion= value True
I'm not sure why CasesCompleted and Case 2 Button won't change when Case2Completion = value True
I have attached an 360 file demo. I would love the community's insights.
Thank you in advance.
- MichaelHinzeCommunity Member
The "When Variable Changes" condition is limited to the slide where the change actually happens, in your case that's the last slide of a scenario.
So, back on your case scenario list page, you need to adjust the triggers from "When variable changes" to "When slides timeline starts".
- FranoisParadisoCommunity Member
Thank you Michael. It works! Much appreciated : )
- FranoisParadisoCommunity Member
@Michael Hinze
I'm running into a new problem. Now that have several Case scenarios up and running, the CasesCompleted is growing exponentially.
I.e. if I complete 1 case, then CasesCompleted=1
If I complete 2 cases, then CasesCompleted=3If I complete 3 cases, then CasesCompleted=6
I think what is happening is everytime the timeline starts, it stores both the previous completions and then adds all of the completions again.
Any thoughts on this?
One workaround I tried was making a button on the last screen of a case scenario with the following object trigger "Adjust variable Add value 1 to CasesCompleted when the user clicks Button 1". But when the user clicks button 1, CasesCompleted remains at 0. - FranoisParadisoCommunity Member
Ok I think I figured out a solution to the exponential growth.
I combined both ideas I had above.
On the last slide of each case scenario, I added the following slide trigger "Adjust variable Add value 1 to CasesCompleted When the timeline starts on this slide".
(With "this slide" being the last slide of a case scenario which the user would most likely only visit once. As opposed to the list of case scenarios, which is visited frequently as what I think was causing the exponential growth.) - MichaelHinzeCommunity Member
You could also add a trigger at the beginning (remember, the order of triggers is important!) to reset the CasesCompleted variable to 0 and then re-calculate the total.
- WaltHamiltonSuper Hero
Michael is right, Adding to a total as you go along is fraught with so many possibilities for error. Whatever it takes, even if it requires creating a variable to record if each scenario has been completed, it's worth it. You could create a T/F variable for each scenario and change it when the last slide is finished which (as Michael pointed out,) must be changed before the jump to ... trigger. Then, when it is time to know if all scenarios are done, or how many are done you can write each one into a trigger condition, or count them. For example:
[Trigger activity] when [user takes action] if Scenario1 is true AND scenario2 is true, etc.
Or Add 1 to total when [user takes action] if scenario1 is true
Add 1 to total when [user takes action] if scenario2 is true with each scenario needing its own trigger.
It's the best and most reliable method of knowing when you get to the end, because at no point is it vulnerable to user action.
- FranoisParadisoCommunity Member
Thank you Michael and Walt for taking the time to help teach about these variable nuances. Much appreciated!
Good point Walt about the [user takes action] if True, because as you said, it's not vulnerable to user action.
Thank you!