Two triggers on 1 button to change state of variable
May 25, 2015
By
Gary Collins
I have 1 button that changes a variable (default value of True).
Set variable == false when button clicked. This works as intended.
But,
If I add 2 triggers on 1 button like so.
Trigger 1: Set variable == true when user clicks if variable == false.
Trigger 2: Set variable == false when user clicks if variable == true.
I would have thought that when clicked it would go through the list of triggers for that button and implement the one that the statement was true for.
I thought it may have been because I used a True/False variable for some reason and created another button and set of variables that used a value of on/off. Still didn't work.
The idea was to use 1 button to change a variable based on what it's current status is.
9 Replies
So this is difficult to do on a single object without actioning JS each time its clicked. A simple way is to have 2 buttons that are identical, as you click the first it hides itself and shows the second and vice versa. You can use the triggers you made but on a separate button.
Thanks, and I did figure out that workaround.
But logically I don't understand why my way doesn't work in storyline.
If the condition doesn't work out on 1 trigger it shouldn't do anything and then move to the next trigger, if the condition is met in the next trigger than make the change and keep moving down the trigger list if there is more.
I think its because it can do the initial change but then the triggers get confused as if its doing a permanent loop on each click.
Hi Gary,
Please take a look at the attached file. Values change to True and False when the buttons are clicked.
I used Toggle Variable trigger.
Thanks,
Hassan,
That's great!! I didn't know about the toggle trigger.
Thanks
Thanks for the update. :-)
Glad you were able to get the assistance that you needed here Gary :) Thanks for the update.
Without testing I guess the problem is that if the variable is false will the first trigger execure as expected. The second trigger is then tested, and now the variable is true since the first trigger already is executed and this sets the variable back to false.
Hello Johan and welcome to E-Learning Heroes :)
Looks like you are popping in to offer some assistance here. This thread is a bit older and I'm not sure that it will help those from before, but it could certainly help someone that runs across this thread in the future.
If I've misunderstood, just let me know how I can help :)
This discussion is closed. You can start a new discussion or contact Articulate Support.