Button and varable

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
Alexandros Anoyatis

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

Stephen Cone

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.