Setting Limits to Numbers Variables

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?

4 Replies
Samantha Gerard

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.

Ned Whiteley

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.