Counter: Only counts a button on 1st click??

There is a good tutorial on making a counter using a variable here:

I need that and a condition: only count the buttons once.

We have 13 items on the main page, and the counter starts at 13 and counts down as a user clicks the items. We only want the countdown to subtract 1 on the first click of each item. Users can re-click items, but the counter should ignore.


Each of the 13 items, when clicked, jumps to a new scene.

When users return, the main page is set to Resume saves state.

Any ideas on how to only count a button's first click?

20 Replies
Gerry Wasiluk

A couple of ideas.

Add a variable for each click.  Make it true-false.

Add a trigger to your click that changes the variable to true.  Then edit your trigger that increments the counter and moves to the new scene and add a condition.  Only increment the counter when your variable = false.

Or have a copy of your item.  It shows when the original is clicked and it does not increment the counter.  Also, when clicking the original item, add a trigger to hide the item.  Make sure these triggers happen BEFORE you move to the new scene.

Eric Matas

Thanks - I too love the freedom to accomplish things in multiple ways!

I am testing Ashley's condition of "not equal to" visited.

Gerry, if I use the show copy or hide original technique, are you saying that I need those triggers to be "above" the trigger that jumps to another scene?

Gerry Wasiluk

Yes, when you jump to another slide any remaining triggers for the previous slide do not execute.

So do all you need to do on the first slide with your triggers and then lastly have your trigger that moves to another scene or slide.

With layers, you don't have this restriction since you are still on the "same slide."

Eric Matas

Uh-oh, I found trouble!

We changed it up a bit. Or tried to. Instead of the main page button adding to the counter -- that appears on that slide -- we tried to make a button on other slides add to the counter.

The main slide can jump to another scene or just another slide in the same scene, but when users click the "right" button and then return to the main slide, the counter hasn't changed. ??

Is it possible to have a trigger on one slide that updates a variable on another? Please?  

Phil Mayor

variables are not assigned to slides so they can be updated at any time.

Really Gerry's suggesstion of T/F variable is better here.  Tracking using a counter is problematic and needs a lot of management

I would add a T/F variable that is changed when the user clicks the return button (if that is a button on your slide or the next button).

and use these as conditions this way you also know which section has been completed.

I would also  check the trigger porder because any trigger after the jump to trigger will never fire.

Eric Matas

Oh snap! I just screwed up. Phil, you're right about the variables. (Hi Phil!) But I was confused by my trigger options -- I was choosing the wrong button in my condition...because my base layer buttons have similar names. 

Everyone be careful when specifying in a condition... "If ___________" to make sure you are not choosing a similarly named button that might be on the base layer! Of course, when you hover on the choices, SL puts a red border around the item to help. I was so excited to try the variables that I created some wacked-out trigger about a button a different layer...oy.

Anyhow, thanks for the help. Now we choose whatever button seems "right" to count the module as "viewed" and we trigger a variable adjustment based on the click, but with the condition that the button's state is not equal to "visited." So far so good...

Shelley McKay

Is there anyway to have the counter increase when the object is selected, and decrease when the object is deselected? I know that this is just basically a click that is changing the state of the object (to selected and normal), so not sure if this is possible.

I'm using a pick many quiz question.


Hugh Cartwright

Hi Shelley,

I'm trying to do exactly the same thing. It's been a while, but did you manage to solve the issue?

At this point, I have a 'selected' state for each of my pick many items. I've tried using a customized state for each item with a conditional trigger and a subtract 1 variable trigger together, but that didn't work. Just learning how to use conditions and variables.

Let me know if you figured it out.



Rebecca Fleisch Cordeiro

Hi Hugh,

I quickly created a Pick Many quiz and I think I've achieved what you're after. I've attached it here.

I quickly skimmed this thread and saw that in the suggestions to Eric's question, Phil had recommended using T/F for tracking counters. So please note that I did NOT do that here. I simply went with your request which you said is like the one Shelley made to increase the counter for selected and decrease it for deselected items. Hopefully, Phil will weigh in if it's still best to add a T/F variable here.

If you have any questions about what I did, please shout out and I'll add instructions here.

Rebecca Fleisch Cordeiro

Hi Phil,

Can you please explain what you mean by the 232222? I want to understand if we need a T/F variable here, but I don't have and 2's and 3's in the slide? I just quickly threw tog. a "scenario" (and I use the term loosely) where Learners were asked to select items. If they selected, the count would go up; if they deselected, the count would go down. Looks like this:

Only marks as correct if they choose the objects with red, which is how the "pick many" is set up. And it seems to be adding or subtracting correctly no matter which way I do it?