Forum Discussion
Little Tip About Conditional Variables
Hi Heroes,
I just wanted to share a little something I discovered. It's a very niche thing and affects how Storyline displays slides in the editor.
If I need the learner to complete a task on a slide, I usually make it so that they can't click NEXT> until they complete the task. The way I would do it is by using a variable that checks if the learner completed the task before clicking NEXT>. e.g. True = they did the thing. False = they didn't do the thing.
If False, I would show a disclaimer layer informing them they still hadn't completed the task. If True, they could advance to the next slide. Here is the variable:
However, when doing this, Storyline displays the slides in a funky way. It puts displays the next slides beside the slide instead of below it like usual:
This is annoying because it's harder to view the order of the slides, especially when they're on the left panel of the slide view. I really don't like this.
Luckily, I discovered that this can be rectified if you switch the trigger around. Instead of using the variable to show the layer or else go to the next slide, make it so it goes to the next slide or else show the layer. Basically, it switches the trigger around to this:
Now that the "next slide" action happens before the "show layer" action, Storyline displays the slides in sequence instead of next to each like it did before.
I know this is a really niche situation, but I just wanted to share this in case someone else was experiencing this issue. Because that side by side display was bugging me 😁
6 Replies
- ronald-hicksCommunity Member
Hey all — building on what Judy said about disabling Next, here's the exact setup I use so learners can't skip ahead. This is the pattern I hand-test on every project with gated interactions:
Create a True/False variable called SlideComplete, default value False.
Add these two triggers on the slide:
1. Change state of Next button to Disabled — When: Timeline starts on this slide
2. Change state of Next button to Normal — When: Variable changes, SlideComplete — If: SlideComplete == True
Then wherever the interaction finishes (question answered, drag-and-drop submitted, video ended), add: Set SlideComplete to True.
The "when variable changes" trigger is the piece that makes it reliable. Storyline watches the variable and flips the button the instant it changes, so you're not fighting timeline timing or trigger order.
- JudyNolletLegend
Note: If there's any chance the user might return to the slide, your 1st trigger needs a condition.
Why? Because a “when timeline starts” triggers runs every time the user reaches the slide—even if the Slide Properties are set to “Resume saved state.”
Using your example, the condition would be if SlideComplete = False. Since the variable would be True if the user completed the interaction on a previous visit, Next would stay Normal in that situation.
For those who aren't familiar with variables, be aware that a variable maintains its value until a trigger changes it. So to control the Next button on multiple slides by tracking completion with a variable, you need to use a unique variable for each slide.
- ronald-hicksCommunity Member
You're absolutely right — good catch. On a revisit, the timeline-starts trigger fires again and re-disables Next even though SlideComplete is still True. Adding "If SlideComplete == False" to that first trigger fixes it cleanly. And the per-slide unique variable point is worth underlining — one shared variable across slides is a classic way to get mysteriously unlocking Next buttons. Thanks for tightening this up.
- JudyNolletLegend
Niche, yes. Still nice of you to share this. 😁
SL looks for "jump to __" triggers to determine the layout in the Scenes panel and in Story View. So your solution to show the layer in the Else statement lets SL recognize the "jump to."
Personally, I like to disable Next until an interaction is completed, so it visually indicates that it's not clickable.
FYI: Here's my post about various ways to control the next button.
I also like to disable the NEXT button, that's my usual go-to, but there are certain situations where I think it's best to leave it clickable. If the learner thinks they completed the task but fails to miss something and the NEXT button is still disabled, they may not know what they've missed. However, leaving it clickable with the popup layer telling them they haven't completed the whole thing, helps reorient them to the task, in my opinion.
- JudyNolletLegend
Agreed! The context is important. If it's not obvious what's required for completion, your hint-layer method is a good option.
Related Content
- 7 months ago
- 2 months ago