See how blending a little bit of JavaScript into your Storyline 2 courses can help you get more out of your variables. Read this blog post for additional context.
Hey Mathew,
As Zsolt mentioned in his article, it is possible to do the above scenario with triggers and conditions you will just need a lot of them.
So for example one way to replicate the above slide could be done like this.
- Create 5 True/False Variables (i.e var1, var 2, var3 etc) set all to false
- Create 1 number variable and set it to 0
- Create 5 buttons (ensure they have a selected state to reduce triggers* Also delete the visited state if they have one)
- Create 1 shape to act as the door in this example. Ensure it has an open state (custom state)
So for the door to open any 3 of the 5 buttons have to be clicked on (i.e be in the selected state).
Our true false variables, will tell us when the buttons are turned on and our count variable will help us keep tra... Expand
Hey Mathew,
As Zsolt mentioned in his article, it is possible to do the above scenario with triggers and conditions you will just need a lot of them.
So for example one way to replicate the above slide could be done like this.
- Create 5 True/False Variables (i.e var1, var 2, var3 etc) set all to false
- Create 1 number variable and set it to 0
- Create 5 buttons (ensure they have a selected state to reduce triggers* Also delete the visited state if they have one)
- Create 1 shape to act as the door in this example. Ensure it has an open state (custom state)
So for the door to open any 3 of the 5 buttons have to be clicked on (i.e be in the selected state).
Our true false variables, will tell us when the buttons are turned on and our count variable will help us keep track of how many are turned on at once.
Each button will need the following 3 triggers:
1: Toggle the true/false variable when the button is clicked on / off.
The logic would be like this:
Adjust variable: var1
= NOT assignment
when user clicks
button 1
2. Add + 1 to our count variable when the button is clicked on (Selected)
Adjust variable: count
+ Add
Value: 1
when user clicks
button 1
(condition: var1 != to False)
3. Subtract 1 from our count variable when the button is clicked off (normal state)
Adjust variable: count
- Subtract
Value: 1
when user click
button 1
(condition: var1 != to True)
So with five button buttons we are currently at 15 triggers and 6 variables.
The final trigger we need will open the door. The logic would look something like this:
Change state of Door
to state open
when variable changes
variable: count
(Condition that variable count ==Equal to a value of 3)
Sorry for the massive post. That's one way you could achieve a similar result.
Here is a link to an example so you can see it working in action. - https://goo.gl/rfthk2
Hope this helps!
I'm going to try this! It definitely looks faster.
Just a heads up for those who don't yet know: you can toggle T/F variables in Storyline directly. I'll give the rundown, let me know if anyone wants me to mock up a SL2 file.
Steps to toggle T/F variables:
1. Make T/F variables.
2. Make new triggers, changing the OPERATOR choice to "=NOT Assignment" when the user clicks one of the choices. This is "Toggle" in English (!= in JS): false becomes true, true becomes false.
Number variable:
3. upon clicking the button it's related to, trigger an adjustment in the number variable +1 or -1 , depending on whether the T/F variable is true or false.
4. also trigger the door to open when the user clicks one of the buttons IF the number variable is greater than or equal to 5 (****in the t... Expand
I'm going to try this! It definitely looks faster.
Just a heads up for those who don't yet know: you can toggle T/F variables in Storyline directly. I'll give the rundown, let me know if anyone wants me to mock up a SL2 file.
Steps to toggle T/F variables:
1. Make T/F variables.
2. Make new triggers, changing the OPERATOR choice to "=NOT Assignment" when the user clicks one of the choices. This is "Toggle" in English (!= in JS): false becomes true, true becomes false.
Number variable:
3. upon clicking the button it's related to, trigger an adjustment in the number variable +1 or -1 , depending on whether the T/F variable is true or false.
4. also trigger the door to open when the user clicks one of the buttons IF the number variable is greater than or equal to 5 (****in the trigger window: be sure to put this trigger below the T/F toggle trigger , as the order matters, lower are executed last).
Copy-paste the triggers and change to suit for efficiency purposes (e.g., copy "toggle var1 when user clicks" from button one, and paste to button 2, change the var to var2).
-Total variables required: 6
-Total triggers required: 20 (3 for each button: one to toggle respective T/F variable, one to adjust number variable, one to open door if number is 5 or more, one to close door if number is 4 or less.
-Total state changes required: 0.
4 Comments
Hey Mathew, As Zsolt mentioned in his article, it is possible to do the above scenario with triggers and conditions you will just need a lot of them. So for example one way to replicate the above slide could be done like this. - Create 5 True/False Variables (i.e var1, var 2, var3 etc) set all to false - Create 1 number variable and set it to 0 - Create 5 buttons (ensure they have a selected state to reduce triggers* Also delete the visited state if they have one) - Create 1 shape to act as the door in this example. Ensure it has an open state (custom state) So for the door to open any 3 of the 5 buttons have to be clicked on (i.e be in the selected state). Our true false variables, will tell us when the buttons are turned on and our count variable will help us keep tra... Expand
I'm going to try this! It definitely looks faster. Just a heads up for those who don't yet know: you can toggle T/F variables in Storyline directly. I'll give the rundown, let me know if anyone wants me to mock up a SL2 file. Steps to toggle T/F variables: 1. Make T/F variables. 2. Make new triggers, changing the OPERATOR choice to "=NOT Assignment" when the user clicks one of the choices. This is "Toggle" in English (!= in JS): false becomes true, true becomes false. Number variable: 3. upon clicking the button it's related to, trigger an adjustment in the number variable +1 or -1 , depending on whether the T/F variable is true or false. 4. also trigger the door to open when the user clicks one of the buttons IF the number variable is greater than or equal to 5 (****in the t... Expand