Trigger, State and Variable help

I'm working on a simple exercise to teach myself about states, triggers and variables.  I've created three circles (oval1, oval 2 and oval3) with a Normal and Visited state.  When the user clicks on a circle I want it's state to change from Normal to Visited, add 1 to the variable %Counter% if the oval's state is normal when clicked (I also tried oval's state is not equal to visited), and display a new layer that says all three circles have been clicked when the counter reaches 3. 

It works in that the layer shows when the counter reaches 3 and the object states change from Normal to Visited when each circle is clicked.  The only problem is that the counter increases even if the same circle is clicked multiple times so a user could click the same circle three times and the success message/layer would be displayed.  The problem seems to be with the counter being increased even when the state of the object is Visited.  It's only supposed to increase the variable when the object is clicked in the Normal state.

Can anyone tell what I'm doing wrong?  I've attached the file (one slide) in case anyone wants to look at it.

5 Replies
Christine Hendrickson

Hi Steve!

Thanks for sharing the file I took a quick look at the course and I changed the trigger to fire when the states are "not equal to" "Visited". I also changed the order of the triggers so that the variable fires first and not the state change. This seems to have everything working on my side.

I'm attaching the modified file. Can you take a look and see if it's working for you this way, please?

Thanks!

Steve Shoemaker

Thanks Christine (and Michael)!  Christine's solution worked.  I didn't try Michael's yet but I will just to be thorough and to learn all the options for making this work. 

The key must be the order of the triggers on the ovals.  My original attempt used the trigger of "add 1 to the variable if the state of the oval was not equal to visited" but when it wasn't working I changed that trigger to "add 1 to the variable if the state of the oval is equal to Normal."  So Christine changed the trigger back to what I had originally written. 

The difference is the change in the order of the triggers and now it works as I intended.  I'm clarifying in order to make this more helpful as a troubleshooting exercise. 

Thanks again for your help.

Steve Shoemaker

I just tested Michael's solution and it also works.  The only difference is that the mouse pointer does not change to a hand when hovering over a circle with a disabled state.  It still changes to a hand in Christine's version (object state is Visited rather than Disabled).  So either solution will work. 

Incidentally, in Michael's solution the triggers were still in the original order (change state of object, then add 1 to counter) and it still worked the way I had intended.