Rotating content box triggers

I'm creating a content box that has 3 different paragraphs that it can display, one at a time. Imagine it like a sliding carousel of photos. When you click an arrow, the content inside changes. To do this, I've created a rectangular box and put a text box on top of it with the content, along with a close button and two arrows for forward and back. The text box has 3 states with the three content paragraphs. It's all going smoothly until I try to set up the triggers. I've faced this before when doing state changes and I've wanted one button to do different things: I set the button to change from Normal to state 2 with the condition "if shape text box == normal". Then I make a new trigger that says change from state 2 to state 3 with the condition "if shape text box == state 2". This second trigger breaks the whole thing because once you click the arrow, the shape is now in state 2, which means it goes through and changes it to state 3 as well. I want to know what the right way to program this interaction is. I want one state change per button click. I've used variables before, but it seems like that might be opening up a pandora's box of potential new glitches and that this should be simpler. 

3 Replies
Walt Hamilton

As you describe, it isn't that simple, because every time a trigger changes the state, it is in that state when the next trigger checks it.

The only solution is to have an independent object that changes only one time in the trigger series. Use the state or value of that object in your conditions to determine the correct new state of your target object. A little thought will show that using the states of a a second object is possible, but requires a great deal of care and effort to avoid this same catch 22 situation. You would need to change the second object according to the state of the first object, then change the first according to the second. It is much simpler and easier to use a numeric variable.

For example:

Change Variable1 add 1  when user clicks Button1

Change Variable1 = 1 when user clicks Button1 if Button1 >3

(This is so much easier with just two states: you can use a T/F variable, and just toggle it.)

Change state of TargetObject to State1 when user clicks Button1 if Variable1 = 1

Change state of TargetObject to State2 when user clicks Button1 if Variable1 = 2

Change state of TargetObject to State3 when user clicks Button1 if Variable1 = 3