User selection toggle with variable score toggle

Dec 14, 2022

Hello - Learning storyline, but cannot figure out a solution to this problem for my scenario. I want user to select multiple action items from a text list, and once it is selected it is visible to user. Each item for selection  has a corresponding value that will be added to the variable (I know how to do the add/subtract to variable part) but then the user also needs the option of de-selecting the items, and in that case the point value must be subtracted from the variable. And that resets the selection option to original state.  I think of it as a toggle button, click > show it is selected and plus 1 gets added to var > click to deselect, and -1 gets subtracked from variable. I hope that makes sense and thank you for any ideas/solutions for creating this part. 

3 Replies
Walt Hamilton

Give the item a Selected state, and when it is clicked it will automatically change to that state. When clicked if it is in Selected state, it will change to Normal. The Selected state is truly a toggle state. It is the only toggle in SL that functions without a trigger.

Create a trigger to add to variable when item is clicked IF state of item is equal to Selected (the state is changed before the triggers are evaluated).

Create another trigger to subtract from the variable when the item is clicked IF the state of the object is not equal to Selected.