Variable not working across slides

Jul 06, 2023

Hello. I have a course with 8 sections (8 buttons on the menu). The menu is set to "resume saved state." The player menu is set to restricted so that users have to visit slides subsequently before they are able to click on them in the player menu. I am trying to make the course so that users cannot click the next section (button) without first having viewed the entire previous section.

I set the initial states of buttons 2-8 to disabled, and then created triggers that say "change state of button 2 to normal when the state of button 2 is visited" and so on. This made it so that users have to first click the previous section button before they are able to visit the next section button.

However, I wanted to make sure that users could not simply click the section button in the menu, not view the whole section, click on the main menu button in the player menu, and then click the next section button, and so on. In order to prevent this, I created a number variable called "variable1" with an initial value of 0. I added to the aforementioned "change state of button..." triggers a condition saying "if variable1 is equal to value 1" and another trigger on the conclusion of the first section saying "set variable1 to value 1 when the timeline starts on this slide." This should ensure that users must reach the conclusion slide of a section before the next button in the menu becomes available. However, it is not working.

Is this because the variable will not work when moving to a different slide? How can I accomplish what I am trying to do? Thank you.

3 Replies
Phil Mayor

Variables are persistent across slides, it would be better to create a custom state and use that instead of listed and I would recommend not using a counter variable and instead use a boolean (T/F) for each section.

That said it may be possible to get the version you created working but I really we get to see the slides, there are so many reasons why it isn't working at the moment.

Walt Hamilton

Phil's idea is best.

What you describe won't work because the button changes to visited when clicked, and the condition keeps it from executing the trigger because the condition is never true until later when the section is completed.

This discussion has a sample that may help you visualize how it can be done:
 
 
The Restricted Navigation does not show the link to the next section until the previous section has been viewed.
Jennifer Walker

Thank you, everyone! What ended up working was getting rid of the "visited" states and creating a new one that I named "visited 2." I created boxes that sit on top of the buttons and make them look disabled (because the disabled built-in state does not work with the variables). I created another trigger that has these boxes change to hidden when the state of the previous button is "visited 2," with the condition that the user must visit the previous sections conclusion before this happens. To do this, I created a T/F variable for everyone conclusion slide with the default "false." I created a trigger that has this variable change to "true" when the timeline starts on that conclusion page. This made everything work!