Button and varable
Nov 14, 2012
Hi.
I have a variable which increases in value by three different buttons. If I press button1, value increases with 1. Same for the other buttons. BUT, if I press button 1 again the value should not increase again. How can I play around with the values to make this happen?
For button 1 I have the following script in the Trigger wizard:
Action: Adjust
Variable: K2
Operator: +Add
Value: Value 1
But this setup will add 1 to K2 each time I click on button 1. After the first click on that button it should not add any exra value to K2.
Any ideas?
gustaf
7 Replies
Hi Gustav,
You can always add some extra logic to your trigger by adding conditions
In your trigger click on conditions
To add a condition clikc on the green +
You can add as many conditions as you like
By adding this extra logic, you'll achieve what you xant to achieve
Geert
Yes I know about the Add Trigger Condition but I dont know how to forulate that condition?
Hi Gustaf,
Just add condition if K2 equal to 0 to the button's trigger.
Hope it helps,
Alex
Hi Aelex.
Not sure it that helps as that only would apply to the first button. If the user has klicked on two of the buttons the value is 2. If then clicking on button three values is three the condition you suggest would erase the counting.
Sorry about that, you had not specified that the other buttons could be clicked at any time...
It that case, you can do the following :
1) Set a 2nd variable, this time a True/False one (lets call this K3) with an initial value of true.
2) Set a trigger when Button 1 is clicked to add +1 to K2 if (condition) K3 is true.
3) Set a trigger when Button 1 is clicked to change value of K3 to false.
That ought to do it.
Alex
Thx Alex.
That would do it.
gustaf
The easier approach is to set the condition around the state of the button, instead of using more variables. Your conditional statement would be similar to:
Add 1 to K2 if the state of "Button 1" is not equal to Visited
or
Add 1 to K2 if the state of "Button 1" is equal to Normal
Once the user clicks the button, the button state should change to Visited and prevent the variable from incrementing again. You'll also want to ensure that Storyline does not reset the slide when you return to it to preserve the button states.
This discussion is closed. You can start a new discussion or contact Articulate Support.