In this video, I’ll show you what a true/false variable is in Articulate Storyline and how you can use it in your e-learn project.
cta under video
In real life, it’s common to ask or be asked questions that you can answer with a yes or a no. For instance, is a banana fruit, to which the answer is, yes, of course, or, do you like Brussels sprouts, which the answer is, no, seriously not. Now, consider a similar statement that can be answered with a true or a false. For instance, bananas are fruit. This is clearly a true. Or how about, I like Brussels sprouts? And that’s definitely false.
But what has this to do with Articulate Storyline? Now, Storyline has also a special variable to deal with questions that have two different outcomes, true or false, and this variable type is called a true/false variable. Now, let’s see how to create a true/false variable in Storyline and how you can use it with some examples.
How to create a true/false variable
Now, let’s see how you can create a true/false variable in Article Storyline. And therefore, we go to our variables panel. You’ll see it here, and here you have project and built-in variables. Now, a true/false variable is your project variable, so let’s create a new project variable. And therefore, we click on the green plus variable to create a new variable. I give it a name and I can call it now, TrueFalse. The type is true or false, and I can set a default value, false or true. Now, I can set it on false, click on okay, and you’ll see I’ve created my true/false variable, and click on okay.
Now, we have created a true/false variable, so now the next step is to look into two examples on how you can use these true/false variables in Articulate Storyline and maybe in your next e-learning course. So our first example with a true/false variable is to set light switch to on, and also to off. So let’s go to this slide. So what I’ve got here, I have two buttons, an on button and off button, and here I’ve got a freeform light bulb that has two states, a normal state and an on state. And on the on state, you see that the light is on, and here the light is off.
Set the light bulb to on
So what we can do now is use the variable that we created earlier to set the light bulb to on. So what I’m going to do is, I select the on button and I create a new trigger. And what I do here now is not change state of, but I choose for adjust variable. And normally with a variable, you do something like set true/false variable to true, but what you can also do here is toggle the variable. And toggle means that every time you click the button and the trigger will be executed, the contents of the variable will be changed. So for a true/false variable, it will be set to true if it’s false, and it will be set to false if it’s true.
So click this one. I want the same trigger on my off button, so I will copy it and I will paste it. Now, we have to toggle. It worked, but it doesn’t do anything with my shape, so I’ll create a new trigger here. And here, I will say change state of, not my button, but my light bulb, to on. And I will also place a condition, if true/false variable is equal to true. And I click this one and I paste it and I will change it. I will set it to normal. That’s my off state when the user clicks button two and when true/variable is equal to false.
Preview
And now, let’s run a preview and see what happens. So here’s my preview. Now, for the [inaudible 00:04:24], I’ve also created a text field with the contents of the variable, so you see that the true/false variable has now, the contents are false. And when I click on the on button, it’s now true, and the light is on, and when I click off, it toggles it to false and the light is off again. And then, can click it on, on. It’s true, it’s on. And I click it on off, and it’s false and my light bulb is off again. So with this example, you can see that you can toggle a true/false variable, and therefore show something in Storyline and hide it, show it, and hide it.
Now, let’s look into the second example to use true/false variables to complete a chapter in Storyline. So let’s close my preview and go to story view here, and click on the main menu, and wait till my main menu loads, click it again. Yep, there’s my main menu. So what I want to do in this example is that I want to use a true/false variable to show a user that he completed a chapter, so for instance, chapter one. So what I’m going to do now is, I want to add a checkbox or check mark that a user can see visually that he completed this chapter. So what I’m going to do, I go to Insert, go to Shape, I choose your check mark, I place my check mark. It’s yellow right now, so click on format. And I wanted green.
Hide the check mark
So I think this is clear enough for now. And now, my check mark has initial state of normal, but it’s also a state of hidden, so what I want to do now is set it to hidden so a user cannot see it. And now, I will create a new true/false variable. So the true/false variable now will be Chapter1Complete, the type will be text and the default value is false. So we have a true/false variable and we have the check mark. We also need a trigger here on this slide to see if the true/false variable is true, and we need to show the check mark, so what we are going to do now is create a trigger that says, change state of, change state of my check mark to normal. And it’s not when a user clicks, but it’s when the timeline starts. And every time the timeline starts, we’re going to check if the check mark has to show, so we’re also going to create a condition that says that a check mark can only show when Chapter1Complete is equal to true.
So if we run this example now, you can see there’s no… So you see the slide loads and there’s no check mark, so what we are going to need is a trigger that sets the true/false variable, Chapter1Complete, to true. So let’s close my preview mode, go to story view. And what I’m going to do now is click this slide, and on this slide, I will create a new trigger that says adjust variable. So adjust variable, set, not TrueFalse, but Chapter1Complete, to true when a timeline starts on this slide.
Jump to the main menu
And on next slide, I want to jump back to the main menu. So let’s see, if we preview this, my whole course, what happens? So a user starts his course and he see that he has to complete all four chapters. So what we’re going to do now is click on chapter one. We’re going to go to our light bulb slide. So on the backend storyline, we’ll set the complete chapter one true/false variable to true. And if I go back to my main menu, you’ll see that chapter one is now completed, so our user now knows officially that he has completed this chapter and has to do chapter two, chapter three and chapter four.
So I hope that you liked the two examples of how you can use true/false variables in Storyline, and it gives you inspiration for your next e-learning project.
And if you want to create engaging e-learning in Articulate Storyline, make sure that you get my free step-by-step guide on how I create e-learning in Articulate Storyline. And I know for sure that it will help you because it describes my whole process that I use for every e-learning module in Articulate Storyline that I built. And was this video useful to you, then hit the like button below, and don’t forget to hit the subscribe button and the notification icon so you won’t miss any of my upcoming videos.