Forum Discussion
Change State of Button When Pass Test
Hello,
Can someone look at this sample .story and tell me why my button isn't changing state to visited if someone passes a quiz?
There are two buttons on the start slide.
- Click the Test button.
- Pass the one question quiz.
- Return to the start slide.
- The Play button should change to a state of visited.
End goal. I want the learner to choose between testing out and branching to the content. If they fail the test, they have to branch to the course content. If the pass the test, the Play button's state is set to visited but is still active if they want see the course content anyway.
I've tried everything. I can't figure out why even though the variable is changing the trigger isn't working.
5 Replies
- RachaeLeybaCommunity Member
Makes sense and that is what I suspected. So how do I get the state to change? I only see a trigger variable "changes" not variable "is". And on the slide where the variable actually changes I don't see a way to change the state of the button on the other slide.
- AndrewBlemings-Community Member
Perhaps the image I attached to my prior comment didn't load for you? If the Action of the trigger is "Set state of [object] to Visited" then the Event is "When the timeline starts," not when a variable changes. You can't trigger the button state to change to Visited while you're on a separate slide.
The 1.1 button state can only be updated once the learner returns to the slide the button lives on, which is why the "When the timeline starts on this slide" trigger has to run on 1.1. When the learner passes the quiz and is sitting on the results page (where the .ScorePercent variable I think truly changes), slide 1.1 isn't being calculated or rendered so I don't think there technically is a button to change the state of. Only once the learner returns to 1.1 will the browser redraw slide 1.1 and its buttons and then run the trigger to change the state.
- RachaeLeybaCommunity Member
You are a genius. I changed it to "When time line starts" and it WORKED! I knew there was a flaw in my original logic. Thank you thank you thank you thank you so much!
- AndrewBlemings-Community Member
Your trigger on 1.1 that tries to change the state of the Play Button to Visited fires when the .ScorePercent variable changes, but the trigger is only "listening" for that on the slide the trigger's hosted on. When the learner navigates to 2.1 and 2.2, the Score might change but that state-change trigger is no longer active because we're no longer on the slide where it lives.
Then when the learner returns to 1.1 after scoring 100%, the slide (re)loads and the trigger becomes active again, but the Score variable doesn't change after 1.1 loads so the trigger doesn't fire and the state doesn't change. If you change the trigger to
Then the trigger will check the value every time the slide loads, and returning with a score of 100 will then be checked and confirmed.
Related Content
- 1 year ago
- 8 months ago
- 6 months ago