I have an activity built in storyline that requires users to select and deselect items. When they select something, I want to add to a numbers variable, and when they deselect, I want to subtract from that same numbers variable. The catch is that I don't want the variable to go above 6 or below 0. How do I set these limits?
All you have to do is to add a conditional statement to your triggers that add or subtract 1 to/from your variable. The end result will look something like this (I've used clicking buttons just to enable me to build the triggers):
Hi Ned, thanks for your response. I'm finding is that perhaps the state of the objects is coming into play and messing with the variable. I want learners to click a shape, which will both select it and add 1 to the variable. But if they change their mind and want to deselect it (in other words, have the object return to its normal state from selected), I then want that to subtract 1 from the variable. I'm finding that when they click the object, it selects and adds 1 to the value, but when they click and deslect it, it continues to add 1 to the value.
In the attached example I have created two simple shapes, each with a Normal and a Selected state. When you click on a shape, it changes to Selected and adds one to the variable. If you click on it again it changes back to a Normal state and subtracts one from the variable.
Note that you need to set the triggers up to subtract one when the state is not Selected. Setting up the trigger to subtract one when the state is Normal does not work.
If you have any further queries, just get back to me.
4 Replies
Hi Samantha,
All you have to do is to add a conditional statement to your triggers that add or subtract 1 to/from your variable. The end result will look something like this (I've used clicking buttons just to enable me to build the triggers):
Hi Ned, thanks for your response. I'm finding is that perhaps the state of the objects is coming into play and messing with the variable. I want learners to click a shape, which will both select it and add 1 to the variable. But if they change their mind and want to deselect it (in other words, have the object return to its normal state from selected), I then want that to subtract 1 from the variable. I'm finding that when they click the object, it selects and adds 1 to the value, but when they click and deslect it, it continues to add 1 to the value.
This post was removed by the author
Hi Samantha,
In the attached example I have created two simple shapes, each with a Normal and a Selected state. When you click on a shape, it changes to Selected and adds one to the variable. If you click on it again it changes back to a Normal state and subtracts one from the variable.
Note that you need to set the triggers up to subtract one when the state is not Selected. Setting up the trigger to subtract one when the state is Normal does not work.
If you have any further queries, just get back to me.
Ned, thank you so much! This worked! I was getting hung up on the state being "NOT" selected. I really appreciate your help!
This discussion is closed. You can start a new discussion or contact Articulate Support.