Forum Discussion
Trigger actions not really working
Hello, Bent from Norway here. I am trying to put together a couple of slides and variable triggers to change the states of an object from "Empty" to either "Pass" or "Failed." This is a green checkmark if a quiz is passed and a red hand if the learner fails. I have created an empty state and set this as the initial state (see attachment). I have also created a text variable "Quizstatus_BG" with the word "Empty" as the default value. This variable changes to either "Pass" or "Failed," depending on the variable "KC_BG.Scorepercent" being either greater than/equal to or less than 50%.
The user will be led back from the quiz results page to the link page shown in attachment 1. My intention is to have the Pass state show if the result is equal to or greater than 50%, and of course to show the "Failed" icon if the user scores less than 50%. Easy peasy, right? So far, I have not had much luck.
The state changes when I hover over the object in edit mode. I have also set up a couple of buttons just to check that the state actually changes when clicked, and a couple of text boxes to show the value of the score, the true/false change, and the state of the object itself (Empty, Pass, Failed). They all change as they are supposed to, yet when I run the course, it will not work. I add the slide and the variable triggers as attachments. I have disabled every other trigger temporarily.
The triggers are shown in attachment 2.
There are 9 quizzes in this course, and each result is summed up in a final results slide. This works as intended.
Can someone please have a look and comment?
Thanks.
I don’t see any reason why it shouldn’t work unless you have something else going on. I created a simple scene with two questions, a result slide, and a slide after the result slide to display the status icon, along with the necessary variables and triggers to match your scenario. When I preview everything, it works as expected. I’ve attached my .story file for you to review and compare to see if anything is different.
- SamHillSuper Hero
Hi BentMichaelsen- I'm not if this is the cause of the issue, but I want to make you aware that the variable change trigger will only trigger when there is a change to the value. For example, if your variable already has a value of Pass and you set it to Pass, this will not trigger a change, so you should always ensure the variable value is reset to a value that is not Pass/Fail, before setting to Pass/Fail. This will ensure the variable change trigger will always run.
Also, don't forget you can use the "Hidden" state rather than creating an "Empty" state on the element.
When debugging a problem like this, it is a good idea to add a text box to your slide that displays the value of the variables on the slide, just so you know for sure what the values are.
Quizstatus_BG = %Quizstatus_BG%
2_bg_visited = %2_bg_visited%
KC_BG.ScorePercent = %KC_BG.ScorePercent%- BentMichaelsen-Community Member
Hello Sam, thank you for your input. I know of the hidden state, and had used that but changed to an "empty" as it didn't work the way I wanted it to. I don't know whether you saw the attachments, the first clearly shows the text boxes I added to show the variable changes.
- NedimCommunity Member
I don’t see any reason why it shouldn’t work unless you have something else going on. I created a simple scene with two questions, a result slide, and a slide after the result slide to display the status icon, along with the necessary variables and triggers to match your scenario. When I preview everything, it works as expected. I’ve attached my .story file for you to review and compare to see if anything is different.
- BentMichaelsen-Community Member
Thank you.