Counting checkbox interactions

Can anybody suggest the best way of having a list of checkboxes and displaying a running score based on the number of boxes ticked?

I suspect there is a very simple answer to this but I am struggling to get my head around it.

My initial thought was to create a number variable which would increase by one everytime a check box was in its selected state i.e. ticked and would reveal an image e.g. 6/10 to match the relevant total. Unfortunately although I can get the variable to increase by one when selected, I can't get it to decrease by one if subsequently deselected. Also each check box will obviously increase by 1 indefinately each time it is ticked (although I could add a true/false variable to deal with that particular problem).

As always any suggestions are very much appreciated.

 

6 Replies
Steve Flowers

Hey Paul - 

I noticed the same thing you did with the trigger subtraction not working on deselection. It seems to work OK for drag and drop (calculating in and out) but not with object states. 

There was something that did work for me. Please see the attached file for an example. This uses a hidden object as a function. Whenever one of the boxes is clicked (I used NOT DOWN to ensure that it shows when the mouse is up and sees the new selected state), this box shows and executes a sequence of triggers:

  1. It sets the total to zero.
  2. It adds one for each object that is selected with a separate trigger condition for each checkbox.
  3. It hides the function object so it's ready to run again.

This method is additive only. It works by recalculating the state of all objects every time. This gives the appearance of subtraction:) Same result either way.

 

Paul Brennan

Steve,

Thanks for your help. That also does the trick nicely. This sums up what i most like about storyline. Whenever you hit a brick wall there is usually another way of approaching the problem or some well timed advice from a good samaritan within the articulate community to get you back on track. Much appreciated.

Rafael Vieira

You should create two triggers, but pay attention because the order is important. The first trigger must subtract 1 from the counter when the box is selected and the condition is "if check box state is note equal to selected". The second trigger must add 1 to the counter and the condition will be "if check box state is equal to selected".

Adding these triggers in a different sequence will change the end result of the count.