Forum Discussion
Variables within triggers not working consistently
Hello,
I am working on a project that includes some interaction from the user/viewer. Some of my slides have buttons that, when clicked, populate a new layer with audio. The buttons do not have to be selected in any specific order, but all buttons must be selected, therefore all additional layers are to be viewed, before advancing to the next slide.
I am having an issue with my triggers it appears. For some reason, once the timeline on the first layer completes, the trigger is activated and the project progresses to the next slide, BUT this is only happening when I've uploaded to my LMS system. When I preview the project in Articulate, it works as it should.
For reference, I have the following triggers in place:
Base Layer:
- Show Layer 1 when user clicks Button:1
- Show Layer 2 when user clicks Button:2
- Show Layer 3 when user clicks Button:3
- Show Layer 4 when user clicks Button:4
Layer 1:
- Set Layer1Visited to True when the timeline ends on this layer
- Jump to Next Slide when the timeline ends on this layer
- if Layer1Visited = True
- and Layer2Visited = True
- and Layer3Visited = True
- and Layer4Visited = True
Layer 2:
- Set Layer2Visited to True when the timeline ends on this layer
- Jump to Next Slide when the timeline ends on this layer
- if Layer1Visited = True
- and Layer2Visited = True
- and Layer3Visited = True
- and Layer4Visited = True
Layer 3:
- Set Layer3Visited to True when the timeline ends on this layer
- Jump to Next Slide when the timeline ends on this layer
- if Layer1Visited = True
- and Layer2Visited = True
- and Layer3Visited = True
- and Layer4Visited = True
Layer 4:
- Set Layer4Visited to True when the timeline ends on this layer
- Jump to Next Slide when the timeline ends on this layer
- if Layer1Visited = True
- and Layer2Visited = True
- and Layer3Visited = True
- and Layer4Visited = True
All variables are set to False by default, and all layers have audio. I also have slide layer properties set to hide objects on the base layer (yes), hide slide layer when timeline finishes (yes), and pause timeline of base layer (yes).
I should add, the first slide in my presentation with these triggers works perfectly. The rest do not. Is there possibly some setting I have checked during Publishing that could cause this? I'm at a loss.
Yup, the problem is using the same set of variables on multiple slides...
Variables maintain their value until a trigger changes it. So, as I said above, after the variables change to True on the first slide where they're used, they remain True. And that's why the next slide jumps after viewing just one layer. The conditions on the trigger are met before the user gets to that slide.
So, yes, you need different triggers for each slide. For easier programming (and troubleshooting), I suggest using a naming convention that indicates the slide and the layer. And keep the names as short as possible.
For example, the variables on the first slide could be s1_L1done, s1_L2done, s1_L3done, and s1_L4done. The variables on the second slide could be s2_L1done, s2_L2done, s2_L3done, and s2_L4done. And so on.
- JudyNolletSuper Hero
You've got two triggers that jump to different slides, but both triggers have the same condition ("If var = value Import").
Triggers with the same "when..." run in order. So when the user clicks "Live," if "var = Import," the program will jump to slide 9.1. (Also note that the program doesn't run any additional triggers on a slide after it has jumped to another slide.)
My guess is it will work as you expect it to if you delete those two triggers. If you also want to ensure that "var = Import," add that as another condition to the remaining triggers.
If that doesn't solve your problem, well, further troubleshooting is just guessing without seeing the .story file. If you upload it, someone might be able to solve the issue.
Here are the best practices for uploading a .story file:- Only include slides that are related to the problem.
- Be sure objects, layers, motion paths, and variables have meaningful names.
- If there is proprietary content, replace or delete it. For example, replace proprietary text with “ipsum lorem” text.
BTW, when other posts don't have a solution that works for you, I suggest that you start a new discussion. I happened to see your question, but any question is less likely to be noticed if it's just added into another discussion.
- richuCommunity Member
Hi,
I need some help please. I have created two different variables to ensure users are directed to the appropriate slides. The triggers are attached here. The problem is when I click on a certain button on the slide labelled "live", it keeps taking me to the same slide (#9.1) as opposed to the one I created the trigger for. It seems storyline is not reading past the first to triggers, each with different variables.
Can anyone please help as I'm a new storyline360 user?
Thank you
- AsamaKhan-e3038Community Member
I was having precisely the same problem. Thanks for asking the question, Kristinhall1, and for the perfect solution, JudyNollet.
- kristinhall1Community Member
I went through and made variables specific to each slide and its layers, then substituted those in place of what was there there initially and it works now! Thank you!
- kristinhall1Community Member
Sorry, I was trying to figure out how to locate the .story file. I've included it here.
Your first solution sounds like it may be applicable... So, on the additional slides, I would need to change it to "Layer5Visited, Layer6Visited,..." so that each layer throughout the entire project has its own specific variable, is this correct?
- JudyNolletSuper Hero
Yup, the problem is using the same set of variables on multiple slides...
Variables maintain their value until a trigger changes it. So, as I said above, after the variables change to True on the first slide where they're used, they remain True. And that's why the next slide jumps after viewing just one layer. The conditions on the trigger are met before the user gets to that slide.
So, yes, you need different triggers for each slide. For easier programming (and troubleshooting), I suggest using a naming convention that indicates the slide and the layer. And keep the names as short as possible.
For example, the variables on the first slide could be s1_L1done, s1_L2done, s1_L3done, and s1_L4done. The variables on the second slide could be s2_L1done, s2_L2done, s2_L3done, and s2_L4done. And so on.
- JudyNolletSuper Hero
It's hard to tell for sure without seeing the .story file. But, based on your description, I'd guess that you're using the same variables—Layer1Visited, Layer2Visited, etc.—in the triggers on every slide.
- That would explain the problem, because all the variables would = True as soon as the user completed the first slide with those triggers.
- The slides would work in preview if you're just previewing one slide at a time, because each preview would start with the variable default of False.
- The fix: use a different set of variables for each slide.
If that's not the case, someone might be able to solve the issue if you upload a .story file.
Here are the best practices for doing that:- Only include slides that are related to the problem.
- Be sure objects, layers, motion paths, and variables have meaningful names.
- If there is proprietary content, replace or delete it. For example, replace proprietary text with “ipsum lorem” text.