Limit Clicks

Apr 11, 2023

I have a cumulative lightbox activity throughout my Storyline program where students can add ingredients to a pizza. Students are routed to the lightbox activity upon successfully completing a challenge. (Three in all)   

I have the lightbox slide set to "Resume saved state" so each time they access the lightbox activity, it picks up where they left off. 

Here's my dilemma. On the first lightbox slide, students can, if they choose to, click all of the ingredients and complete the activity. How can I regulate the number of clicks students are allowed to do on the lightbox slide? 

8 Replies
Judy Nollet

Here's an option:

  • Create a number variable with the default value of 0. 
    • This is to track the number of clicks.
    • To restart the counting each time the user returns to the slide, use a trigger that resets the variable to 0 when the timeline starts. (FYI: "When timeline starts" triggers still run when a slide is set to its resume saved state.)
  • Add a trigger to each ingredient that adds 1 to the variable. 
  • Add a trigger(s) to prevent further clicking when the variable changes with the condition that the variable has reached the limit you want to set. 
    • There are different ways to prevent further clicking. For example, you could show a layer that has its properties set to prevent clicking the base. (In that case, you'll also need a trigger to hide the layer at the appropriate time.) 

To help with development/troubleshoot, I highly recommend that you add a temporary text box to the slide that references the variable. That will let you see its value change when you Preview the slide, which helps you ensure that the triggers are doing what you want them to.

If you're not familiar with variables and conditions, it's worth the time to learn about them, because they provide the real power in Storyline. Here are the User Guide articles: 

Katherine Adraktas

Thank you for responding so quickly Judy.  Question: 

Add a trigger to each ingredient that adds 1 to the variable. Add a trigger(s) to prevent further clicking when the variable changes with the condition that the variable has reached the limit you want to set. 

Do I add the variable 1 to all the ingredients? Or 1,2,3,4.  And what does that trigger to prevent further clicking when the variable changes with the condition look like?  

Judy Nollet

Think through what you want to track: the total number of clicks, which could be done on any ingredient. Thus, each ingredient needs a trigger to add 1 to the value of the variable when it is clicked. 

As I said above, there are different ways to prevent someone from clicking >2 objects per visit. The easiest is to show a layer that prevents them from clicking the base. 

The attached file demonstrates and explains this. 

Note: To keep things simple, an item cannot be deselected. (It'd be possible to do that, but it would require a lot more programming. I'm not going to get into that.)