Variables, triggers, states and tantrums

Jun 10, 2014


I'm having some trouble with variables changing the state of an object.

I have 9 buttons and I want to add a value of 1 to a variable every time a button is selected, when the variable equals 1 I want it to change the state of an object then again when the variable reaches say 2,3,4 etc. I've no trouble doing this, however, I also want the variable to subtract a value of 1 when the user deselects the button, this is what is causing me the trouble and change the state od the object again.

Thank you for any help you are able to give.


4 Replies
Meryem M

Matthew, I like that tantrum state.  Change state of Button1 to Deselected when state of User =Equal Tantrum.  That should work!

Seriously, though, this is an interesting puzzle.  Are you using Button Sets?  If so, the button will automatically be un-Selected whenever another button is Selected.  But there is no state for "deselected."  The button would go to the Visited state then.

I don't see enough detail for me to understand what you are trying to accomplish.  When someone clicks the button you want the variable to increase, right?  What happens when someone clicks the button the second time?  Does that mean the button was deselected, or is that the trigger for another increase of the variable?  Can more than one button be selected at a time?  

It doesn't sound like you are trying to use the standard behavior of buttons, so it might mean needing to avoid the built-in states.  

 Instead of using the built-in Selected state, make your own state, call it Chosen or something.  Then make another state called UnChosen and have that be the initial state.  

Steve Flowers

Hey Matthew,

Take a look at the attached example. This uses a variable listener to change the state of the object. There are 4 listeners for each range. They execute from highest to lowest. The state will change progressively and overwrite the previously set state as new conditions are met. 

This discussion is closed. You can start a new discussion or contact Articulate Support.