September 7, 2018

Storyline Tutorial: Counting Answers

Sometimes we want to make sure that users attempt an interaction or select the right amount of options. While such mechanics alone are not helpful in ensuring that "people learn", they are great if you want to customise feedback or course content, or if just prevent accidental errors and attention slips.

While Storyline makes it easy to check if the user selected all, one or none of the options, when it comes to n-amount of answers out of many, things get a bit more complicated. In the following example, we'll solve this problem by creating a simple interaction that will count the amount of answers selected and will warn the users if they have selected too few or too many. In this case, the users will have 6 options to choose from and they need to select exactly 3. You can see the finished example here

I've created a Storyline 360 file to get you started (download it here). But if you wish, you can follow this tutorial in your own. Here are the elements you'll need:

  • Objects to choose from (make sure they have the "Selected" state)
  • Submit button (either your own or the one in the player).
  • Layer with feedback for less than 3 answers selected
  • Layer with feedback for more than 3 answers selected

With the set up out of the way, time to add some interactivity. First, create a number variable "AnswersSelected". As the name suggests, it will be used to track the number of answers selected.

Then, select the object "Option 1" (if you're using the tutorial file) or any interactive object (if you're working in your own project) and create the following trigger:

At this point you can add a text box with the variable reference to the slide and preview the slide to check if the trigger is working:

1 is the value of AnswersSelected variable.

If it is working and the variable value is changing with the object state, go ahead and copy this trigger to all other objects. As you paste the trigger, you will notice that all trigger references to "Option 1" automatically change to "Option 2", "Option 3" and so on - depending on which object you are pasting the trigger to. As you can see, copy/pasting triggers can save heaps of time (but only if you make sure the trigger works before copying it).

As you have most likely noticed, at this point the value of the AnswersSelected variable will increase each time an object is selected. So, if you select and de-select the option "Bacon" three times, the course will think that you have selected three answers. So, we need to find a way to track when an answer is de-selected.

These are definitely not the results we are looking for...

Since we add 1 to the variable value whenever an object is selected, we will create trigger that substracts 1 if the same object is de-selected. To achieve that, create the following trigger:

Now, preview the slide once again and verify that the variable value changes correctly when you select and de-select the same object. If it is working (and it should), copy it over to other objects.

With all triggers added, preview the slide once again and check if the variable value changes correctly. At this point it should, but in general, I recommend verifying your work often, so that you can pick up any issues early on and therefore troubleshoot them easier.

Although it is clear that bacon is the only choice that matters!

For the final touches, create a trigger to show feedback for less than 3 answers selected:

Then, copy/paste this trigger and change the name of the layer and the value of the variable to show feedback for more than 3 selected answers.

Finally, create a trigger to allow the user to continue if they selected exactly 3 answers:

And that's all there is to it - preview your work and enjoy!

No comments:

Post a Comment